autosync_backend2 1.2.19 → 1.2.20

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.
package/dist/index.d.ts CHANGED
@@ -5002,6 +5002,7 @@ export declare const app: Elysia<"", {
5002
5002
  headers: unknown;
5003
5003
  response: {
5004
5004
  200: {
5005
+ id: string;
5005
5006
  licensePlate: string | null;
5006
5007
  yearImported: number | null;
5007
5008
  yearManufactured: number | null;
@@ -7602,6 +7603,372 @@ export declare const app: Elysia<"", {
7602
7603
  };
7603
7604
  };
7604
7605
  };
7606
+ } & {
7607
+ inspection: {
7608
+ field: {};
7609
+ } & {
7610
+ field: {
7611
+ post: {
7612
+ body: {
7613
+ required?: boolean | undefined;
7614
+ code?: string | null | undefined;
7615
+ oldId?: number | null | undefined;
7616
+ isActive?: boolean | undefined;
7617
+ description?: string | null | undefined;
7618
+ version?: string | null | undefined;
7619
+ metadata?: import("drizzle-typebox").Json | undefined;
7620
+ fieldGroup?: string | null | undefined;
7621
+ sortIndex?: number | null | undefined;
7622
+ groupId: string;
7623
+ };
7624
+ params: {};
7625
+ query: unknown;
7626
+ headers: unknown;
7627
+ response: {
7628
+ 422: {
7629
+ type: "validation";
7630
+ on: string;
7631
+ summary?: string;
7632
+ message?: string;
7633
+ found?: unknown;
7634
+ property?: string;
7635
+ expected?: string;
7636
+ };
7637
+ };
7638
+ };
7639
+ };
7640
+ } & {
7641
+ field: {
7642
+ ":id": {
7643
+ put: {
7644
+ body: {
7645
+ required?: boolean | undefined;
7646
+ code?: string | null | undefined;
7647
+ oldId?: number | null | undefined;
7648
+ isActive?: boolean | undefined;
7649
+ description?: string | null | undefined;
7650
+ version?: string | null | undefined;
7651
+ metadata?: import("drizzle-typebox").Json | undefined;
7652
+ fieldGroup?: string | null | undefined;
7653
+ sortIndex?: number | null | undefined;
7654
+ groupId: string;
7655
+ };
7656
+ params: {
7657
+ id: string;
7658
+ };
7659
+ query: unknown;
7660
+ headers: unknown;
7661
+ response: {
7662
+ 422: {
7663
+ type: "validation";
7664
+ on: string;
7665
+ summary?: string;
7666
+ message?: string;
7667
+ found?: unknown;
7668
+ property?: string;
7669
+ expected?: string;
7670
+ };
7671
+ };
7672
+ };
7673
+ };
7674
+ };
7675
+ } & {
7676
+ field: {
7677
+ ":id": {
7678
+ delete: {
7679
+ body: unknown;
7680
+ params: {
7681
+ id: string;
7682
+ };
7683
+ query: unknown;
7684
+ headers: unknown;
7685
+ response: {
7686
+ 422: {
7687
+ type: "validation";
7688
+ on: string;
7689
+ summary?: string;
7690
+ message?: string;
7691
+ found?: unknown;
7692
+ property?: string;
7693
+ expected?: string;
7694
+ };
7695
+ };
7696
+ };
7697
+ };
7698
+ };
7699
+ };
7700
+ } & {
7701
+ inspection: {
7702
+ template: {};
7703
+ } & {
7704
+ template: {
7705
+ get: {
7706
+ body: unknown;
7707
+ params: {};
7708
+ query: {
7709
+ pagination: {
7710
+ size: number;
7711
+ page: number;
7712
+ };
7713
+ };
7714
+ headers: unknown;
7715
+ response: {
7716
+ 200: {
7717
+ totalCount: number;
7718
+ totalPage: number;
7719
+ result: Omit<{
7720
+ totalCount: number;
7721
+ companyId: string | null;
7722
+ name: string;
7723
+ description: string | null;
7724
+ version: string | null;
7725
+ isActive: boolean;
7726
+ id: string;
7727
+ createdAt: string;
7728
+ updatedAt: string;
7729
+ deletedAt: string | null;
7730
+ oldId: number | null;
7731
+ }, "totalCount">[];
7732
+ };
7733
+ 422: {
7734
+ type: "validation";
7735
+ on: string;
7736
+ summary?: string;
7737
+ message?: string;
7738
+ found?: unknown;
7739
+ property?: string;
7740
+ expected?: string;
7741
+ };
7742
+ };
7743
+ };
7744
+ };
7745
+ } & {
7746
+ template: {
7747
+ post: {
7748
+ body: {
7749
+ companyId?: string | null | undefined;
7750
+ oldId?: number | null | undefined;
7751
+ isActive?: boolean | undefined;
7752
+ description?: string | null | undefined;
7753
+ version?: string | null | undefined;
7754
+ name: string;
7755
+ };
7756
+ params: {};
7757
+ query: unknown;
7758
+ headers: unknown;
7759
+ response: {
7760
+ 422: {
7761
+ type: "validation";
7762
+ on: string;
7763
+ summary?: string;
7764
+ message?: string;
7765
+ found?: unknown;
7766
+ property?: string;
7767
+ expected?: string;
7768
+ };
7769
+ };
7770
+ };
7771
+ };
7772
+ } & {
7773
+ template: {
7774
+ ":id": {
7775
+ get: {
7776
+ body: unknown;
7777
+ params: {
7778
+ id: string;
7779
+ };
7780
+ query: unknown;
7781
+ headers: unknown;
7782
+ response: {
7783
+ 200: {
7784
+ companyId: string | null;
7785
+ name: string;
7786
+ description: string | null;
7787
+ version: string | null;
7788
+ isActive: boolean;
7789
+ id: string;
7790
+ createdAt: string;
7791
+ updatedAt: string;
7792
+ deletedAt: string | null;
7793
+ oldId: number | null;
7794
+ };
7795
+ 404: "Үзлэгийн загвар олдсонгүй.";
7796
+ 422: {
7797
+ type: "validation";
7798
+ on: string;
7799
+ summary?: string;
7800
+ message?: string;
7801
+ found?: unknown;
7802
+ property?: string;
7803
+ expected?: string;
7804
+ };
7805
+ };
7806
+ };
7807
+ };
7808
+ };
7809
+ } & {
7810
+ template: {
7811
+ ":id": {
7812
+ put: {
7813
+ body: {
7814
+ name?: string | undefined;
7815
+ companyId?: string | null | undefined;
7816
+ oldId?: number | null | undefined;
7817
+ isActive?: boolean | undefined;
7818
+ description?: string | null | undefined;
7819
+ version?: string | null | undefined;
7820
+ };
7821
+ params: {
7822
+ id: string;
7823
+ };
7824
+ query: unknown;
7825
+ headers: unknown;
7826
+ response: {
7827
+ 404: "Үзлэгийн загвар олдсонгүй.";
7828
+ 422: {
7829
+ type: "validation";
7830
+ on: string;
7831
+ summary?: string;
7832
+ message?: string;
7833
+ found?: unknown;
7834
+ property?: string;
7835
+ expected?: string;
7836
+ };
7837
+ };
7838
+ };
7839
+ };
7840
+ };
7841
+ } & {
7842
+ template: {
7843
+ ":id": {
7844
+ delete: {
7845
+ body: unknown;
7846
+ params: {
7847
+ id: string;
7848
+ };
7849
+ query: unknown;
7850
+ headers: unknown;
7851
+ response: {
7852
+ 422: {
7853
+ type: "validation";
7854
+ on: string;
7855
+ summary?: string;
7856
+ message?: string;
7857
+ found?: unknown;
7858
+ property?: string;
7859
+ expected?: string;
7860
+ };
7861
+ };
7862
+ };
7863
+ };
7864
+ };
7865
+ } & {
7866
+ template: {
7867
+ ":id": {
7868
+ field: {
7869
+ get: {
7870
+ body: unknown;
7871
+ params: {
7872
+ id: string;
7873
+ };
7874
+ query: unknown;
7875
+ headers: unknown;
7876
+ response: {
7877
+ 200: {
7878
+ templateId: string;
7879
+ fieldGroupId: string | null;
7880
+ fieldGroup: string | null;
7881
+ fieldId: string;
7882
+ code: string | null;
7883
+ description: string | null;
7884
+ fieldType: "BOOLEAN" | "NUMERIC" | "TEXT" | "DATE" | "RATE" | "MULTI_CHOICE";
7885
+ required: boolean;
7886
+ metadata: unknown;
7887
+ sortIndex: number | null;
7888
+ id: string;
7889
+ createdAt: string;
7890
+ updatedAt: string;
7891
+ deletedAt: string | null;
7892
+ oldId: number | null;
7893
+ }[];
7894
+ 422: {
7895
+ type: "validation";
7896
+ on: string;
7897
+ summary?: string;
7898
+ message?: string;
7899
+ found?: unknown;
7900
+ property?: string;
7901
+ expected?: string;
7902
+ };
7903
+ };
7904
+ };
7905
+ };
7906
+ };
7907
+ };
7908
+ } & {
7909
+ template: {
7910
+ ":id": {
7911
+ field: {
7912
+ post: {
7913
+ body: {
7914
+ required?: boolean | undefined;
7915
+ code?: string | null | undefined;
7916
+ oldId?: number | null | undefined;
7917
+ description?: string | null | undefined;
7918
+ metadata?: import("drizzle-typebox").Json | undefined;
7919
+ fieldGroup?: string | null | undefined;
7920
+ sortIndex?: number | null | undefined;
7921
+ fieldGroupId?: string | null | undefined;
7922
+ fieldId: string;
7923
+ fieldType: "BOOLEAN" | "NUMERIC" | "TEXT" | "DATE" | "RATE" | "MULTI_CHOICE";
7924
+ };
7925
+ params: {
7926
+ id: string;
7927
+ };
7928
+ query: unknown;
7929
+ headers: unknown;
7930
+ response: {
7931
+ 422: {
7932
+ type: "validation";
7933
+ on: string;
7934
+ summary?: string;
7935
+ message?: string;
7936
+ found?: unknown;
7937
+ property?: string;
7938
+ expected?: string;
7939
+ };
7940
+ };
7941
+ };
7942
+ };
7943
+ };
7944
+ };
7945
+ } & {
7946
+ template: {
7947
+ field: {
7948
+ ":id": {
7949
+ delete: {
7950
+ body: unknown;
7951
+ params: {
7952
+ id: string;
7953
+ };
7954
+ query: unknown;
7955
+ headers: unknown;
7956
+ response: {
7957
+ 422: {
7958
+ type: "validation";
7959
+ on: string;
7960
+ summary?: string;
7961
+ message?: string;
7962
+ found?: unknown;
7963
+ property?: string;
7964
+ expected?: string;
7965
+ };
7966
+ };
7967
+ };
7968
+ };
7969
+ };
7970
+ };
7971
+ };
7605
7972
  };
