File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,12 +47,11 @@ export class ReservationsService {
4747 }
4848
4949 //Definir codigo
50- private async reservationCode ( ) {
51- const items = await this . getAll ( { top :20000 } ) ;
50+ private async reservationCode ( number : number ) {
5251 let codigo = '00001' ;
5352
54- if ( Array . isArray ( items ) ) {
55- codigo = format5 ( items . length + 1 ) ; // -> "00042"
53+ if ( number ) {
54+ codigo = format5 ( number + 1 ) ; // -> "00042"
5655 }
5756
5857 return codigo ;
@@ -109,6 +108,7 @@ export class ReservationsService {
109108 // ---------- CRUD ----------
110109 async create ( record : Omit < Reservations , 'ID' > ) {
111110 await this . ensureIds ( ) ;
111+ console . table ( record )
112112
113113 const fieldsPayload : any = {
114114 Title : record . Title ,
@@ -119,7 +119,7 @@ export class ReservationsService {
119119 VehicleType : record . VehicleType , // o VehicleType si así se llama tu columna
120120 Status : record . Status ,
121121 OData__ColorTag : record . OData__ColorTag ,
122- Codigo : await this . reservationCode ( )
122+ Codigo : await this . reservationCode ( Number ( record . Codigo ) )
123123 } ;
124124 console . log ( fieldsPayload . Codigo )
125125 const res = await this . graph . post < any > (
You can’t perform that action at this time.
0 commit comments