autosync_backend2 1.1.13 → 1.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.d.ts +356 -315
  2. package/dist/index.js +48 -22
  3. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -311,6 +311,36 @@ declare const app: Elysia<"", {
311
311
  userId: import("@sinclair/typebox").TString;
312
312
  permissions: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
313
313
  }>;
314
+ readonly "CrmCpOrderServiceModel.create": import("@sinclair/typebox").TObject<{
315
+ name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
316
+ quantity: import("@sinclair/typebox").TInteger;
317
+ cpOrderId: import("@sinclair/typebox").TString;
318
+ cpOrderSpPackageId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
319
+ companyServiceKindId: import("@sinclair/typebox").TString;
320
+ priceUnit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
321
+ }>;
322
+ readonly "CrmCpOrderServiceModel.update": import("@sinclair/typebox").TObject<{
323
+ quantity: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
324
+ priceUnit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
325
+ }>;
326
+ readonly "CrmCpOrderServiceModel.select": import("@sinclair/typebox").TObject<{
327
+ cpOrderId: import("@sinclair/typebox").TString;
328
+ }>;
329
+ readonly "CrmCpOrderProductModel.create": import("@sinclair/typebox").TObject<{
330
+ name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
331
+ quantity: import("@sinclair/typebox").TInteger;
332
+ companyProductId: import("@sinclair/typebox").TString;
333
+ cpOrderId: import("@sinclair/typebox").TString;
334
+ cpOrderSpPackageId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
335
+ priceUnit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
336
+ }>;
337
+ readonly "CrmCpOrderProductModel.update": import("@sinclair/typebox").TObject<{
338
+ quantity: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
339
+ priceUnit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
340
+ }>;
341
+ readonly "CrmCpOrderProductModel.select": import("@sinclair/typebox").TObject<{
342
+ cpOrderId: import("@sinclair/typebox").TString;
343
+ }>;
314
344
  readonly "CrmCpOrderModel.create": import("@sinclair/typebox").TObject<{
315
345
  phone: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
316
346
  vin: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
@@ -338,13 +368,6 @@ declare const app: Elysia<"", {
338
368
  model: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
339
369
  }>;
340
370
  readonly "CrmSpPackageServiceModel.create": import("@sinclair/typebox").TObject<{
341
- name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
342
- quantity: import("@sinclair/typebox").TInteger;
343
- cpOrderId: import("@sinclair/typebox").TString;
344
- cpOrderSpPackageId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
345
- companyServiceKindId: import("@sinclair/typebox").TString;
346
- priceUnit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
347
- }> & import("@sinclair/typebox").TObject<{
348
371
  quantity: import("@sinclair/typebox").TInteger;
349
372
  priceTotal: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
350
373
  spPackageId: import("@sinclair/typebox").TString;
@@ -352,9 +375,6 @@ declare const app: Elysia<"", {
352
375
  priceUnit: import("@sinclair/typebox").TNumber;
353
376
  }>;
354
377
  readonly "CrmSpPackageServiceModel.update": import("@sinclair/typebox").TObject<{
355
- quantity: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
356
- priceUnit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
357
- }> & import("@sinclair/typebox").TObject<{
358
378
  quantity: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
359
379
  priceTotal: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
360
380
  spPackageId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
@@ -362,18 +382,9 @@ declare const app: Elysia<"", {
362
382
  priceUnit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
363
383
  }>;
364
384
  readonly "CrmSpPackageServiceModel.select": import("@sinclair/typebox").TObject<{
365
- cpOrderId: import("@sinclair/typebox").TString;
366
- }> & import("@sinclair/typebox").TObject<{
367
385
  spPackageId: import("@sinclair/typebox").TString;
368
386
  }>;
369
387
  readonly "CrmSpPackageProductModel.create": import("@sinclair/typebox").TObject<{
370
- name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
371
- quantity: import("@sinclair/typebox").TInteger;
372
- companyProductId: import("@sinclair/typebox").TString;
373
- cpOrderId: import("@sinclair/typebox").TString;
374
- cpOrderSpPackageId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
375
- priceUnit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
376
- }> & import("@sinclair/typebox").TObject<{
377
388
  quantity: import("@sinclair/typebox").TInteger;
378
389
  priceTotal: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
379
390
  spPackageId: import("@sinclair/typebox").TString;
@@ -381,9 +392,6 @@ declare const app: Elysia<"", {
381
392
  companyProductId: import("@sinclair/typebox").TString;
382
393
  }>;
383
394
  readonly "CrmSpPackageProductModel.update": import("@sinclair/typebox").TObject<{
384
- quantity: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
385
- priceUnit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
386
- }> & import("@sinclair/typebox").TObject<{
387
395
  quantity: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
388
396
  priceTotal: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
389
397
  spPackageId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
@@ -391,8 +399,6 @@ declare const app: Elysia<"", {
391
399
  companyProductId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
392
400
  }>;
393
401
  readonly "CrmSpPackageProductModel.select": import("@sinclair/typebox").TObject<{
394
- cpOrderId: import("@sinclair/typebox").TString;
395
- }> & import("@sinclair/typebox").TObject<{
396
402
  spPackageId: import("@sinclair/typebox").TString;
397
403
  }>;
398
404
  readonly "CrmSpPackageModel.create": import("@sinclair/typebox").TObject<{
@@ -3074,174 +3080,86 @@ declare const app: Elysia<"", {
3074
3080
  "cp-order": {};
3075
3081
  } & {
3076
3082
  "cp-order": {
3077
- get: {
3078
- body: unknown;
3079
- params: {};
3080
- query: {
3081
- id?: string | undefined;
3082
- createdAt?: string | undefined;
3083
- phone?: string | undefined;
3084
- orderId?: string | undefined;
3085
- state?: "CREATED" | "COMPLETE" | "PROGRESSING" | undefined;
3086
- vin?: string | undefined;
3087
- licensePlate?: string | undefined;
3088
- timeCompleted?: string | undefined;
3089
- model?: string | undefined;
3090
- pagination: {
3091
- size: number;
3092
- page: number;
3083
+ service: {};
3084
+ } & {
3085
+ service: {
3086
+ get: {
3087
+ body: unknown;
3088
+ params: {};
3089
+ query: {
3090
+ cpOrderId: string;
3093
3091
  };
3094
- };
3095
- headers: unknown;
3096
- response: {
3097
- 200: {
3098
- totalCount: number;
3099
- totalPage: number;
3100
- result: {
3101
- order: {
3092
+ headers: unknown;
3093
+ response: {
3094
+ 200: {
3095
+ service_kind: {
3096
+ serviceKindId: string | null;
3102
3097
  companyId: string;
3103
- companyBranchId: string;
3104
- customerId: string | null;
3105
- vehicleId: string;
3106
- orderId: string;
3107
- state: "CREATED" | "COMPLETE" | "PROGRESSING";
3108
- timeCompleted: Date | null;
3109
- id: string;
3110
- createdAt: string;
3111
- updatedAt: string;
3112
- deletedAt: string | null;
3113
- };
3114
- vehicle: {
3115
- customerId: string | null;
3116
- vehicleKindId: string;
3117
- vin: string | null;
3118
- licensePlate: string | null;
3119
- color: string | null;
3120
- engineCc: string | null;
3121
- cylinder: string | null;
3122
- gasType: string | null;
3123
- transmissionType: string | null;
3124
- vehicleType: string | null;
3125
- yearManufacture: number | null;
3126
- yearImport: number | null;
3127
- steering: string | null;
3128
- engineCode: string | null;
3129
- transmissionCode: string | null;
3130
- driveTrain: string | null;
3131
- id: string;
3132
- createdAt: string;
3133
- updatedAt: string;
3134
- deletedAt: string | null;
3135
- };
3136
- make: {
3137
- vehicleKindEnum: "MAKE" | "MODEL_GROUP" | "MODEL";
3138
- parentId: string | null;
3139
- name: string;
3140
- description: string | null;
3141
- yearStart: number | null;
3142
- yearEnd: number | null;
3143
- imagePath: string | null;
3144
- id: string;
3145
- createdAt: string;
3146
- updatedAt: string;
3147
- deletedAt: string | null;
3148
- } | null;
3149
- model: {
3150
- vehicleKindEnum: "MAKE" | "MODEL_GROUP" | "MODEL";
3151
- parentId: string | null;
3098
+ branchId: string | null;
3152
3099
  name: string;
3153
3100
  description: string | null;
3154
- yearStart: number | null;
3155
- yearEnd: number | null;
3156
- imagePath: string | null;
3101
+ enabled: boolean;
3102
+ price: number;
3157
3103
  id: string;
3158
3104
  createdAt: string;
3159
3105
  updatedAt: string;
3160
3106
  deletedAt: string | null;
3161
- } | null;
3162
- customer: {
3163
- companyId: string | null;
3164
- firstname: string | null;
3165
- lastname: string | null;
3166
- phoneNumber: string;
3167
- email: string | null;
3168
- regNum: string | null;
3107
+ };
3108
+ cp_order_service: {
3109
+ cpOrderId: string;
3110
+ cpOrderSpPackageId: string | null;
3111
+ companyServiceKindId: string;
3112
+ quantity: number;
3113
+ priceUnit: number;
3114
+ priceTotal: number;
3115
+ name: string | null;
3169
3116
  id: string;
3170
3117
  createdAt: string;
3171
3118
  updatedAt: string;
3172
3119
  deletedAt: string | null;
3173
- } | null;
3174
- isDeleteAble: unknown;
3120
+ };
3175
3121
  }[];
3176
- };
3177
- 422: {
3178
- type: "validation";
3179
- on: string;
3180
- summary?: string;
3181
- message?: string;
3182
- found?: unknown;
3183
- property?: string;
3184
- expected?: string;
3185
- };
3186
- };
3187
- };
3188
- };
3189
- } & {
3190
- "cp-order": {
3191
- post: {
3192
- body: {
3193
- phone?: string | undefined;
3194
- vehicleKindId?: string | undefined;
3195
- vin?: string | undefined;
3196
- licensePlate?: string | undefined;
3197
- };
3198
- params: {};
3199
- query: unknown;
3200
- headers: unknown;
3201
- response: {
3202
- 200: {
3203
- id: string;
3204
- createdAt: string;
3205
- updatedAt: string;
3206
- companyId: string;
3207
- deletedAt: string | null;
3208
- orderId: string;
3209
- state: "CREATED" | "COMPLETE" | "PROGRESSING";
3210
- customerId: string | null;
3211
- vehicleId: string;
3212
- companyBranchId: string;
3213
- timeCompleted: Date | null;
3214
- };
3215
- 502: string;
3216
- 400: "Машины дугаар болон VIN хоёроос нэгийг нь оруулна уу." | "Машины VIN оруулсан бол машины төрөл оруулна уу.";
3217
- 422: {
3218
- type: "validation";
3219
- on: string;
3220
- summary?: string;
3221
- message?: string;
3222
- found?: unknown;
3223
- property?: string;
3224
- expected?: string;
3122
+ 422: {
3123
+ type: "validation";
3124
+ on: string;
3125
+ summary?: string;
3126
+ message?: string;
3127
+ found?: unknown;
3128
+ property?: string;
3129
+ expected?: string;
3130
+ };
3225
3131
  };
3226
3132
  };
3227
3133
  };
3228
- };
3229
- } & {
3230
- "cp-order": {
3231
- package: {
3134
+ } & {
3135
+ service: {
3232
3136
  post: {
3233
3137
  body: {
3138
+ name?: string | null | undefined;
3139
+ priceUnit?: number | undefined;
3140
+ cpOrderSpPackageId?: string | null | undefined;
3234
3141
  quantity: number;
3235
- spPackageId: string;
3236
3142
  cpOrderId: string;
3143
+ companyServiceKindId: string;
3237
3144
  };
3238
3145
  params: {};
3239
3146
  query: unknown;
3240
3147
  headers: unknown;
3241
3148
  response: {
3242
- 200: undefined;
3243
- 404: "Багцийн үйлчилгээ олдсонгүй." | "Засвар үйлчилгээ олдсонгүй.";
3244
- 400: "Суурь багцад бараа эсвэл үйлчилгээ байхгүй байна.";
3149
+ 200: {
3150
+ name: string | null;
3151
+ id: string;
3152
+ createdAt: string;
3153
+ updatedAt: string;
3154
+ deletedAt: string | null;
3155
+ quantity: number;
3156
+ priceTotal: number;
3157
+ priceUnit: number;
3158
+ cpOrderId: string;
3159
+ cpOrderSpPackageId: string | null;
3160
+ companyServiceKindId: string;
3161
+ };
3162
+ 404: "Үйлчилгээний төрөл олдсонгүй.";
3245
3163
  422: {
3246
3164
  type: "validation";
3247
3165
  on: string;
@@ -3254,22 +3172,35 @@ declare const app: Elysia<"", {
3254
3172
  };
3255
3173
  };
3256
3174
  };
3257
- };
3258
- } & {
3259
- "cp-order": {
3260
- ":id": {
3261
- complete: {
3262
- post: {
3263
- body: unknown;
3175
+ } & {
3176
+ service: {
3177
+ ":id": {
3178
+ put: {
3179
+ body: {
3180
+ quantity?: number | undefined;
3181
+ priceUnit?: number | undefined;
3182
+ };
3264
3183
  params: {
3265
3184
  id: string;
3266
3185
  };
3267
3186
  query: unknown;
3268
3187
  headers: unknown;
3269
3188
  response: {
3270
- 200: undefined;
3271
- 404: "Засвар үйлчилгээ олдсонгүй.";
3272
- 422: {
3189
+ 200: {
3190
+ cpOrderId: string;
3191
+ cpOrderSpPackageId: string | null;
3192
+ companyServiceKindId: string;
3193
+ quantity: number;
3194
+ priceUnit: number;
3195
+ priceTotal: number;
3196
+ name: string | null;
3197
+ id: string;
3198
+ createdAt: string;
3199
+ updatedAt: string;
3200
+ deletedAt: string | null;
3201
+ };
3202
+ 404: "Үйлчилгээ олдсонгүй.";
3203
+ 422: {
3273
3204
  type: "validation";
3274
3205
  on: string;
3275
3206
  summary?: string;
@@ -3282,29 +3213,27 @@ declare const app: Elysia<"", {
3282
3213
  };
3283
3214
  };
3284
3215
  };
3285
- };
3286
- } & {
3287
- "cp-order": {
3288
- ":id": {
3289
- delete: {
3290
- body: unknown;
3291
- params: {
3292
- id: string;
3293
- };
3294
- query: unknown;
3295
- headers: unknown;
3296
- response: {
3297
- 200: undefined;
3298
- 404: "Засвар үйлчилгээ олдсонгүй.";
3299
- 400: "Үйлчилгээ хоосон биш байна.";
3300
- 422: {
3301
- type: "validation";
3302
- on: string;
3303
- summary?: string;
3304
- message?: string;
3305
- found?: unknown;
3306
- property?: string;
3307
- expected?: string;
3216
+ } & {
3217
+ service: {
3218
+ ":id": {
3219
+ delete: {
3220
+ body: unknown;
3221
+ params: {
3222
+ id: string;
3223
+ };
3224
+ query: unknown;
3225
+ headers: unknown;
3226
+ response: {
3227
+ 200: void;
3228
+ 422: {
3229
+ type: "validation";
3230
+ on: string;
3231
+ summary?: string;
3232
+ message?: string;
3233
+ found?: unknown;
3234
+ property?: string;
3235
+ expected?: string;
3236
+ };
3308
3237
  };
3309
3238
  };
3310
3239
  };
@@ -3312,9 +3241,9 @@ declare const app: Elysia<"", {
3312
3241
  };
3313
3242
  } & {
3314
3243
  "cp-order": {
3315
- service: {};
3244
+ product: {};
3316
3245
  } & {
3317
- service: {
3246
+ product: {
3318
3247
  get: {
3319
3248
  body: unknown;
3320
3249
  params: {};
@@ -3324,17 +3253,37 @@ declare const app: Elysia<"", {
3324
3253
  headers: unknown;
3325
3254
  response: {
3326
3255
  200: {
3327
- cpOrderId: string;
3328
- cpOrderSpPackageId: string | null;
3329
- companyServiceKindId: string;
3330
- quantity: number;
3331
- priceUnit: number;
3332
- priceTotal: number;
3333
- name: string | null;
3334
- id: string;
3335
- createdAt: string;
3336
- updatedAt: string;
3337
- deletedAt: string | null;
3256
+ product: {
3257
+ supplierId: string;
3258
+ productId: string | null;
3259
+ name: string;
3260
+ description: string | null;
3261
+ priceSell: number;
3262
+ priceBuy: number;
3263
+ barCode: string | null;
3264
+ oen: string | null;
3265
+ partNumber: string;
3266
+ alias: string | null;
3267
+ companyId: string;
3268
+ type: string | null;
3269
+ id: string;
3270
+ createdAt: string;
3271
+ updatedAt: string;
3272
+ deletedAt: string | null;
3273
+ };
3274
+ cp_order_product: {
3275
+ cpOrderId: string;
3276
+ companyProductId: string;
3277
+ cpOrderSpPackageId: string | null;
3278
+ quantity: number;
3279
+ priceUnit: number;
3280
+ priceTotal: number;
3281
+ name: string | null;
3282
+ id: string;
3283
+ createdAt: string;
3284
+ updatedAt: string;
3285
+ deletedAt: string | null;
3286
+ };
3338
3287
  }[];
3339
3288
  422: {
3340
3289
  type: "validation";
@@ -3349,15 +3298,15 @@ declare const app: Elysia<"", {
3349
3298
  };
3350
3299
  };
3351
3300
  } & {
3352
- service: {
3301
+ product: {
3353
3302
  post: {
3354
3303
  body: {
3355
3304
  name?: string | null | undefined;
3356
3305
  priceUnit?: number | undefined;
3357
3306
  cpOrderSpPackageId?: string | null | undefined;
3358
3307
  quantity: number;
3308
+ companyProductId: string;
3359
3309
  cpOrderId: string;
3360
- companyServiceKindId: string;
3361
3310
  };
3362
3311
  params: {};
3363
3312
  query: unknown;
@@ -3372,11 +3321,11 @@ declare const app: Elysia<"", {
3372
3321
  quantity: number;
3373
3322
  priceTotal: number;
3374
3323
  priceUnit: number;
3324
+ companyProductId: string;
3375
3325
  cpOrderId: string;
3376
3326
  cpOrderSpPackageId: string | null;
3377
- companyServiceKindId: string;
3378
3327
  };
3379
- 404: "Үйлчилгээний төрөл олдсонгүй.";
3328
+ 404: "Бараа олдсонгүй.";
3380
3329
  422: {
3381
3330
  type: "validation";
3382
3331
  on: string;
@@ -3390,7 +3339,7 @@ declare const app: Elysia<"", {
3390
3339
  };
3391
3340
  };
3392
3341
  } & {
3393
- service: {
3342
+ product: {
3394
3343
  ":id": {
3395
3344
  put: {
3396
3345
  body: {
@@ -3405,8 +3354,8 @@ declare const app: Elysia<"", {
3405
3354
  response: {
3406
3355
  200: {
3407
3356
  cpOrderId: string;
3357
+ companyProductId: string;
3408
3358
  cpOrderSpPackageId: string | null;
3409
- companyServiceKindId: string;
3410
3359
  quantity: number;
3411
3360
  priceUnit: number;
3412
3361
  priceTotal: number;
@@ -3416,7 +3365,7 @@ declare const app: Elysia<"", {
3416
3365
  updatedAt: string;
3417
3366
  deletedAt: string | null;
3418
3367
  };
3419
- 404: "Үйлчилгээ олдсонгүй.";
3368
+ 404: "Барааны захиалга олдсонгүй.";
3420
3369
  422: {
3421
3370
  type: "validation";
3422
3371
  on: string;
@@ -3431,7 +3380,7 @@ declare const app: Elysia<"", {
3431
3380
  };
3432
3381
  };
3433
3382
  } & {
3434
- service: {
3383
+ product: {
3435
3384
  ":id": {
3436
3385
  delete: {
3437
3386
  body: unknown;
@@ -3458,71 +3407,174 @@ declare const app: Elysia<"", {
3458
3407
  };
3459
3408
  } & {
3460
3409
  "cp-order": {
3461
- product: {};
3462
- } & {
3463
- product: {
3464
- get: {
3465
- body: unknown;
3466
- params: {};
3467
- query: {
3468
- cpOrderId: string;
3410
+ get: {
3411
+ body: unknown;
3412
+ params: {};
3413
+ query: {
3414
+ id?: string | undefined;
3415
+ createdAt?: string | undefined;
3416
+ phone?: string | undefined;
3417
+ orderId?: string | undefined;
3418
+ state?: "CREATED" | "COMPLETE" | "PROGRESSING" | undefined;
3419
+ vin?: string | undefined;
3420
+ licensePlate?: string | undefined;
3421
+ timeCompleted?: string | undefined;
3422
+ model?: string | undefined;
3423
+ pagination: {
3424
+ size: number;
3425
+ page: number;
3469
3426
  };
3470
- headers: unknown;
3471
- response: {
3472
- 200: {
3473
- cpOrderId: string;
3474
- companyProductId: string;
3475
- cpOrderSpPackageId: string | null;
3476
- quantity: number;
3477
- priceUnit: number;
3478
- priceTotal: number;
3479
- name: string | null;
3480
- id: string;
3481
- createdAt: string;
3482
- updatedAt: string;
3483
- deletedAt: string | null;
3427
+ };
3428
+ headers: unknown;
3429
+ response: {
3430
+ 200: {
3431
+ totalCount: number;
3432
+ totalPage: number;
3433
+ result: {
3434
+ order: {
3435
+ companyId: string;
3436
+ companyBranchId: string;
3437
+ customerId: string | null;
3438
+ vehicleId: string;
3439
+ orderId: string;
3440
+ state: "CREATED" | "COMPLETE" | "PROGRESSING";
3441
+ timeCompleted: Date | null;
3442
+ id: string;
3443
+ createdAt: string;
3444
+ updatedAt: string;
3445
+ deletedAt: string | null;
3446
+ };
3447
+ vehicle: {
3448
+ customerId: string | null;
3449
+ vehicleKindId: string;
3450
+ vin: string | null;
3451
+ licensePlate: string | null;
3452
+ color: string | null;
3453
+ engineCc: string | null;
3454
+ cylinder: string | null;
3455
+ gasType: string | null;
3456
+ transmissionType: string | null;
3457
+ vehicleType: string | null;
3458
+ yearManufacture: number | null;
3459
+ yearImport: number | null;
3460
+ steering: string | null;
3461
+ engineCode: string | null;
3462
+ transmissionCode: string | null;
3463
+ driveTrain: string | null;
3464
+ id: string;
3465
+ createdAt: string;
3466
+ updatedAt: string;
3467
+ deletedAt: string | null;
3468
+ };
3469
+ make: {
3470
+ vehicleKindEnum: "MAKE" | "MODEL_GROUP" | "MODEL";
3471
+ parentId: string | null;
3472
+ name: string;
3473
+ description: string | null;
3474
+ yearStart: number | null;
3475
+ yearEnd: number | null;
3476
+ imagePath: string | null;
3477
+ id: string;
3478
+ createdAt: string;
3479
+ updatedAt: string;
3480
+ deletedAt: string | null;
3481
+ } | null;
3482
+ model: {
3483
+ vehicleKindEnum: "MAKE" | "MODEL_GROUP" | "MODEL";
3484
+ parentId: string | null;
3485
+ name: string;
3486
+ description: string | null;
3487
+ yearStart: number | null;
3488
+ yearEnd: number | null;
3489
+ imagePath: string | null;
3490
+ id: string;
3491
+ createdAt: string;
3492
+ updatedAt: string;
3493
+ deletedAt: string | null;
3494
+ } | null;
3495
+ customer: {
3496
+ companyId: string | null;
3497
+ firstname: string | null;
3498
+ lastname: string | null;
3499
+ phoneNumber: string;
3500
+ email: string | null;
3501
+ regNum: string | null;
3502
+ id: string;
3503
+ createdAt: string;
3504
+ updatedAt: string;
3505
+ deletedAt: string | null;
3506
+ } | null;
3507
+ isDeleteAble: unknown;
3484
3508
  }[];
3485
- 422: {
3486
- type: "validation";
3487
- on: string;
3488
- summary?: string;
3489
- message?: string;
3490
- found?: unknown;
3491
- property?: string;
3492
- expected?: string;
3493
- };
3509
+ };
3510
+ 422: {
3511
+ type: "validation";
3512
+ on: string;
3513
+ summary?: string;
3514
+ message?: string;
3515
+ found?: unknown;
3516
+ property?: string;
3517
+ expected?: string;
3494
3518
  };
3495
3519
  };
3496
3520
  };
3497
- } & {
3498
- product: {
3521
+ };
3522
+ } & {
3523
+ "cp-order": {
3524
+ post: {
3525
+ body: {
3526
+ phone?: string | undefined;
3527
+ vehicleKindId?: string | undefined;
3528
+ vin?: string | undefined;
3529
+ licensePlate?: string | undefined;
3530
+ };
3531
+ params: {};
3532
+ query: unknown;
3533
+ headers: unknown;
3534
+ response: {
3535
+ 200: {
3536
+ id: string;
3537
+ createdAt: string;
3538
+ updatedAt: string;
3539
+ companyId: string;
3540
+ deletedAt: string | null;
3541
+ orderId: string;
3542
+ state: "CREATED" | "COMPLETE" | "PROGRESSING";
3543
+ customerId: string | null;
3544
+ vehicleId: string;
3545
+ companyBranchId: string;
3546
+ timeCompleted: Date | null;
3547
+ };
3548
+ 502: string;
3549
+ 400: "Машины дугаар болон VIN хоёроос нэгийг нь оруулна уу." | "Машины VIN оруулсан бол машины төрөл оруулна уу.";
3550
+ 422: {
3551
+ type: "validation";
3552
+ on: string;
3553
+ summary?: string;
3554
+ message?: string;
3555
+ found?: unknown;
3556
+ property?: string;
3557
+ expected?: string;
3558
+ };
3559
+ };
3560
+ };
3561
+ };
3562
+ } & {
3563
+ "cp-order": {
3564
+ package: {
3499
3565
  post: {
3500
3566
  body: {
3501
- name?: string | null | undefined;
3502
- priceUnit?: number | undefined;
3503
- cpOrderSpPackageId?: string | null | undefined;
3504
3567
  quantity: number;
3505
- companyProductId: string;
3568
+ spPackageId: string;
3506
3569
  cpOrderId: string;
3507
3570
  };
3508
3571
  params: {};
3509
3572
  query: unknown;
3510
3573
  headers: unknown;
3511
3574
  response: {
3512
- 200: {
3513
- name: string | null;
3514
- id: string;
3515
- createdAt: string;
3516
- updatedAt: string;
3517
- deletedAt: string | null;
3518
- quantity: number;
3519
- priceTotal: number;
3520
- priceUnit: number;
3521
- companyProductId: string;
3522
- cpOrderId: string;
3523
- cpOrderSpPackageId: string | null;
3524
- };
3525
- 404: "Бараа олдсонгүй.";
3575
+ 200: undefined;
3576
+ 404: "Багцийн үйлчилгээ олдсонгүй." | "Засвар үйлчилгээ олдсонгүй.";
3577
+ 400: "Суурь багцад бараа эсвэл үйлчилгээ байхгүй байна.";
3526
3578
  422: {
3527
3579
  type: "validation";
3528
3580
  on: string;
@@ -3535,34 +3587,21 @@ declare const app: Elysia<"", {
3535
3587
  };
3536
3588
  };
3537
3589
  };
3538
- } & {
3539
- product: {
3540
- ":id": {
3541
- put: {
3542
- body: {
3543
- quantity?: number | undefined;
3544
- priceUnit?: number | undefined;
3545
- };
3590
+ };
3591
+ } & {
3592
+ "cp-order": {
3593
+ ":id": {
3594
+ complete: {
3595
+ post: {
3596
+ body: unknown;
3546
3597
  params: {
3547
3598
  id: string;
3548
3599
  };
3549
3600
  query: unknown;
3550
3601
  headers: unknown;
3551
3602
  response: {
3552
- 200: {
3553
- cpOrderId: string;
3554
- companyProductId: string;
3555
- cpOrderSpPackageId: string | null;
3556
- quantity: number;
3557
- priceUnit: number;
3558
- priceTotal: number;
3559
- name: string | null;
3560
- id: string;
3561
- createdAt: string;
3562
- updatedAt: string;
3563
- deletedAt: string | null;
3564
- };
3565
- 404: "Барааны захиалга олдсонгүй.";
3603
+ 200: undefined;
3604
+ 404: "Засвар үйлчилгээ олдсонгүй.";
3566
3605
  422: {
3567
3606
  type: "validation";
3568
3607
  on: string;
@@ -3576,27 +3615,29 @@ declare const app: Elysia<"", {
3576
3615
  };
3577
3616
  };
3578
3617
  };
3579
- } & {
3580
- product: {
3581
- ":id": {
3582
- delete: {
3583
- body: unknown;
3584
- params: {
3585
- id: string;
3586
- };
3587
- query: unknown;
3588
- headers: unknown;
3589
- response: {
3590
- 200: void;
3591
- 422: {
3592
- type: "validation";
3593
- on: string;
3594
- summary?: string;
3595
- message?: string;
3596
- found?: unknown;
3597
- property?: string;
3598
- expected?: string;
3599
- };
3618
+ };
3619
+ } & {
3620
+ "cp-order": {
3621
+ ":id": {
3622
+ delete: {
3623
+ body: unknown;
3624
+ params: {
3625
+ id: string;
3626
+ };
3627
+ query: unknown;
3628
+ headers: unknown;
3629
+ response: {
3630
+ 200: undefined;
3631
+ 404: "Засвар үйлчилгээ олдсонгүй.";
3632
+ 400: "Үйлчилгээ хоосон биш байна.";
3633
+ 422: {
3634
+ type: "validation";
3635
+ on: string;
3636
+ summary?: string;
3637
+ message?: string;
3638
+ found?: unknown;
3639
+ property?: string;
3640
+ expected?: string;
3600
3641
  };
3601
3642
  };
3602
3643
  };
package/dist/index.js CHANGED
@@ -138002,7 +138002,7 @@ var crmCpOrderServiceTable = crmSchema.table("cp_order_service", {
138002
138002
  companyServiceKindId: uuid().notNull(),
138003
138003
  quantity: integer().notNull(),
138004
138004
  priceUnit: numeric({ mode: "number" }).notNull(),
138005
- priceTotal: numeric({ mode: "number" }).notNull().$defaultFn(() => sql3`${crmCpOrderServiceTable.priceUnit} * ${crmCpOrderServiceTable.quantity}`).$onUpdateFn(() => sql3`${crmCpOrderServiceTable.priceUnit} * ${crmCpOrderServiceTable.quantity}`),
138005
+ priceTotal: numeric({ mode: "number" }).notNull(),
138006
138006
  name: varchar()
138007
138007
  }, (t2) => [unique().on(t2.cpOrderId, t2.companyServiceKindId)]);
138008
138008
  var crmCpOrderProductTable = crmSchema.table("cp_order_product", {
@@ -138012,7 +138012,7 @@ var crmCpOrderProductTable = crmSchema.table("cp_order_product", {
138012
138012
  cpOrderSpPackageId: uuid(),
138013
138013
  quantity: integer().notNull(),
138014
138014
  priceUnit: numeric({ mode: "number" }).notNull(),
138015
- priceTotal: numeric({ mode: "number" }).notNull().$defaultFn(() => sql3`${crmCpOrderProductTable.priceUnit} * ${crmCpOrderProductTable.quantity}`).$onUpdateFn(() => sql3`${crmCpOrderProductTable.priceUnit} * ${crmCpOrderProductTable.quantity}`),
138015
+ priceTotal: numeric({ mode: "number" }).notNull(),
138016
138016
  name: varchar()
138017
138017
  }, (t2) => [unique().on(t2.cpOrderId, t2.companyProductId)]);
138018
138018
  // src/lib/db/schema/techdoc.schema.ts
@@ -141187,6 +141187,10 @@ var OmitBaseSchema = (type) => {
141187
141187
  var IdSchema = t.Object({
141188
141188
  id: t.String({ format: "uuid" })
141189
141189
  });
141190
+ var UuidSchema = t.String({
141191
+ format: "uuid",
141192
+ default: "00000000-0000-0000-0000-000000000000"
141193
+ });
141190
141194
  var PaginationSchema = t.Object({
141191
141195
  pagination: t.Object({
141192
141196
  page: t.Integer({
@@ -143475,7 +143479,7 @@ var CrmCpOrderProductLogic;
143475
143479
  ((CrmCpOrderProductLogic) => {
143476
143480
  CrmCpOrderProductLogic.select = async ({ cpOrderId }) => {
143477
143481
  const filter = and(eq(crmCpOrderProductTable.cpOrderId, cpOrderId), softDeletedFilter(crmCpOrderProductTable));
143478
- const result = await db_default.select().from(crmCpOrderProductTable).where(filter);
143482
+ const result = await db_default.select().from(crmCpOrderProductTable).innerJoin(warehouseProductTable, eq(warehouseProductTable.id, crmCpOrderProductTable.companyProductId)).where(filter);
143479
143483
  return result;
143480
143484
  };
143481
143485
  CrmCpOrderProductLogic.create = async (body, user2) => {
@@ -143489,8 +143493,18 @@ var CrmCpOrderProductLogic;
143489
143493
  const sk = product.result[0];
143490
143494
  const [result] = await db_default.insert(crmCpOrderProductTable).values({
143491
143495
  ...body,
143492
- priceUnit: sk.priceSell
143493
- }).returning();
143496
+ priceUnit: sk.priceSell,
143497
+ priceTotal: body.quantity * sk.priceSell
143498
+ }).returning().onConflictDoUpdate({
143499
+ target: [
143500
+ crmCpOrderProductTable.cpOrderId,
143501
+ crmCpOrderProductTable.companyProductId
143502
+ ],
143503
+ set: {
143504
+ quantity: sql3`excluded.quantity + ${crmCpOrderProductTable.quantity}`,
143505
+ priceTotal: sql3`(excluded.quantity + ${crmCpOrderProductTable.quantity}) * excluded.price_unit`
143506
+ }
143507
+ });
143494
143508
  return result;
143495
143509
  };
143496
143510
  CrmCpOrderProductLogic.createMany = async (body, user2, tdb = db_default) => {
@@ -143515,7 +143529,8 @@ var CrmCpOrderProductLogic;
143515
143529
  }
143516
143530
  insertValues.push({
143517
143531
  ...item,
143518
- priceUnit: item.priceUnit ?? serviceKind.price
143532
+ priceUnit: item.priceUnit ?? serviceKind.price,
143533
+ priceTotal: item.quantity * (item.priceUnit ?? serviceKind.price)
143519
143534
  });
143520
143535
  }
143521
143536
  await tdb.insert(crmCpOrderProductTable).values(insertValues);
@@ -143540,7 +143555,7 @@ var CrmCpOrderServiceLogic;
143540
143555
  ((CrmCpOrderServiceLogic) => {
143541
143556
  CrmCpOrderServiceLogic.select = async ({ cpOrderId }) => {
143542
143557
  const filter = and(eq(crmCpOrderServiceTable.cpOrderId, cpOrderId), softDeletedFilter(crmCpOrderServiceTable));
143543
- const result = await db_default.select().from(crmCpOrderServiceTable).where(filter);
143558
+ const result = await db_default.select().from(crmCpOrderServiceTable).innerJoin(companyServiceKindTable, eq(companyServiceKindTable.id, crmCpOrderServiceTable.companyServiceKindId)).where(filter);
143544
143559
  return result;
143545
143560
  };
143546
143561
  CrmCpOrderServiceLogic.create = async (body, user2) => {
@@ -143554,8 +143569,18 @@ var CrmCpOrderServiceLogic;
143554
143569
  const sk = serviceKind.results[0];
143555
143570
  const [result] = await db_default.insert(crmCpOrderServiceTable).values({
143556
143571
  ...body,
143557
- priceUnit: sk.price
143558
- }).returning();
143572
+ priceUnit: sk.price,
143573
+ priceTotal: body.quantity * sk.price
143574
+ }).returning().onConflictDoUpdate({
143575
+ set: {
143576
+ quantity: sql3`excluded.quantity + ${crmCpOrderServiceTable.quantity}`,
143577
+ priceTotal: sql3`(excluded.quantity + ${crmCpOrderServiceTable.quantity}) * excluded.price_unit`
143578
+ },
143579
+ target: [
143580
+ crmCpOrderServiceTable.cpOrderId,
143581
+ crmCpOrderServiceTable.companyServiceKindId
143582
+ ]
143583
+ });
143559
143584
  return result;
143560
143585
  };
143561
143586
  CrmCpOrderServiceLogic.createMany = async (body, user2, tdb = db_default) => {
@@ -143580,7 +143605,8 @@ var CrmCpOrderServiceLogic;
143580
143605
  }
143581
143606
  insertValues.push({
143582
143607
  ...item,
143583
- priceUnit: item.priceUnit ?? serviceKind.price
143608
+ priceUnit: item.priceUnit ?? serviceKind.price,
143609
+ priceTotal: item.quantity * (item.priceUnit ?? serviceKind.price)
143584
143610
  });
143585
143611
  }
143586
143612
  await tdb.insert(crmCpOrderServiceTable).values(insertValues);
@@ -143706,7 +143732,7 @@ var CrmCpOrderLogic;
143706
143732
  quantity: i2.quantity,
143707
143733
  priceUnit: i2.priceUnit,
143708
143734
  cpOrderSpPackageId: orderPackage.id,
143709
- name: i2.name
143735
+ name: i2.name ?? undefined
143710
143736
  })), user2, db2);
143711
143737
  }
143712
143738
  if (spPackage.products.length > 0) {
@@ -143814,16 +143840,16 @@ var model_default6 = CrmCpOrderProductModel;
143814
143840
  var productRoutes = new Elysia({
143815
143841
  prefix: "/product",
143816
143842
  tags: ["CrmCpOrderProduct"]
143817
- }).model(prefix_model_default("CrmSpPackageProductModel", model_default6)).use(better_auth_default).guard({
143843
+ }).model(prefix_model_default("CrmCpOrderProductModel", model_default6)).use(better_auth_default).guard({
143818
143844
  auth: true
143819
143845
  }).get("/", async ({ query }) => logic_default8.select(query), {
143820
- query: "CrmSpPackageProductModel.select"
143846
+ query: "CrmCpOrderProductModel.select"
143821
143847
  }).post("/", async ({ body, user: user2 }) => logic_default8.create(body, user2), {
143822
- body: "CrmSpPackageProductModel.create"
143848
+ body: "CrmCpOrderProductModel.create"
143823
143849
  }).guard({
143824
143850
  params: IdSchema
143825
143851
  }).put("/:id", async ({ params, body }) => logic_default8.update(params.id, body), {
143826
- body: "CrmSpPackageProductModel.update"
143852
+ body: "CrmCpOrderProductModel.update"
143827
143853
  }).delete("/:id", async ({ params }) => logic_default8.remove(params.id));
143828
143854
  var product_default = productRoutes;
143829
143855
 
@@ -143834,9 +143860,9 @@ var CrmCpOrderServiceModel;
143834
143860
  const updateSchema = createUpdateSchema(crmCpOrderServiceTable);
143835
143861
  CrmCpOrderServiceModel.create = t.Composite([
143836
143862
  t.Pick(OmitBaseSchema(createSchema), [
143863
+ "quantity",
143837
143864
  "cpOrderId",
143838
143865
  "companyServiceKindId",
143839
- "quantity",
143840
143866
  "cpOrderSpPackageId",
143841
143867
  "name"
143842
143868
  ]),
@@ -143860,16 +143886,16 @@ var model_default7 = CrmCpOrderServiceModel;
143860
143886
  var serviceRoutes = new Elysia({
143861
143887
  prefix: "/service",
143862
143888
  tags: ["CrmCpOrderService"]
143863
- }).model(prefix_model_default("CrmSpPackageServiceModel", model_default7)).use(better_auth_default).guard({
143889
+ }).model(prefix_model_default("CrmCpOrderServiceModel", model_default7)).use(better_auth_default).guard({
143864
143890
  auth: true
143865
143891
  }).get("/", async ({ query }) => logic_default9.select(query), {
143866
- query: "CrmSpPackageServiceModel.select"
143892
+ query: "CrmCpOrderServiceModel.select"
143867
143893
  }).post("/", async ({ body, user: user2 }) => logic_default9.create(body, user2), {
143868
- body: "CrmSpPackageServiceModel.create"
143894
+ body: "CrmCpOrderServiceModel.create"
143869
143895
  }).guard({
143870
143896
  params: IdSchema
143871
143897
  }).put("/:id", async ({ params, body }) => logic_default9.update(params.id, body), {
143872
- body: "CrmSpPackageServiceModel.update"
143898
+ body: "CrmCpOrderServiceModel.update"
143873
143899
  }).delete("/:id", async ({ params }) => logic_default9.remove(params.id));
143874
143900
  var service_default = serviceRoutes;
143875
143901
 
@@ -143877,7 +143903,7 @@ var service_default = serviceRoutes;
143877
143903
  var cpOrderRoutes = new Elysia({
143878
143904
  prefix: "/cp-order",
143879
143905
  tags: ["CrmCpOrder"]
143880
- }).use(better_auth_default).guard({ auth: true }).model(prefix_model_default("CrmCpOrderModel", model_default5)).get("/", async ({ query, user: user2 }) => logic_default10.select(query, user2), {
143906
+ }).use(better_auth_default).use(service_default).use(product_default).guard({ auth: true }).model(prefix_model_default("CrmCpOrderModel", model_default5)).get("/", async ({ query, user: user2 }) => logic_default10.select(query, user2), {
143881
143907
  query: "CrmCpOrderModel.select"
143882
143908
  }).post("/", async ({ body, user: user2 }) => logic_default10.create(body, user2), {
143883
143909
  body: "CrmCpOrderModel.create"
@@ -143885,7 +143911,7 @@ var cpOrderRoutes = new Elysia({
143885
143911
  body: "CrmCpOrderModel.addPackage"
143886
143912
  }).guard({
143887
143913
  params: IdSchema
143888
- }).post("/:id/complete", async ({ user: user2, params: { id } }) => logic_default10.complete(id, user2)).delete("/:id", async ({ user: user2, params: { id } }) => logic_default10.remove(id, user2)).use(service_default).use(product_default);
143914
+ }).post("/:id/complete", async ({ user: user2, params: { id } }) => logic_default10.complete(id, user2)).delete("/:id", async ({ user: user2, params: { id } }) => logic_default10.remove(id, user2));
143889
143915
  var cpOrder_default = cpOrderRoutes;
143890
143916
 
143891
143917
  // src/routes/crm/customer/model.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autosync_backend2",
3
- "version": "1.1.13",
3
+ "version": "1.1.14",
4
4
  "module": "src/index.ts",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",