7606
7973
  };
7607
7974
  }, {
package/dist/index.js CHANGED
@@ -146707,6 +146707,10 @@ var updateConditions = {
146707
146707
  optional: () => true,
146708
146708
  nullable: (column) => !column.notNull
146709
146709
  };
146710
+ var createInsertSchema = (entity, refine4) => {
146711
+ const columns = getColumns(entity);
146712
+ return handleColumns(columns, refine4 ?? {}, insertConditions);
146713
+ };
146710
146714
  function createSchemaFactory(options) {
146711
146715
  const createSelectSchema = (entity, refine4) => {
146712
146716
  if (isPgEnum2(entity)) {
@@ -146715,7 +146719,7 @@ function createSchemaFactory(options) {
146715
146719
  const columns = getColumns(entity);
146716
146720
  return handleColumns(columns, refine4 ?? {}, selectConditions, options);
146717
146721
  };
146718
- const createInsertSchema = (entity, refine4) => {
146722
+ const createInsertSchema2 = (entity, refine4) => {
146719
146723
  const columns = getColumns(entity);
146720
146724
  return handleColumns(columns, refine4 ?? {}, insertConditions, options);
146721
146725
  };
@@ -146723,18 +146727,18 @@ function createSchemaFactory(options) {
146723
146727
  const columns = getColumns(entity);
146724
146728
  return handleColumns(columns, refine4 ?? {}, updateConditions, options);
146725
146729
  };
146726
- return { createSelectSchema, createInsertSchema, createUpdateSchema };
146730
+ return { createSelectSchema, createInsertSchema: createInsertSchema2, createUpdateSchema };
146727
146731
  }
146728
146732
 
146729
146733
  // src/lib/validation-factory.ts
146730
- var { createSelectSchema, createUpdateSchema, createInsertSchema } = createSchemaFactory({
146734
+ var { createSelectSchema, createUpdateSchema, createInsertSchema: createInsertSchema2 } = createSchemaFactory({
146731
146735
  typeboxInstance: t
146732
146736
  });
146733
146737
 
146734
146738
  // src/routes/company/account/model.ts
146735
146739
  var CompanyAccountModel;
146736
146740
  ((CompanyAccountModel) => {
146737
- const createSchema = createInsertSchema(companyAccountTable);
146741
+ const createSchema = createInsertSchema2(companyAccountTable);
146738
146742
  const updateSchema = createUpdateSchema(companyAccountTable);
146739
146743
  const selectSchema = createSelectSchema(companyAccountTable);
146740
146744
  CompanyAccountModel.create = OmitBaseSchema(createSchema);
@@ -146789,7 +146793,7 @@ var logic_default2 = CompanyBranchLogic;
146789
146793
  var phoneRegex = /^\d{8}$/;
146790
146794
  var CompanyBranchModel;
146791
146795
  ((CompanyBranchModel) => {
146792
- const createSchema = createInsertSchema(companyBranchTable, {
146796
+ const createSchema = createInsertSchema2(companyBranchTable, {
146793
146797
  phone: (schema4) => t.RegExp(phoneRegex, { ...schema4 }),
146794
146798
  email: (schema4) => t.String({ ...schema4, format: "email" }),
146795
146799
  merchantId: (schema4) => t.Optional(schema4)
@@ -146831,7 +146835,7 @@ var branch_default = branchRoutes;
146831
146835
  // src/routes/company/company/model.ts
146832
146836
  var CompanyCompanyModel;
146833
146837
  ((CompanyCompanyModel) => {
146834
- const createSchema = createInsertSchema(companyCompanyTable);
146838
+ const createSchema = createInsertSchema2(companyCompanyTable);
146835
146839
  const updateSchema = createUpdateSchema(companyCompanyTable);
146836
146840
  const selectSchema = createSelectSchema(companyCompanyTable, {
146837
146841
  phone: t.RegExp(/^\d{8}$/),
@@ -146880,7 +146884,7 @@ var company_default = companyRoutes;
146880
146884
  // src/routes/company/employee/model.ts
146881
146885
  var CompanyEmployeeModel;
146882
146886
  ((CompanyEmployeeModel) => {
146883
- const createSchema = createInsertSchema(companyEmployeeTable);
146887
+ const createSchema = createInsertSchema2(companyEmployeeTable);
146884
146888
  const updateSchema = createUpdateSchema(companyEmployeeTable);
146885
146889
  const selectSchema = createSelectSchema(companyEmployeeTable, {
146886
146890
  phone: t.RegExp(/^\d{8}$/),
@@ -146960,7 +146964,7 @@ var employee_default = companyRoutes2;
146960
146964
  // src/routes/company/package/model.ts
146961
146965
  var CompanyPackageModel;
146962
146966
  ((CompanyPackageModel) => {
146963
- const createSchema = createInsertSchema(companyPackageTable);
146967
+ const createSchema = createInsertSchema2(companyPackageTable);
146964
146968
  const updateSchema = createUpdateSchema(companyPackageTable);
146965
146969
  CompanyPackageModel.create = OmitBaseSchema(createSchema);
146966
146970
  CompanyPackageModel.update = OmitBaseSchema(updateSchema);
@@ -147041,7 +147045,7 @@ var logic_default4 = CompanyServiceKindLogic;
147041
147045
  // src/routes/company/serviceKind/model.ts
147042
147046
  var CompanyServiceKindModel;
147043
147047
  ((CompanyServiceKindModel) => {
147044
- const createSchema = createInsertSchema(companyServiceKindTable);
147048
+ const createSchema = createInsertSchema2(companyServiceKindTable);
147045
147049
  const updateSchema = createUpdateSchema(companyServiceKindTable);
147046
147050
  const selectSchema = createSelectSchema(companyServiceKindTable);
147047
147051
  CompanyServiceKindModel.create = t.Omit(OmitBaseSchema(createSchema), ["companyId"]);
@@ -150147,7 +150151,7 @@ var CrmVehicleLogic;
150147
150151
  return vehicle;
150148
150152
  };
150149
150153
  CrmVehicleLogic.update = async (id, body, user2) => {
150150
- const [result] = await db_default.update(crmVehicleTable).set(body).where(and(eq(crmVehicleTable.id, id), eq(crmVehicleTable.companyId, user2.companyId), softDeletedFilter(crmVehicleTable))).returning();
150154
+ const [result] = await db_default.update(crmVehicleTable).set(body).where(and(eq(crmVehicleTable.id, id), or(eq(crmVehicleTable.companyId, user2.companyId), isNull2(crmVehicleTable.companyId)), softDeletedFilter(crmVehicleTable))).returning();
150151
150155
  if (!result) {
150152
150156
  return status("Not Found", "\u0422\u044D\u044D\u0432\u0440\u0438\u0439\u043D \u0445\u044D\u0440\u044D\u0433\u0441\u044D\u043B \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.");
150153
150157
  }
@@ -151475,7 +151479,7 @@ var logic_default15 = CrmCpOrderItemEmployeeLogic;
151475
151479
  // src/routes/crm/cpOrder/item/employee/model.ts
151476
151480
  var CrmCpOrderItemEmployeeModel;
151477
151481
  ((CrmCpOrderItemEmployeeModel) => {
151478
- const createSchema = createInsertSchema(crmCpOrderItemEmployeeTable);
151482
+ const createSchema = createInsertSchema2(crmCpOrderItemEmployeeTable);
151479
151483
  const updateSchema = createUpdateSchema(crmCpOrderItemEmployeeTable);
151480
151484
  CrmCpOrderItemEmployeeModel.create = OmitBaseSchema(createSchema);
151481
151485
  CrmCpOrderItemEmployeeModel.update = t.Pick(OmitBaseSchema(updateSchema), ["amount"]);
@@ -151505,7 +151509,7 @@ var employee_default2 = employeeRoutes;
151505
151509
  // src/routes/crm/cpOrder/item/model.ts
151506
151510
  var CrmCpOrderItemModel;
151507
151511
  ((CrmCpOrderItemModel) => {
151508
- const createSchema = createInsertSchema(crmCpOrderItemTable);
151512
+ const createSchema = createInsertSchema2(crmCpOrderItemTable);
151509
151513
  const updateSchema = createUpdateSchema(crmCpOrderItemTable);
151510
151514
  CrmCpOrderItemModel.create = t.Composite([
151511
151515
  t.Pick(OmitBaseSchema(createSchema), [
@@ -151624,7 +151628,7 @@ var model_default9 = CrmCpOrderModel;
151624
151628
  // src/routes/crm/cpOrder/payment/model.ts
151625
151629
  var CrmCpOrderPaymentModel;
151626
151630
  ((CrmCpOrderPaymentModel) => {
151627
- const createSchema = createInsertSchema(crmCpOrderPaymentTable);
151631
+ const createSchema = createInsertSchema2(crmCpOrderPaymentTable);
151628
151632
  CrmCpOrderPaymentModel.create = t.Omit(OmitBaseSchema(createSchema), ["invoiceNumber"]);
151629
151633
  CrmCpOrderPaymentModel.storepay = t.Composite([
151630
151634
  t.Omit(CrmCpOrderPaymentModel.create, ["paymentMethod", "paymentChannel", "state"]),
@@ -151761,7 +151765,7 @@ var cpOrder_default = cpOrderRoutes;
151761
151765
  // src/routes/crm/customer/model.ts
151762
151766
  var CrmCustomerModel;
151763
151767
  ((CrmCustomerModel) => {
151764
- const createSchema = createInsertSchema(crmCustomerTable);
151768
+ const createSchema = createInsertSchema2(crmCustomerTable);
151765
151769
  CrmCustomerModel.create = OmitBaseSchema(createSchema);
151766
151770
  const updateSchema = createUpdateSchema(crmCustomerTable);
151767
151771
  CrmCustomerModel.update = OmitBaseSchema(updateSchema);
@@ -151871,7 +151875,7 @@ var dashboard_default = dashboardRoutes;
151871
151875
  // src/routes/crm/discount/model.ts
151872
151876
  var DiscountModel;
151873
151877
  ((DiscountModel) => {
151874
- const createSchema = createInsertSchema(crmDiscountTable);
151878
+ const createSchema = createInsertSchema2(crmDiscountTable);
151875
151879
  const updateSchema = createUpdateSchema(crmDiscountTable);
151876
151880
  DiscountModel.create = OmitBaseSchema(createSchema);
151877
151881
  DiscountModel.update = OmitBaseSchema(updateSchema);
@@ -151932,7 +151936,7 @@ var DiscountModel;
151932
151936
  ], {
151933
151937
  description: "Condition value based on the condition type selected"
151934
151938
  });
151935
- const createConditionSchema = createInsertSchema(crmDiscountConditionTable);
151939
+ const createConditionSchema = createInsertSchema2(crmDiscountConditionTable);
151936
151940
  const updateConditionSchema = createUpdateSchema(crmDiscountConditionTable);
151937
151941
  DiscountModel.createCondition = t.Composite([
151938
151942
  OmitBaseSchema(createConditionSchema),
@@ -151946,7 +151950,7 @@ var DiscountModel;
151946
151950
  conditionValue: ConditionValueUnion
151947
151951
  }))
151948
151952
  ]);
151949
- const createApplySchema = createInsertSchema(crmDiscountApplyTable);
151953
+ const createApplySchema = createInsertSchema2(crmDiscountApplyTable);
151950
151954
  DiscountModel.createApply = t.Omit(OmitBaseSchema(createApplySchema), [
151951
151955
  "authUserId",
151952
151956
  "employeeId"
@@ -152725,7 +152729,7 @@ var reports_default = reportsRoutes;
152725
152729
  // src/routes/crm/spPackage/model.ts
152726
152730
  var CrmSpPackageModel;
152727
152731
  ((CrmSpPackageModel) => {
152728
- const createSchema = createInsertSchema(crmSpPackageTable);
152732
+ const createSchema = createInsertSchema2(crmSpPackageTable);
152729
152733
  const updateSchema = createUpdateSchema(crmSpPackageTable);
152730
152734
  const selectSchema = createSelectSchema(crmSpPackageTable);
152731
152735
  CrmSpPackageModel.create = t.Omit(OmitBaseSchema(createSchema), ["companyId"]);
@@ -152786,7 +152790,7 @@ var logic_default19 = CrmSpPackageProductLogic;
152786
152790
  // src/routes/crm/spPackage/product/model.ts
152787
152791
  var CrmSpPackageProductModel;
152788
152792
  ((CrmSpPackageProductModel) => {
152789
- const createSchema = createInsertSchema(crmSpPackageProductTable);
152793
+ const createSchema = createInsertSchema2(crmSpPackageProductTable);
152790
152794
  const updateSchema = createUpdateSchema(crmSpPackageProductTable);
152791
152795
  const selectSchema = createSelectSchema(crmSpPackageProductTable);
152792
152796
  CrmSpPackageProductModel.create = t.Omit(OmitBaseSchema(createSchema), ["priceTotal"]);
@@ -152859,7 +152863,7 @@ var logic_default20 = CrmSpPackageServiceLogic;
152859
152863
  // src/routes/crm/spPackage/service/model.ts
152860
152864
  var CrmSpPackageServiceModel;
152861
152865
  ((CrmSpPackageServiceModel) => {
152862
- const createSchema = createInsertSchema(crmSpPackageServiceTable);
152866
+ const createSchema = createInsertSchema2(crmSpPackageServiceTable);
152863
152867
  const updateSchema = createUpdateSchema(crmSpPackageServiceTable);
152864
152868
  const selectSchema = createSelectSchema(crmSpPackageServiceTable);
152865
152869
  CrmSpPackageServiceModel.create = OmitBaseSchema(createSchema);
@@ -152943,6 +152947,7 @@ var vehicleRoutes = new Elysia({
152943
152947
  })
152944
152948
  }).post("/get", async ({ body }) => {
152945
152949
  const res = await db_default.select({
152950
+ id: crmVehicleTable.id,
152946
152951
  licensePlate: crmVehicleTable.licensePlate,
152947
152952
  yearImported: crmVehicleTable.yearImport,
152948
152953
  yearManufactured: crmVehicleTable.yearManufacture,
@@ -153247,7 +153252,7 @@ var logic_default21 = PermissionLogic;
153247
153252
  // src/routes/permission/model.ts
153248
153253
  var PermissionModel;
153249
153254
  ((PermissionModel) => {
153250
- const createSchema = createInsertSchema(permissionGroupTable);
153255
+ const createSchema = createInsertSchema2(permissionGroupTable);
153251
153256
  const updateSchema = createUpdateSchema(permissionGroupTable);
153252
153257
  PermissionModel.create = OmitBaseSchema(createSchema);
153253
153258
  PermissionModel.update = OmitBaseSchema(updateSchema);
@@ -153351,7 +153356,7 @@ var TechdocSupplierModel;
153351
153356
  byCompany: t.Boolean()
153352
153357
  }))
153353
153358
  ]);
153354
- const createSchema = createInsertSchema(techdocSupplierTable);
153359
+ const createSchema = createInsertSchema2(techdocSupplierTable);
153355
153360
  TechdocSupplierModel.create = OmitBaseSchema(createSchema);
153356
153361
  const updateSchema = createUpdateSchema(techdocSupplierTable);
153357
153362
  TechdocSupplierModel.update = OmitBaseSchema(updateSchema);
@@ -153598,7 +153603,7 @@ var logic_default23 = UserLogic;
153598
153603
 
153599
153604
  // src/routes/user/schema.ts
153600
153605
  var select = createSelectSchema(user);
153601
- var create2 = createInsertSchema(user);
153606
+ var create2 = createInsertSchema2(user);
153602
153607
  var update = createUpdateSchema(user);
153603
153608
  var selectUserSchema = t.Composite([
153604
153609
  PaginationSchema,
@@ -153673,7 +153678,7 @@ var user_default2 = userRoutes;
153673
153678
  // src/routes/warehouse/product/model.ts
153674
153679
  var WarehouseProductModel;
153675
153680
  ((WarehouseProductModel) => {
153676
- const createSchema = createInsertSchema(warehouseProductTable);
153681
+ const createSchema = createInsertSchema2(warehouseProductTable);
153677
153682
  const updateSchema = createUpdateSchema(warehouseProductTable);
153678
153683
  WarehouseProductModel.create = t.Omit(OmitBaseSchema(createSchema), ["companyId"]);
153679
153684
  WarehouseProductModel.update = OmitBaseSchema(updateSchema);
@@ -153697,7 +153702,7 @@ var model_default22 = WarehouseProductModel;
153697
153702
  // src/routes/warehouse/item/model.ts
153698
153703
  var WarehouseItemModel;
153699
153704
  ((WarehouseItemModel) => {
153700
- const createSchema = createInsertSchema(warehouseItemTable);
153705
+ const createSchema = createInsertSchema2(warehouseItemTable);
153701
153706
  const updateSchema = createUpdateSchema(warehouseItemTable);
153702
153707
  WarehouseItemModel.create = OmitBaseSchema(createSchema);
153703
153708
  WarehouseItemModel.update = t.Composite([
@@ -153741,7 +153746,7 @@ var WarehouseItemModel;
153741
153746
  maxQuantity: t.Number({ minimum: 0 })
153742
153747
  }))
153743
153748
  ]);
153744
- const createTransactionSchema = createInsertSchema(warehouseItemTransactionTable);
153749
+ const createTransactionSchema = createInsertSchema2(warehouseItemTransactionTable);
153745
153750
  const transactionDetails = t.Pick(createTransactionSchema, [
153746
153751
  "transactionType",
153747
153752
  "transactionKind",
@@ -153844,7 +153849,7 @@ var logic_default24 = WarehouseWarehouseLogic;
153844
153849
  // src/routes/warehouse/warehouse/model.ts
153845
153850
  var WarehouseWarehouseModel;
153846
153851
  ((WarehouseWarehouseModel) => {
153847
- const createSchema = createInsertSchema(warehouseWarehouseTable);
153852
+ const createSchema = createInsertSchema2(warehouseWarehouseTable);
153848
153853
  const updateSchema = createUpdateSchema(warehouseWarehouseTable);
153849
153854
  WarehouseWarehouseModel.create = t.Omit(OmitBaseSchema(createSchema), ["companyId"]);
153850
153855
  WarehouseWarehouseModel.update = t.Omit(OmitBaseSchema(updateSchema), [
@@ -153902,6 +153907,31 @@ var InspectionFieldLogic;
153902
153907
  })(InspectionFieldLogic ||= {});
153903
153908
  var logic_default25 = InspectionFieldLogic;
153904
153909
 
153910
+ // src/routes/fleet/inspection/field/model.ts
153911
+ var InspectionFieldModel;
153912
+ ((InspectionFieldModel) => {
153913
+ const createSchema = createInsertSchema(inspectionFieldTable);
153914
+ const updateSchema = createInsertSchema(inspectionFieldTable);
153915
+ InspectionFieldModel.create = OmitBaseSchema(createSchema);
153916
+ InspectionFieldModel.update = OmitBaseSchema(updateSchema);
153917
+ })(InspectionFieldModel ||= {});
153918
+ var model_default25 = InspectionFieldModel;
153919
+
153920
+ // src/routes/fleet/inspection/field/index.ts
153921
+ var fieldRoutes = new Elysia({
153922
+ prefix: "/field",
153923
+ tags: ["InspectionField"]
153924
+ }).use(better_auth_default).guard({
153925
+ userKind: "ADMIN"
153926
+ }).post("/", async ({ body }) => logic_default25.create(body), {
153927
+ body: model_default25.create
153928
+ }).guard({
153929
+ params: IdSchema
153930
+ }).put("/:id", async ({ body, params: { id } }) => logic_default25.update(id, body), {
153931
+ body: model_default25.update
153932
+ }).delete("/:id", async ({ params: { id } }) => logic_default25.remove(id));
153933
+ var field_default = fieldRoutes;
153934
+
153905
153935
  // src/routes/fleet/inspection/fieldGroup/logic.ts
153906
153936
  var InspectionFieldGroupLogic;
153907
153937
  ((InspectionFieldGroupLogic) => {
@@ -153939,7 +153969,7 @@ var logic_default26 = InspectionFieldGroupLogic;
153939
153969
  // src/routes/fleet/inspection/fieldGroup/model.ts
153940
153970
  var InspectionFieldGroupModel;
153941
153971
  ((InspectionFieldGroupModel) => {
153942
- const createSchema = createInsertSchema(inspectionFieldGroupTable);
153972
+ const createSchema = createInsertSchema2(inspectionFieldGroupTable);
153943
153973
  const updateSchema = createUpdateSchema(inspectionFieldGroupTable);
153944
153974
  InspectionFieldGroupModel.create = OmitBaseSchema(createSchema);
153945
153975
  InspectionFieldGroupModel.update = OmitBaseSchema(updateSchema);
@@ -153951,30 +153981,123 @@ var InspectionFieldGroupModel;
153951
153981
  PaginationSchema
153952
153982
  ]);
153953
153983
  })(InspectionFieldGroupModel ||= {});
153954
- var model_default25 = InspectionFieldGroupModel;
153984
+ var model_default26 = InspectionFieldGroupModel;
153955
153985
 
153956
153986
  // src/routes/fleet/inspection/fieldGroup/index.ts
153957
153987
  var fieldGroupRoutes = new Elysia({
153958
- prefix: "/field-group"
153988
+ prefix: "/field-group",
153989
+ tags: ["InspectionFieldGroup"]
153959
153990
  }).use(better_auth_default).guard({
153960
153991
  userKind: "ADMIN"
153961
153992
  }).get("/", async ({ query }) => logic_default26.select(query), {
153962
- query: model_default25.select,
153993
+ query: model_default26.select,
153963
153994
  userKind: undefined,
153964
153995
  auth: true
153965
153996
  }).post("/", async ({ body }) => logic_default26.create(body), {
153966
- body: model_default25.create
153997
+ body: model_default26.create
153967
153998
  }).guard({
153968
153999
  params: IdSchema
153969
154000
  }).put("/:id", async ({ body, params: { id } }) => logic_default26.update(id, body), {
153970
- body: model_default25.update
154001
+ body: model_default26.update
153971
154002
  }).delete("/:id", async ({ params: { id } }) => logic_default26.remove(id)).get("/:id/field", async ({ params: { id } }) => logic_default25.select(id));
153972
154003
  var fieldGroup_default = fieldGroupRoutes;
153973
154004
 
154005
+ // src/routes/fleet/inspection/template/logic.ts
154006
+ var InspectionTemplateLogic;
154007
+ ((InspectionTemplateLogic) => {
154008
+ InspectionTemplateLogic.select = async (query, user2) => {
154009
+ const filter = or(eq(inspectionTemplateTable.companyId, user2.companyId).if(user2.kind !== "ADMIN"), isNull2(inspectionTemplateTable.companyId));
154010
+ const columns = getTableColumns(inspectionTemplateTable);
154011
+ const baseQuery = db_default.select({
154012
+ ...columns,
154013
+ totalCount: totalCountSql
154014
+ }).from(inspectionTemplateTable).where(filter).orderBy(desc(inspectionTemplateTable.createdAt)).$dynamic();
154015
+ const result = await pagination_helper_default(baseQuery, query.pagination);
154016
+ return getPaginationContent(result, query.pagination.size);
154017
+ };
154018
+ InspectionTemplateLogic.selectById = async (id, user2) => {
154019
+ const filter = and(eq(inspectionTemplateTable.id, id), softDeletedFilter(inspectionTemplateTable), or(eq(inspectionTemplateTable.companyId, user2.companyId).if(user2.kind !== "ADMIN"), isNull2(inspectionTemplateTable.companyId)));
154020
+ const [result] = await db_default.select().from(inspectionTemplateTable).where(filter).limit(1);
154021
+ if (!result) {
154022
+ return status("Not Found", "\u04AE\u0437\u043B\u044D\u0433\u0438\u0439\u043D \u0437\u0430\u0433\u0432\u0430\u0440 \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.");
154023
+ }
154024
+ return result;
154025
+ };
154026
+ InspectionTemplateLogic.create = async (body, user2) => {
154027
+ await db_default.insert(inspectionTemplateTable).values({
154028
+ ...body,
154029
+ companyId: user2.kind !== "ADMIN" ? user2.companyId : body.companyId
154030
+ });
154031
+ };
154032
+ InspectionTemplateLogic.update = async (id, body, user2) => {
154033
+ const [res] = await db_default.update(inspectionTemplateTable).set(body).where(and(eq(inspectionTemplateTable.id, id), eq(inspectionTemplateTable.companyId, user2.companyId).if(user2.kind !== "ADMIN"))).returning({
154034
+ id: inspectionTemplateTable.id
154035
+ });
154036
+ if (!res) {
154037
+ return status("Not Found", "\u04AE\u0437\u043B\u044D\u0433\u0438\u0439\u043D \u0437\u0430\u0433\u0432\u0430\u0440 \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.");
154038
+ }
154039
+ };
154040
+ InspectionTemplateLogic.remove = async (id, user2) => {
154041
+ await db_default.update(inspectionTemplateTable).set({
154042
+ deletedAt: sql3`now()`
154043
+ }).where(and(eq(inspectionTemplateTable.id, id), eq(inspectionTemplateTable.companyId, user2.companyId).if(user2.kind !== "ADMIN")));
154044
+ };
154045
+ InspectionTemplateLogic.selectField = async (templateId) => {
154046
+ const result = await db_default.select().from(inspectionTemplateFieldTable).where(and(eq(inspectionTemplateFieldTable.templateId, templateId), softDeletedFilter(inspectionTemplateFieldTable)));
154047
+ return result;
154048
+ };
154049
+ InspectionTemplateLogic.addField = async (templateId, body) => {
154050
+ await db_default.insert(inspectionTemplateFieldTable).values({
154051
+ ...body,
154052
+ templateId
154053
+ });
154054
+ };
154055
+ InspectionTemplateLogic.removeField = async (id) => {
154056
+ await db_default.update(inspectionTemplateFieldTable).set({
154057
+ deletedAt: sql3`now()`
154058
+ }).where(eq(inspectionTemplateFieldTable.id, id));
154059
+ };
154060
+ })(InspectionTemplateLogic ||= {});
154061
+ var logic_default27 = InspectionTemplateLogic;
154062
+
154063
+ // src/routes/fleet/inspection/template/model.ts
154064
+ var InspectionTemplateModel;
154065
+ ((InspectionTemplateModel) => {
154066
+ const createSchema = createInsertSchema(inspectionTemplateTable);
154067
+ const updateSchema = createUpdateSchema(inspectionTemplateTable);
154068
+ const createFieldSchema = createInsertSchema(inspectionTemplateFieldTable);
154069
+ InspectionTemplateModel.create = OmitBaseSchema(createSchema);
154070
+ InspectionTemplateModel.update = OmitBaseSchema(updateSchema);
154071
+ InspectionTemplateModel.select = t.Composite([PaginationSchema]);
154072
+ InspectionTemplateModel.createField = t.Omit(OmitBaseSchema(createFieldSchema), [
154073
+ "templateId"
154074
+ ]);
154075
+ })(InspectionTemplateModel ||= {});
154076
+ var model_default27 = InspectionTemplateModel;
154077
+
154078
+ // src/routes/fleet/inspection/template/index.ts
154079
+ var templateRoutes = new Elysia({
154080
+ prefix: "/template",
154081
+ tags: ["InspectionTemplate"]
154082
+ }).use(better_auth_default).guard({
154083
+ userKind: "COMPANY_ADMIN"
154084
+ }).get("/", async ({ query, user: user2 }) => logic_default27.select(query, user2), {
154085
+ query: model_default27.select
154086
+ }).post("/", async ({ body, user: user2 }) => logic_default27.create(body, user2), {
154087
+ body: model_default27.create
154088
+ }).guard({
154089
+ params: IdSchema
154090
+ }).get("/:id", async ({ params: { id }, user: user2 }) => logic_default27.selectById(id, user2)).put("/:id", async ({ body, params: { id }, user: user2 }) => logic_default27.update(id, body, user2), {
154091
+ body: model_default27.update
154092
+ }).delete("/:id", async ({ params: { id }, user: user2 }) => logic_default27.remove(id, user2)).get("/:id/field", async ({ params: { id } }) => logic_default27.selectField(id)).post("/:id/field", async ({ body, params: { id } }) => logic_default27.addField(id, body), {
154093
+ body: model_default27.createField
154094
+ }).delete("/field/:id", async ({ params: { id } }) => logic_default27.removeField(id));
154095
+ var template_default = templateRoutes;
154096
+
153974
154097
  // src/routes/fleet/inspection/index.ts
153975
154098
  var inspectionRoutes2 = new Elysia({
153976
154099
  prefix: "/inspection"
153977
- }).use(fieldGroup_default);
154100
+ }).use(fieldGroup_default).use(field_default).use(template_default);
153978
154101
  var inspection_default2 = inspectionRoutes2;
153979
154102
 
153980
154103
  // src/routes/fleet/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autosync_backend2",
3
- "version": "1.2.19",
3
+ "version": "1.2.20",
4
4
  "module": "src/index.ts",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",