autosync_backend2 1.2.39 → 1.2.41

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.js CHANGED
@@ -112685,7 +112685,11 @@ var EnvSchema = t.Object({
112685
112685
  SMTP_PASSWORD: t.String(),
112686
112686
  ATUT_TOKEN: t.String(),
112687
112687
  AWS_ACCESS_KEY: t.String(),
112688
- AWS_SECRET_KEY: t.String()
112688
+ AWS_SECRET_KEY: t.String(),
112689
+ MBANK_CLIENT_ID: t.String(),
112690
+ MBANK_CLIENT_SECRET: t.String(),
112691
+ MBANK_USERNAME: t.String(),
112692
+ MBANK_PASSWORD: t.String()
112689
112693
  });
112690
112694
  var env3;
112691
112695
  try {
@@ -142463,6 +142467,10 @@ __export(exports_schema, {
142463
142467
  techdocSupplierTable: () => techdocSupplierTable,
142464
142468
  techdocSchema: () => techdocSchema,
142465
142469
  techdocProductTable: () => techdocProductTable,
142470
+ techdocProductKindTable: () => techdocProductKindTable,
142471
+ techdocProductKindRelateTypeEnum: () => techdocProductKindRelateTypeEnum,
142472
+ techdocProductKindRelateTable: () => techdocProductKindRelateTable,
142473
+ techdocProductCategoryTable: () => techdocProductCategoryTable,
142466
142474
  session: () => session,
142467
142475
  pmTemplateTable: () => pmTemplateTable,
142468
142476
  pmTemplateProductTable: () => pmTemplateProductTable,
@@ -143223,6 +143231,34 @@ var techdocProductTable = techdocSchema.table("product", {
143223
143231
  ...base_schema_helper_default,
143224
143232
  name: varchar().notNull()
143225
143233
  });
143234
+ var techdocProductCategoryTable = techdocSchema.table("product_category", {
143235
+ ...base_schema_helper_default,
143236
+ name: varchar().notNull(),
143237
+ description: text()
143238
+ });
143239
+ var techdocProductKindTable = techdocSchema.table("product_kind", {
143240
+ ...base_schema_helper_default,
143241
+ productCategoryId: uuid5().notNull(),
143242
+ name: varchar().notNull(),
143243
+ description: text()
143244
+ });
143245
+ var techdocProductKindRelateTypeEnum = techdocSchema.enum("product_kind_relate_type", [
143246
+ "INCLUDE",
143247
+ "EXCLUDE",
143248
+ "ALTERNATIVE",
143249
+ "EQUIVALENT",
143250
+ "ACCESSORY",
143251
+ "COMPONENT",
143252
+ "DEPENDENCY",
143253
+ "UPGRADE",
143254
+ "DERIVED"
143255
+ ]);
143256
+ var techdocProductKindRelateTable = techdocSchema.table("product_kind_relate", {
143257
+ ...base_schema_helper_default,
143258
+ productKindOneId: uuid5().notNull(),
143259
+ productKindTwoId: uuid5().notNull(),
143260
+ relateType: techdocProductKindRelateTypeEnum().notNull()
143261
+ });
143226
143262
  // src/lib/db/schema/warehouse.schema.ts
143227
143263
  var warehouseSchema = pgSchema("warehouse");
143228
143264
  var warehouseProductTypeEnum = warehouseSchema.enum("product_type", [
@@ -153585,6 +153621,202 @@ var productRoutes2 = new Elysia({
153585
153621
  }).use(better_auth_default);
153586
153622
  var product_default2 = productRoutes2;
153587
153623
 
153624
+ // src/routes/techdoc/productCategory/logic.ts
153625
+ var TechdocProductCategoryLogic;
153626
+ ((TechdocProductCategoryLogic) => {
153627
+ TechdocProductCategoryLogic.select = async (query) => {
153628
+ const filter = and(softDeletedFilter(techdocProductCategoryTable), eq(techdocProductCategoryTable.id, query.id ?? "").if(query.id), ilike(techdocProductCategoryTable.name, `%${query.name}%`).if(query.name));
153629
+ const columns = getTableColumns(techdocProductCategoryTable);
153630
+ const baseQuery = db_default.select({
153631
+ ...columns,
153632
+ totalCount: totalCountSql
153633
+ }).from(techdocProductCategoryTable).where(filter).$dynamic();
153634
+ const result = await pagination_helper_default(baseQuery, query.pagination);
153635
+ return getPaginationContent(result, query.pagination.size);
153636
+ };
153637
+ TechdocProductCategoryLogic.create = async (body) => {
153638
+ const [created] = await db_default.insert(techdocProductCategoryTable).values(body).returning();
153639
+ return created;
153640
+ };
153641
+ TechdocProductCategoryLogic.update = async (id, body) => {
153642
+ const [updated] = await db_default.update(techdocProductCategoryTable).set(body).where(eq(techdocProductCategoryTable.id, id)).returning();
153643
+ if (!updated) {
153644
+ return status("Not Found", "\u0411\u04AF\u0442\u044D\u044D\u0433\u0434\u044D\u0445\u04AF\u04AF\u043D\u0438\u0439 \u0430\u043D\u0433\u0438\u043B\u0430\u043B \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.");
153645
+ }
153646
+ return updated;
153647
+ };
153648
+ TechdocProductCategoryLogic.remove = async (id) => {
153649
+ await db_default.update(techdocProductCategoryTable).set({
153650
+ deletedAt: nowSql_helper_default
153651
+ }).where(eq(techdocProductCategoryTable.id, id));
153652
+ };
153653
+ })(TechdocProductCategoryLogic ||= {});
153654
+ var logic_default22 = TechdocProductCategoryLogic;
153655
+
153656
+ // src/routes/techdoc/productCategory/model.ts
153657
+ var TechdocProductCategoryModel;
153658
+ ((TechdocProductCategoryModel) => {
153659
+ const createSchema = createInsertSchema2(techdocProductCategoryTable);
153660
+ const updateSchema = createUpdateSchema(techdocProductCategoryTable);
153661
+ TechdocProductCategoryModel.create = OmitBaseSchema(createSchema);
153662
+ TechdocProductCategoryModel.update = OmitBaseSchema(updateSchema);
153663
+ TechdocProductCategoryModel.select = t.Composite([
153664
+ PaginationSchema,
153665
+ t.Partial(t.Object({
153666
+ id: t.String({ format: "uuid" }),
153667
+ name: t.String()
153668
+ }))
153669
+ ]);
153670
+ })(TechdocProductCategoryModel ||= {});
153671
+ var model_default20 = TechdocProductCategoryModel;
153672
+
153673
+ // src/routes/techdoc/productCategory/index.ts
153674
+ var productCategoryRoutes = new Elysia({
153675
+ prefix: "/product-category",
153676
+ tags: ["TechdocProductCategory"]
153677
+ }).use(better_auth_default).guard({ auth: true }).get("/", async ({ query }) => logic_default22.select(query), {
153678
+ query: model_default20.select
153679
+ }).guard({ userKind: "ADMIN" }).post("/", async ({ body }) => logic_default22.create(body), {
153680
+ body: model_default20.create
153681
+ }).guard({ params: IdSchema }).put("/:id", async ({ body, params: { id } }) => logic_default22.update(id, body), {
153682
+ body: model_default20.update
153683
+ }).delete("/:id", async ({ params: { id } }) => logic_default22.remove(id));
153684
+ var productCategory_default = productCategoryRoutes;
153685
+
153686
+ // src/routes/techdoc/productKind/logic.ts
153687
+ var TechdocProductKindLogic;
153688
+ ((TechdocProductKindLogic) => {
153689
+ TechdocProductKindLogic.select = async (query) => {
153690
+ const filter = and(softDeletedFilter(techdocProductKindTable), eq(techdocProductKindTable.productCategoryId, query.productCategoryId ?? "").if(query.productCategoryId), eq(techdocProductKindTable.id, query.id ?? "").if(query.id), ilike(techdocProductKindTable.name, `%${query.name}%`).if(query.name));
153691
+ const columns = getTableColumns(techdocProductKindTable);
153692
+ const category = alias(techdocProductCategoryTable, "category");
153693
+ const baseQuery = db_default.select({
153694
+ ...columns,
153695
+ category,
153696
+ totalCount: totalCountSql
153697
+ }).from(techdocProductKindTable).leftJoin(category, eq(category.id, techdocProductKindTable.productCategoryId)).where(filter).$dynamic();
153698
+ const result = await pagination_helper_default(baseQuery, query.pagination);
153699
+ return getPaginationContent(result, query.pagination.size);
153700
+ };
153701
+ TechdocProductKindLogic.create = async (body) => {
153702
+ const [created] = await db_default.insert(techdocProductKindTable).values(body).returning();
153703
+ return created;
153704
+ };
153705
+ TechdocProductKindLogic.update = async (id, body) => {
153706
+ const [updated] = await db_default.update(techdocProductKindTable).set(body).where(eq(techdocProductKindTable.id, id)).returning();
153707
+ if (!updated) {
153708
+ return status("Not Found", "\u0411\u04AF\u0442\u044D\u044D\u0433\u0434\u044D\u0445\u04AF\u04AF\u043D\u0438\u0439 \u0442\u04E9\u0440\u04E9\u043B \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.");
153709
+ }
153710
+ return updated;
153711
+ };
153712
+ TechdocProductKindLogic.remove = async (id) => {
153713
+ await db_default.update(techdocProductKindTable).set({
153714
+ deletedAt: nowSql_helper_default
153715
+ }).where(eq(techdocProductKindTable.id, id));
153716
+ };
153717
+ })(TechdocProductKindLogic ||= {});
153718
+ var logic_default23 = TechdocProductKindLogic;
153719
+
153720
+ // src/routes/techdoc/productKind/model.ts
153721
+ var TechdocProductKindModel;
153722
+ ((TechdocProductKindModel) => {
153723
+ const createSchema = createInsertSchema2(techdocProductKindTable);
153724
+ const updateSchema = createUpdateSchema(techdocProductKindTable);
153725
+ TechdocProductKindModel.create = OmitBaseSchema(createSchema);
153726
+ TechdocProductKindModel.update = OmitBaseSchema(updateSchema);
153727
+ TechdocProductKindModel.select = t.Composite([
153728
+ PaginationSchema,
153729
+ t.Partial(t.Object({
153730
+ id: t.String({ format: "uuid" }),
153731
+ productCategoryId: t.String({ format: "uuid" }),
153732
+ name: t.String()
153733
+ }))
153734
+ ]);
153735
+ })(TechdocProductKindModel ||= {});
153736
+ var model_default21 = TechdocProductKindModel;
153737
+
153738
+ // src/routes/techdoc/productKind/index.ts
153739
+ var productKindRoutes = new Elysia({
153740
+ prefix: "/product-kind",
153741
+ tags: ["TechdocProductKind"]
153742
+ }).use(better_auth_default).guard({ auth: true }).get("/", async ({ query }) => logic_default23.select(query), {
153743
+ query: model_default21.select
153744
+ }).guard({ userKind: "ADMIN" }).post("/", async ({ body }) => logic_default23.create(body), {
153745
+ body: model_default21.create
153746
+ }).guard({ params: IdSchema }).put("/:id", async ({ body, params: { id } }) => logic_default23.update(id, body), {
153747
+ body: model_default21.update
153748
+ }).delete("/:id", async ({ params: { id } }) => logic_default23.remove(id));
153749
+ var productKind_default = productKindRoutes;
153750
+
153751
+ // src/routes/techdoc/productKindRelate/logic.ts
153752
+ var TechdocProductKindRelateLogic;
153753
+ ((TechdocProductKindRelateLogic) => {
153754
+ TechdocProductKindRelateLogic.select = async (query) => {
153755
+ const filter = and(softDeletedFilter(techdocProductKindRelateTable), eq(techdocProductKindRelateTable.productKindOneId, query.productKindOneId ?? "").if(query.productKindOneId), eq(techdocProductKindRelateTable.productKindTwoId, query.productKindTwoId ?? "").if(query.productKindTwoId), eq(techdocProductKindRelateTable.relateType, query.relateType).if(query.relateType));
153756
+ const columns = getTableColumns(techdocProductKindRelateTable);
153757
+ const pk1 = alias(techdocProductKindTable, "productKindOne");
153758
+ const pk2 = alias(techdocProductKindTable, "productKindTwo");
153759
+ const baseQuery = db_default.select({
153760
+ ...columns,
153761
+ productKindOne: pk1,
153762
+ productKindTwo: pk2,
153763
+ totalCount: totalCountSql
153764
+ }).from(techdocProductKindRelateTable).leftJoin(pk1, eq(pk1.id, techdocProductKindRelateTable.productKindOneId)).leftJoin(pk2, eq(pk2.id, techdocProductKindRelateTable.productKindTwoId)).where(filter).$dynamic();
153765
+ const result = await pagination_helper_default(baseQuery, query.pagination);
153766
+ return getPaginationContent(result, query.pagination.size);
153767
+ };
153768
+ TechdocProductKindRelateLogic.create = async (body) => {
153769
+ const [created] = await db_default.insert(techdocProductKindRelateTable).values(body).returning();
153770
+ return created;
153771
+ };
153772
+ TechdocProductKindRelateLogic.update = async (id, body) => {
153773
+ const [updated] = await db_default.update(techdocProductKindRelateTable).set(body).where(eq(techdocProductKindRelateTable.id, id)).returning();
153774
+ if (!updated) {
153775
+ return status("Not Found", "\u0411\u04AF\u0442\u044D\u044D\u0433\u0434\u044D\u0445\u04AF\u04AF\u043D\u0438\u0439 \u0445\u043E\u043B\u0431\u043E\u043E\u0441 \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.");
153776
+ }
153777
+ return updated;
153778
+ };
153779
+ TechdocProductKindRelateLogic.remove = async (id) => {
153780
+ await db_default.update(techdocProductKindRelateTable).set({
153781
+ deletedAt: nowSql_helper_default
153782
+ }).where(eq(techdocProductKindRelateTable.id, id));
153783
+ };
153784
+ })(TechdocProductKindRelateLogic ||= {});
153785
+ var logic_default24 = TechdocProductKindRelateLogic;
153786
+
153787
+ // src/routes/techdoc/productKindRelate/model.ts
153788
+ var TechdocProductKindRelateModel;
153789
+ ((TechdocProductKindRelateModel) => {
153790
+ const createSchema = createInsertSchema2(techdocProductKindRelateTable);
153791
+ const updateSchema = createUpdateSchema(techdocProductKindRelateTable);
153792
+ TechdocProductKindRelateModel.create = OmitBaseSchema(createSchema);
153793
+ TechdocProductKindRelateModel.update = OmitBaseSchema(updateSchema);
153794
+ TechdocProductKindRelateModel.select = t.Composite([
153795
+ PaginationSchema,
153796
+ t.Partial(t.Object({
153797
+ productKindOneId: t.String({ format: "uuid" }),
153798
+ productKindTwoId: t.String({ format: "uuid" }),
153799
+ relateType: t.UnionEnum(techdocProductKindRelateTypeEnum.enumValues, {
153800
+ default: undefined
153801
+ })
153802
+ }))
153803
+ ]);
153804
+ })(TechdocProductKindRelateModel ||= {});
153805
+ var model_default22 = TechdocProductKindRelateModel;
153806
+
153807
+ // src/routes/techdoc/productKindRelate/index.ts
153808
+ var productKindRelateRoutes = new Elysia({
153809
+ prefix: "/product-kind-relate",
153810
+ tags: ["TechdocProductKindRelate"]
153811
+ }).use(better_auth_default).guard({ auth: true }).get("/", async ({ query }) => logic_default24.select(query), {
153812
+ query: model_default22.select
153813
+ }).guard({ userKind: "ADMIN" }).post("/", async ({ body }) => logic_default24.create(body), {
153814
+ body: model_default22.create
153815
+ }).guard({ params: IdSchema }).put("/:id", async ({ body, params: { id } }) => logic_default24.update(id, body), {
153816
+ body: model_default22.update
153817
+ }).delete("/:id", async ({ params: { id } }) => logic_default24.remove(id));
153818
+ var productKindRelate_default = productKindRelateRoutes;
153819
+
153588
153820
  // src/routes/techdoc/supplier/logic.ts
153589
153821
  var TechdocSupplierLogic;
153590
153822
  ((TechdocSupplierLogic) => {
@@ -153622,7 +153854,7 @@ var TechdocSupplierLogic;
153622
153854
  }).where(eq(techdocSupplierTable.id, id));
153623
153855
  };
153624
153856
  })(TechdocSupplierLogic ||= {});
153625
- var logic_default22 = TechdocSupplierLogic;
153857
+ var logic_default25 = TechdocSupplierLogic;
153626
153858
 
153627
153859
  // src/routes/techdoc/supplier/model.ts
153628
153860
  var TechdocSupplierModel;
@@ -153640,24 +153872,24 @@ var TechdocSupplierModel;
153640
153872
  const updateSchema = createUpdateSchema(techdocSupplierTable);
153641
153873
  TechdocSupplierModel.update = OmitBaseSchema(updateSchema);
153642
153874
  })(TechdocSupplierModel ||= {});
153643
- var model_default20 = TechdocSupplierModel;
153875
+ var model_default23 = TechdocSupplierModel;
153644
153876
 
153645
153877
  // src/routes/techdoc/supplier/index.ts
153646
153878
  var supplierRoutes = new Elysia({
153647
153879
  prefix: "/supplier",
153648
153880
  tags: ["TechdocSupplier"]
153649
- }).use(better_auth_default).get("/", async ({ query, user: user2 }) => logic_default22.select(query, user2), {
153650
- query: model_default20.select,
153881
+ }).use(better_auth_default).get("/", async ({ query, user: user2 }) => logic_default25.select(query, user2), {
153882
+ query: model_default23.select,
153651
153883
  auth: true
153652
153884
  }).guard({
153653
153885
  userKind: "ADMIN"
153654
- }).post("/", async ({ body }) => logic_default22.create(body), {
153655
- body: model_default20.create
153886
+ }).post("/", async ({ body }) => logic_default25.create(body), {
153887
+ body: model_default23.create
153656
153888
  }).guard({
153657
153889
  params: IdSchema
153658
- }).put("/:id", ({ body, params: { id } }) => logic_default22.update(id, body), {
153659
- body: model_default20.update
153660
- }).delete("/:id", ({ params: { id } }) => logic_default22.remove(id));
153890
+ }).put("/:id", ({ body, params: { id } }) => logic_default25.update(id, body), {
153891
+ body: model_default23.update
153892
+ }).delete("/:id", ({ params: { id } }) => logic_default25.remove(id));
153661
153893
  var supplier_default = supplierRoutes;
153662
153894
 
153663
153895
  // src/routes/techdoc/vehicleKind/model.ts
@@ -153673,7 +153905,7 @@ var TechdocVehicleKindModel;
153673
153905
  const createSchema = createInsertSchema(techdocVehicleKindTable);
153674
153906
  TechdocVehicleKindModel.create = OmitBaseSchema(createSchema);
153675
153907
  })(TechdocVehicleKindModel ||= {});
153676
- var model_default21 = TechdocVehicleKindModel;
153908
+ var model_default24 = TechdocVehicleKindModel;
153677
153909
 
153678
153910
  // src/routes/techdoc/vehicleKind/index.ts
153679
153911
  var vehicleKindRoutes = new Elysia({
@@ -153682,12 +153914,12 @@ var vehicleKindRoutes = new Elysia({
153682
153914
  }).use(better_auth_default).guard({
153683
153915
  auth: true
153684
153916
  }).get("/", async ({ query }) => logic_default10.select(query), {
153685
- query: model_default21.select
153917
+ query: model_default24.select
153686
153918
  }).post("/", async ({ body }) => logic_default10.findOrCreate(body), {
153687
- body: model_default21.create,
153919
+ body: model_default24.create,
153688
153920
  userKind: "ADMIN"
153689
153921
  }).put("/:id", async ({ body, params: { id } }) => logic_default10.update(id, body), {
153690
- body: model_default21.update,
153922
+ body: model_default24.update,
153691
153923
  params: IdSchema,
153692
153924
  userKind: "ADMIN"
153693
153925
  });
@@ -153696,7 +153928,7 @@ var vehicleKind_default = vehicleKindRoutes;
153696
153928
  // src/routes/techdoc/index.ts
153697
153929
  var techdocSchemaRoutes = new Elysia({
153698
153930
  prefix: "/techdoc"
153699
- }).use(supplier_default).use(vehicleKind_default).use(product_default2);
153931
+ }).use(supplier_default).use(vehicleKind_default).use(productCategory_default).use(productKind_default).use(productKindRelate_default).use(product_default2);
153700
153932
  var techdoc_default = techdocSchemaRoutes;
153701
153933
 
153702
153934
  // node_modules/generate-password/src/generate.js
@@ -153883,7 +154115,7 @@ var UserLogic;
153883
154115
  });
153884
154116
  };
153885
154117
  })(UserLogic ||= {});
153886
- var logic_default23 = UserLogic;
154118
+ var logic_default26 = UserLogic;
153887
154119
 
153888
154120
  // src/routes/user/schema.ts
153889
154121
  var select = createSelectSchema(user);
@@ -153916,7 +154148,7 @@ var userRoutes = new Elysia({
153916
154148
  }).use(better_auth_default).guard({
153917
154149
  auth: true,
153918
154150
  tags: ["User"]
153919
- }).get("/", async ({ query, user: user2 }) => logic_default23.select(query, user2), {
154151
+ }).get("/", async ({ query, user: user2 }) => logic_default26.select(query, user2), {
153920
154152
  query: selectUserSchema,
153921
154153
  userKind: "COMPANY_ADMIN"
153922
154154
  }).get("/me", async ({ user: user2 }) => {
@@ -153950,10 +154182,10 @@ var userRoutes = new Elysia({
153950
154182
  ...user2,
153951
154183
  company: company2
153952
154184
  };
153953
- }).post("/", async ({ body, user: user2 }) => logic_default23.registerUser(body, user2), {
154185
+ }).post("/", async ({ body, user: user2 }) => logic_default26.registerUser(body, user2), {
153954
154186
  body: createUserSchema,
153955
154187
  userKind: "COMPANY_ADMIN"
153956
- }).put("/:id", async ({ body, user: user2, params: { id } }) => logic_default23.update(id, body, user2).catch((e) => console.log(e)), {
154188
+ }).put("/:id", async ({ body, user: user2, params: { id } }) => logic_default26.update(id, body, user2).catch((e) => console.log(e)), {
153957
154189
  body: updateUserSchema,
153958
154190
  userKind: "COMPANY_ADMIN"
153959
154191
  });
@@ -153981,7 +154213,7 @@ var WarehouseProductModel;
153981
154213
  PaginationSchema
153982
154214
  ]);
153983
154215
  })(WarehouseProductModel ||= {});
153984
- var model_default22 = WarehouseProductModel;
154216
+ var model_default25 = WarehouseProductModel;
153985
154217
 
153986
154218
  // src/routes/warehouse/item/model.ts
153987
154219
  var WarehouseItemModel;
@@ -153999,7 +154231,7 @@ var WarehouseItemModel;
153999
154231
  WarehouseItemModel.select = t.Composite([
154000
154232
  PaginationSchema,
154001
154233
  t.Partial(t.Object({
154002
- product: t.Omit(model_default22.select, ["pagination"]),
154234
+ product: t.Omit(model_default25.select, ["pagination"]),
154003
154235
  shelfNumber: t.String(),
154004
154236
  safetyStock: t.Number(),
154005
154237
  warehouseId: t.String({ format: "uuid" }),
@@ -154022,7 +154254,7 @@ var WarehouseItemModel;
154022
154254
  transferId: t.String({ format: "uuid", default: undefined })
154023
154255
  })),
154024
154256
  t.Partial(t.Object({
154025
- product: t.Omit(model_default22.select, ["pagination"]),
154257
+ product: t.Omit(model_default25.select, ["pagination"]),
154026
154258
  itemId: t.String({ format: "uuid", default: undefined }),
154027
154259
  dateFrom: t.String({ format: "date-time", default: undefined }),
154028
154260
  dateTo: t.String({ format: "date-time", default: undefined }),
@@ -154046,7 +154278,7 @@ var WarehouseItemModel;
154046
154278
  transactionDetails
154047
154279
  });
154048
154280
  })(WarehouseItemModel ||= {});
154049
- var model_default23 = WarehouseItemModel;
154281
+ var model_default26 = WarehouseItemModel;
154050
154282
 
154051
154283
  // src/routes/warehouse/item/index.ts
154052
154284
  var itemRoutes2 = new Elysia({
@@ -154055,15 +154287,15 @@ var itemRoutes2 = new Elysia({
154055
154287
  }).use(better_auth_default).guard({
154056
154288
  userKind: "CUSTOMER"
154057
154289
  }).get("/", async ({ query, user: user2 }) => logic_default6.select(query, user2), {
154058
- query: model_default23.select
154290
+ query: model_default26.select
154059
154291
  }).get("/sos", async ({ user: user2 }) => logic_default6.selectSos(user2)).post("/", async ({ body }) => logic_default6.create(body), {
154060
- body: model_default23.create
154292
+ body: model_default26.create
154061
154293
  }).post("/many", async ({ body, user: user2 }) => logic_default6.createMany(body, user2), {
154062
- body: model_default23.createMany
154294
+ body: model_default26.createMany
154063
154295
  }).get("/transaction", async ({ query, user: user2 }) => logic_default6.selectTransaction(query, user2), {
154064
- query: model_default23.selectTransaction
154296
+ query: model_default26.selectTransaction
154065
154297
  }).post("/change-quantity", async ({ body, user: user2 }) => logic_default6.changeQuantity(body, user2), {
154066
- body: model_default23.changeQuantity
154298
+ body: model_default26.changeQuantity
154067
154299
  }).post("/order", async ({ user: user2 }) => {
154068
154300
  const current = await db_default.select({
154069
154301
  id: warehouseItemTable.id
@@ -154076,7 +154308,7 @@ var itemRoutes2 = new Elysia({
154076
154308
  }).guard({
154077
154309
  params: IdSchema
154078
154310
  }).put("/:id", async ({ body, params: { id } }) => logic_default6.update(id, body), {
154079
- body: model_default23.update
154311
+ body: model_default26.update
154080
154312
  }).delete("/:id", async ({ params: { id } }) => logic_default6.remove(id));
154081
154313
  var item_default3 = itemRoutes2;
154082
154314
 
@@ -154087,14 +154319,14 @@ var productRoutes3 = new Elysia({
154087
154319
  }).use(better_auth_default).guard({ auth: true }).get("/", async ({ query, user: user2 }) => {
154088
154320
  return logic_default5.select(query, user2);
154089
154321
  }, {
154090
- query: model_default22.select
154322
+ query: model_default25.select
154091
154323
  }).post("/", async ({ body, user: user2 }) => logic_default5.create(body, user2), {
154092
- body: model_default22.create
154324
+ body: model_default25.create
154093
154325
  }).post("/many", async ({ body, user: user2 }) => logic_default5.createMany(body, user2), {
154094
- body: t.Array(model_default22.create)
154095
- }).post("/download", async ({ query, user: user2 }) => logic_default5.downloadExcel(query, user2), { query: t.Omit(model_default22.select, ["pagination"]) }).guard({
154326
+ body: t.Array(model_default25.create)
154327
+ }).post("/download", async ({ query, user: user2 }) => logic_default5.downloadExcel(query, user2), { query: t.Omit(model_default25.select, ["pagination"]) }).guard({
154096
154328
  params: IdSchema
154097
- }).put("/:id", async ({ params: { id }, body, user: user2 }) => logic_default5.update(id, body, user2), { body: model_default22.update });
154329
+ }).put("/:id", async ({ params: { id }, body, user: user2 }) => logic_default5.update(id, body, user2), { body: model_default25.update });
154098
154330
  var product_default3 = productRoutes3;
154099
154331
 
154100
154332
  // src/routes/warehouse/warehouse/logic.ts
@@ -154137,7 +154369,7 @@ var WarehouseWarehouseLogic;
154137
154369
  }).where(and(eq(warehouseWarehouseTable.id, id), eq(warehouseWarehouseTable.companyId, user2.companyId), eq(warehouseWarehouseTable.branchId, user2.branchId).if(user2.kind !== "COMPANY_ADMIN")));
154138
154370
  };
154139
154371
  })(WarehouseWarehouseLogic ||= {});
154140
- var logic_default24 = WarehouseWarehouseLogic;
154372
+ var logic_default27 = WarehouseWarehouseLogic;
154141
154373
 
154142
154374
  // src/routes/warehouse/warehouse/model.ts
154143
154375
  var WarehouseWarehouseModel;
@@ -154156,23 +154388,23 @@ var WarehouseWarehouseModel;
154156
154388
  PaginationSchema
154157
154389
  ]);
154158
154390
  })(WarehouseWarehouseModel ||= {});
154159
- var model_default24 = WarehouseWarehouseModel;
154391
+ var model_default27 = WarehouseWarehouseModel;
154160
154392
 
154161
154393
  // src/routes/warehouse/warehouse/index.ts
154162
154394
  var warehouseRoutes = new Elysia({
154163
154395
  prefix: "/warehouse",
154164
154396
  tags: ["Warehouse"]
154165
- }).use(better_auth_default).guard({ auth: true }).get("/", async ({ query, user: user2 }) => logic_default24.select(query, user2), {
154166
- query: model_default24.select
154397
+ }).use(better_auth_default).guard({ auth: true }).get("/", async ({ query, user: user2 }) => logic_default27.select(query, user2), {
154398
+ query: model_default27.select
154167
154399
  }).guard({
154168
154400
  userKind: "COMPANY_ADMIN"
154169
- }).post("/", async ({ body, user: user2 }) => logic_default24.create(body, user2), {
154170
- body: model_default24.create
154401
+ }).post("/", async ({ body, user: user2 }) => logic_default27.create(body, user2), {
154402
+ body: model_default27.create
154171
154403
  }).guard({
154172
154404
  params: IdSchema
154173
- }).put("/:id", async ({ params: { id }, body, user: user2 }) => logic_default24.update(id, body, user2), {
154174
- body: model_default24.update
154175
- }).delete("/:id", async ({ params: { id }, user: user2 }) => logic_default24.remove(id, user2));
154405
+ }).put("/:id", async ({ params: { id }, body, user: user2 }) => logic_default27.update(id, body, user2), {
154406
+ body: model_default27.update
154407
+ }).delete("/:id", async ({ params: { id }, user: user2 }) => logic_default27.remove(id, user2));
154176
154408
  var warehouse_default = warehouseRoutes;
154177
154409
 
154178
154410
  // src/routes/warehouse/index.ts
@@ -154200,7 +154432,7 @@ var InspectionFieldLogic;
154200
154432
  }).where(eq(inspectionFieldTable.id, id));
154201
154433
  };
154202
154434
  })(InspectionFieldLogic ||= {});
154203
- var logic_default25 = InspectionFieldLogic;
154435
+ var logic_default28 = InspectionFieldLogic;
154204
154436
 
154205
154437
  // src/routes/fleet/inspection/field/model.ts
154206
154438
  var InspectionFieldModel;
@@ -154210,7 +154442,7 @@ var InspectionFieldModel;
154210
154442
  InspectionFieldModel.create = OmitBaseSchema(createSchema);
154211
154443
  InspectionFieldModel.update = OmitBaseSchema(updateSchema);
154212
154444
  })(InspectionFieldModel ||= {});
154213
- var model_default25 = InspectionFieldModel;
154445
+ var model_default28 = InspectionFieldModel;
154214
154446
 
154215
154447
  // src/routes/fleet/inspection/field/index.ts
154216
154448
  var fieldRoutes = new Elysia({
@@ -154218,13 +154450,13 @@ var fieldRoutes = new Elysia({
154218
154450
  tags: ["InspectionField"]
154219
154451
  }).use(better_auth_default).guard({
154220
154452
  userKind: "ADMIN"
154221
- }).post("/", async ({ body }) => logic_default25.create(body), {
154222
- body: model_default25.create
154453
+ }).post("/", async ({ body }) => logic_default28.create(body), {
154454
+ body: model_default28.create
154223
154455
  }).guard({
154224
154456
  params: IdSchema
154225
- }).put("/:id", async ({ body, params: { id } }) => logic_default25.update(id, body), {
154226
- body: model_default25.update
154227
- }).delete("/:id", async ({ params: { id } }) => logic_default25.remove(id));
154457
+ }).put("/:id", async ({ body, params: { id } }) => logic_default28.update(id, body), {
154458
+ body: model_default28.update
154459
+ }).delete("/:id", async ({ params: { id } }) => logic_default28.remove(id));
154228
154460
  var field_default = fieldRoutes;
154229
154461
 
154230
154462
  // src/routes/fleet/inspection/fieldGroup/logic.ts
@@ -154259,7 +154491,7 @@ var InspectionFieldGroupLogic;
154259
154491
  }).where(eq(inspectionFieldGroupTable.id, id));
154260
154492
  };
154261
154493
  })(InspectionFieldGroupLogic ||= {});
154262
- var logic_default26 = InspectionFieldGroupLogic;
154494
+ var logic_default29 = InspectionFieldGroupLogic;
154263
154495
 
154264
154496
  // src/routes/fleet/inspection/fieldGroup/model.ts
154265
154497
  var InspectionFieldGroupModel;
@@ -154276,7 +154508,7 @@ var InspectionFieldGroupModel;
154276
154508
  PaginationSchema
154277
154509
  ]);
154278
154510
  })(InspectionFieldGroupModel ||= {});
154279
- var model_default26 = InspectionFieldGroupModel;
154511
+ var model_default29 = InspectionFieldGroupModel;
154280
154512
 
154281
154513
  // src/routes/fleet/inspection/fieldGroup/index.ts
154282
154514
  var fieldGroupRoutes = new Elysia({
@@ -154284,19 +154516,111 @@ var fieldGroupRoutes = new Elysia({
154284
154516
  tags: ["InspectionFieldGroup"]
154285
154517
  }).use(better_auth_default).guard({
154286
154518
  userKind: "ADMIN"
154287
- }).get("/", async ({ query }) => logic_default26.select(query), {
154288
- query: model_default26.select,
154519
+ }).get("/", async ({ query }) => logic_default29.select(query), {
154520
+ query: model_default29.select,
154289
154521
  userKind: undefined,
154290
154522
  auth: true
154291
- }).post("/", async ({ body }) => logic_default26.create(body), {
154292
- body: model_default26.create
154523
+ }).post("/", async ({ body }) => logic_default29.create(body), {
154524
+ body: model_default29.create
154293
154525
  }).guard({
154294
154526
  params: IdSchema
154295
- }).put("/:id", async ({ body, params: { id } }) => logic_default26.update(id, body), {
154296
- body: model_default26.update
154297
- }).delete("/:id", async ({ params: { id } }) => logic_default26.remove(id)).get("/:id/field", async ({ params: { id } }) => logic_default25.select(id));
154527
+ }).put("/:id", async ({ body, params: { id } }) => logic_default29.update(id, body), {
154528
+ body: model_default29.update
154529
+ }).delete("/:id", async ({ params: { id } }) => logic_default29.remove(id)).get("/:id/field", async ({ params: { id } }) => logic_default28.select(id));
154298
154530
  var fieldGroup_default = fieldGroupRoutes;
154299
154531
 
154532
+ // src/routes/fleet/inspection/fieldResult/logic.ts
154533
+ var InspectionFieldResultLogic;
154534
+ ((InspectionFieldResultLogic) => {
154535
+ InspectionFieldResultLogic.select = async (query) => {
154536
+ const filter = and(eq(inspectionFieldResult.inspectionId, query.inspectionId), softDeletedFilter(inspectionFieldResult));
154537
+ const columns = getTableColumns(inspectionFieldResult);
154538
+ const baseQuery = db_default.select({
154539
+ ...columns,
154540
+ totalCount: totalCountSql
154541
+ }).from(inspectionFieldResult).where(filter).$dynamic();
154542
+ const result = await pagination_helper_default(baseQuery, query.pagination);
154543
+ return getPaginationContent(result, query.pagination.size);
154544
+ };
154545
+ InspectionFieldResultLogic.createOrUpdate = async (body) => {
154546
+ if (body.length === 0) {
154547
+ return status("Bad Request", "\u0425\u044F\u043D\u0430\u043B\u0442\u044B\u043D \u04AF\u0440 \u0434\u04AF\u043D \u043E\u0440\u0443\u0443\u043B\u0430\u0445 \u043C\u044D\u0434\u044D\u044D\u043B\u044D\u043B \u0431\u0430\u0439\u0445\u0433\u04AF\u0439 \u0431\u0430\u0439\u043D\u0430.");
154548
+ }
154549
+ const inspectionId = body[0].inspectionId;
154550
+ if (!body.every((item) => item.inspectionId === inspectionId)) {
154551
+ return status("Bad Request", "\u0411\u04AF\u0445 \u04AF\u0440 \u0434\u04AF\u043D \u043D\u044C \u0438\u0436\u0438\u043B \u0445\u044F\u043D\u0430\u043B\u0442\u044B\u043D \u04AF\u0437\u043B\u044D\u0433\u0442 \u0445\u0430\u043C\u0430\u0430\u0440\u0430\u0445 \u0451\u0441\u0442\u043E\u0439.");
154552
+ }
154553
+ return db_default.transaction(async (db2) => {
154554
+ const existingResults = await db2.select().from(inspectionFieldResult).where(and(eq(inspectionFieldResult.inspectionId, inspectionId), inArray(inspectionFieldResult.templateFieldId, body.map((item) => item.templateFieldId)), softDeletedFilter(inspectionFieldResult)));
154555
+ const existingMap = new Map(existingResults.map((r) => [r.templateFieldId, r]));
154556
+ const toInsert = [];
154557
+ const toUpdate = [];
154558
+ for (const item of body) {
154559
+ const existing = existingMap.get(item.templateFieldId);
154560
+ if (existing) {
154561
+ toUpdate.push({
154562
+ id: existing.id,
154563
+ data: item
154564
+ });
154565
+ } else {
154566
+ toInsert.push(item);
154567
+ }
154568
+ }
154569
+ for (const { id, data } of toUpdate) {
154570
+ await db2.update(inspectionFieldResult).set({
154571
+ ...data,
154572
+ updatedAt: nowSql_helper_default
154573
+ }).where(eq(inspectionFieldResult.id, id));
154574
+ }
154575
+ if (toInsert.length > 0) {
154576
+ await db2.insert(inspectionFieldResult).values(toInsert);
154577
+ }
154578
+ const results = await db2.select().from(inspectionFieldResult).where(and(eq(inspectionFieldResult.inspectionId, inspectionId), softDeletedFilter(inspectionFieldResult)));
154579
+ return results;
154580
+ });
154581
+ };
154582
+ InspectionFieldResultLogic.removeAll = async (inspectionId) => {
154583
+ const [inspection] = await db_default.select().from(inspectionTable).where(eq(inspectionTable.id, inspectionId)).limit(1);
154584
+ if (!inspection) {
154585
+ return status("Not Found", "\u0425\u044F\u043D\u0430\u043B\u0442\u044B\u043D \u04AF\u0437\u043B\u044D\u0433 \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.");
154586
+ }
154587
+ await db_default.update(inspectionFieldResult).set({
154588
+ deletedAt: nowSql_helper_default
154589
+ }).where(and(eq(inspectionFieldResult.inspectionId, inspectionId), softDeletedFilter(inspectionFieldResult)));
154590
+ };
154591
+ })(InspectionFieldResultLogic ||= {});
154592
+ var logic_default30 = InspectionFieldResultLogic;
154593
+
154594
+ // src/routes/fleet/inspection/fieldResult/model.ts
154595
+ var InspectionFieldResultModel;
154596
+ ((InspectionFieldResultModel) => {
154597
+ const createSchema = createInsertSchema2(inspectionFieldResult);
154598
+ const updateSchema = createUpdateSchema(inspectionFieldResult);
154599
+ InspectionFieldResultModel.create = OmitBaseSchema(createSchema);
154600
+ InspectionFieldResultModel.update = OmitBaseSchema(updateSchema);
154601
+ InspectionFieldResultModel.createOrUpdate = t.Array(OmitBaseSchema(createSchema));
154602
+ InspectionFieldResultModel.select = t.Composite([
154603
+ PaginationSchema,
154604
+ t.Object({
154605
+ inspectionId: t.String({ format: "uuid" })
154606
+ })
154607
+ ]);
154608
+ })(InspectionFieldResultModel ||= {});
154609
+ var model_default30 = InspectionFieldResultModel;
154610
+
154611
+ // src/routes/fleet/inspection/fieldResult/index.ts
154612
+ var fieldResultRoutes = new Elysia({
154613
+ prefix: "/field-result",
154614
+ tags: ["InspectionFieldResult"]
154615
+ }).use(better_auth_default).guard({ auth: true }).get("/", async ({ query }) => logic_default30.select(query), {
154616
+ query: model_default30.select
154617
+ }).post("/create-or-update", async ({ body }) => logic_default30.createOrUpdate(body), {
154618
+ body: model_default30.createOrUpdate
154619
+ }).guard({
154620
+ params: IdSchema
154621
+ }).delete("/inspection/:id/all", async ({ params: { id } }) => logic_default30.removeAll(id));
154622
+ var fieldResult_default = fieldResultRoutes;
154623
+
154300
154624
  // src/routes/fleet/inspection/logic.ts
154301
154625
  var InspectionLogic;
154302
154626
  ((InspectionLogic) => {
@@ -154337,7 +154661,7 @@ var InspectionLogic;
154337
154661
  await db_default.delete(inspectionTable).where(eq(inspectionTable.id, id));
154338
154662
  };
154339
154663
  })(InspectionLogic ||= {});
154340
- var logic_default27 = InspectionLogic;
154664
+ var logic_default31 = InspectionLogic;
154341
154665
 
154342
154666
  // src/routes/fleet/inspection/model.ts
154343
154667
  var InspectionModel;
@@ -154363,7 +154687,7 @@ var InspectionModel;
154363
154687
  }))
154364
154688
  ]);
154365
154689
  })(InspectionModel ||= {});
154366
- var model_default27 = InspectionModel;
154690
+ var model_default31 = InspectionModel;
154367
154691
 
154368
154692
  // src/routes/fleet/inspection/schedule/logic.ts
154369
154693
  var InspectionScheduleLogic;
@@ -154393,7 +154717,7 @@ var InspectionScheduleLogic;
154393
154717
  }).where(and(eq(inspectionScheduleTable.id, id), eq(inspectionScheduleTable.companyId, user2.companyId)));
154394
154718
  };
154395
154719
  })(InspectionScheduleLogic ||= {});
154396
- var logic_default28 = InspectionScheduleLogic;
154720
+ var logic_default32 = InspectionScheduleLogic;
154397
154721
 
154398
154722
  // src/routes/fleet/inspection/schedule/model.ts
154399
154723
  var InspectionScheduleModel;
@@ -154404,18 +154728,18 @@ var InspectionScheduleModel;
154404
154728
  InspectionScheduleModel.update = OmitBaseSchema(updateSchema);
154405
154729
  InspectionScheduleModel.select = t.Composite([PaginationSchema]);
154406
154730
  })(InspectionScheduleModel ||= {});
154407
- var model_default28 = InspectionScheduleModel;
154731
+ var model_default32 = InspectionScheduleModel;
154408
154732
 
154409
154733
  // src/routes/fleet/inspection/schedule/index.ts
154410
154734
  var scheduleRoutes = new Elysia({
154411
154735
  prefix: "/schedule"
154412
- }).use(better_auth_default).guard({ auth: true }).get("/", async ({ query, user: user2 }) => logic_default28.select(query, user2), {
154413
- query: model_default28.select
154414
- }).post("/", async ({ body, user: user2 }) => logic_default28.create(body, user2), {
154415
- body: model_default28.create
154736
+ }).use(better_auth_default).guard({ auth: true }).get("/", async ({ query, user: user2 }) => logic_default32.select(query, user2), {
154737
+ query: model_default32.select
154738
+ }).post("/", async ({ body, user: user2 }) => logic_default32.create(body, user2), {
154739
+ body: model_default32.create
154416
154740
  }).guard({
154417
154741
  params: IdSchema
154418
- }).put("/:id", async ({ body, params: { id }, user: user2 }) => logic_default28.update(id, body, user2), { body: model_default28.update }).delete("/:id", async ({ params: { id }, user: user2 }) => logic_default28.remove(id, user2));
154742
+ }).put("/:id", async ({ body, params: { id }, user: user2 }) => logic_default32.update(id, body, user2), { body: model_default32.update }).delete("/:id", async ({ params: { id }, user: user2 }) => logic_default32.remove(id, user2));
154419
154743
  var schedule_default = scheduleRoutes;
154420
154744
 
154421
154745
  // src/routes/fleet/inspection/template/logic.ts
@@ -154474,7 +154798,7 @@ var InspectionTemplateLogic;
154474
154798
  }).where(eq(inspectionTemplateFieldTable.id, id));
154475
154799
  };
154476
154800
  })(InspectionTemplateLogic ||= {});
154477
- var logic_default29 = InspectionTemplateLogic;
154801
+ var logic_default33 = InspectionTemplateLogic;
154478
154802
 
154479
154803
  // src/routes/fleet/inspection/template/model.ts
154480
154804
  var InspectionTemplateModel;
@@ -154489,7 +154813,7 @@ var InspectionTemplateModel;
154489
154813
  "templateId"
154490
154814
  ]);
154491
154815
  })(InspectionTemplateModel ||= {});
154492
- var model_default29 = InspectionTemplateModel;
154816
+ var model_default33 = InspectionTemplateModel;
154493
154817
 
154494
154818
  // src/routes/fleet/inspection/template/index.ts
154495
154819
  var templateRoutes = new Elysia({
@@ -154497,30 +154821,30 @@ var templateRoutes = new Elysia({
154497
154821
  tags: ["InspectionTemplate"]
154498
154822
  }).use(better_auth_default).guard({
154499
154823
  userKind: "COMPANY_ADMIN"
154500
- }).get("/", async ({ query, user: user2 }) => logic_default29.select(query, user2), {
154501
- query: model_default29.select
154502
- }).post("/", async ({ body, user: user2 }) => logic_default29.create(body, user2), {
154503
- body: model_default29.create
154824
+ }).get("/", async ({ query, user: user2 }) => logic_default33.select(query, user2), {
154825
+ query: model_default33.select
154826
+ }).post("/", async ({ body, user: user2 }) => logic_default33.create(body, user2), {
154827
+ body: model_default33.create
154504
154828
  }).guard({
154505
154829
  params: IdSchema
154506
- }).get("/:id", async ({ params: { id }, user: user2 }) => logic_default29.selectById(id, user2)).put("/:id", async ({ body, params: { id }, user: user2 }) => logic_default29.update(id, body, user2), {
154507
- body: model_default29.update
154508
- }).delete("/:id", async ({ params: { id }, user: user2 }) => logic_default29.remove(id, user2)).get("/:id/field", async ({ params: { id } }) => logic_default29.selectField(id)).post("/:id/field", async ({ body, params: { id } }) => logic_default29.addField(id, body), {
154509
- body: model_default29.createField
154510
- }).delete("/field/:id", async ({ params: { id } }) => logic_default29.removeField(id));
154830
+ }).get("/:id", async ({ params: { id }, user: user2 }) => logic_default33.selectById(id, user2)).put("/:id", async ({ body, params: { id }, user: user2 }) => logic_default33.update(id, body, user2), {
154831
+ body: model_default33.update
154832
+ }).delete("/:id", async ({ params: { id }, user: user2 }) => logic_default33.remove(id, user2)).get("/:id/field", async ({ params: { id } }) => logic_default33.selectField(id)).post("/:id/field", async ({ body, params: { id } }) => logic_default33.addField(id, body), {
154833
+ body: model_default33.createField
154834
+ }).delete("/field/:id", async ({ params: { id } }) => logic_default33.removeField(id));
154511
154835
  var template_default = templateRoutes;
154512
154836
 
154513
154837
  // src/routes/fleet/inspection/index.ts
154514
154838
  var inspectionRoutes2 = new Elysia({
154515
154839
  prefix: "/inspection"
154516
- }).use(fieldGroup_default).use(field_default).use(template_default).use(schedule_default).use(better_auth_default).guard({ auth: true }).get("/", async ({ query, user: user2 }) => logic_default27.select(query, user2), {
154517
- query: model_default27.select
154518
- }).post("/", async ({ body, user: user2 }) => logic_default27.create(body, user2).catch((err2) => console.error(err2)), {
154519
- body: model_default27.create
154840
+ }).use(fieldGroup_default).use(field_default).use(fieldResult_default).use(template_default).use(schedule_default).use(better_auth_default).guard({ auth: true }).get("/", async ({ query, user: user2 }) => logic_default31.select(query, user2), {
154841
+ query: model_default31.select
154842
+ }).post("/", async ({ body, user: user2 }) => logic_default31.create(body, user2).catch((err2) => console.error(err2)), {
154843
+ body: model_default31.create
154520
154844
  }).guard({
154521
154845
  params: IdSchema
154522
- }).put("/:id", async ({ body, params: { id } }) => logic_default27.update(id, body), {
154523
- body: model_default27.update
154846
+ }).put("/:id", async ({ body, params: { id } }) => logic_default31.update(id, body), {
154847
+ body: model_default31.update
154524
154848
  });
154525
154849
  var inspection_default2 = inspectionRoutes2;
154526
154850
 
@@ -154554,7 +154878,7 @@ var MachineLogic;
154554
154878
  }).where(and(eq(companyMachineTable.id, id), eq(companyMachineTable.companyId, user2.companyId).if(user2.kind !== "ADMIN")));
154555
154879
  };
154556
154880
  })(MachineLogic ||= {});
154557
- var logic_default30 = MachineLogic;
154881
+ var logic_default34 = MachineLogic;
154558
154882
 
154559
154883
  // src/routes/fleet/machine/model.ts
154560
154884
  var MachineModel;
@@ -154565,7 +154889,7 @@ var MachineModel;
154565
154889
  MachineModel.update = OmitBaseSchema(updateSchema);
154566
154890
  MachineModel.select = t.Composite([PaginationSchema]);
154567
154891
  })(MachineModel ||= {});
154568
- var model_default30 = MachineModel;
154892
+ var model_default34 = MachineModel;
154569
154893
 
154570
154894
  // src/routes/fleet/machine/index.ts
154571
154895
  var machineRoutes = new Elysia({
@@ -154573,15 +154897,15 @@ var machineRoutes = new Elysia({
154573
154897
  tags: ["FleetMachine"]
154574
154898
  }).use(better_auth_default).guard({
154575
154899
  auth: true
154576
- }).get("/", async ({ query, user: user2 }) => logic_default30.select(query, user2), {
154577
- query: model_default30.select
154578
- }).post("/", async ({ body, user: user2 }) => logic_default30.create(body, user2), {
154579
- body: model_default30.create
154900
+ }).get("/", async ({ query, user: user2 }) => logic_default34.select(query, user2), {
154901
+ query: model_default34.select
154902
+ }).post("/", async ({ body, user: user2 }) => logic_default34.create(body, user2), {
154903
+ body: model_default34.create
154580
154904
  }).guard({
154581
154905
  params: IdSchema
154582
- }).put("/:id", async ({ body, params: { id }, user: user2 }) => logic_default30.update(id, body, user2), {
154583
- body: model_default30.update
154584
- }).delete("/:id", async ({ params: { id }, user: user2 }) => logic_default30.remove(id, user2));
154906
+ }).put("/:id", async ({ body, params: { id }, user: user2 }) => logic_default34.update(id, body, user2), {
154907
+ body: model_default34.update
154908
+ }).delete("/:id", async ({ params: { id }, user: user2 }) => logic_default34.remove(id, user2));
154585
154909
  var machine_default = machineRoutes;
154586
154910
 
154587
154911
  // src/routes/fleet/pm/template/logic.ts
@@ -154616,7 +154940,7 @@ var PmTemplateLogic;
154616
154940
  }).where(and(eq(pmTemplateTable.id, id), eq(pmTemplateTable.companyId, user2.companyId).if(user2.kind !== "ADMIN")));
154617
154941
  };
154618
154942
  })(PmTemplateLogic ||= {});
154619
- var logic_default31 = PmTemplateLogic;
154943
+ var logic_default35 = PmTemplateLogic;
154620
154944
 
154621
154945
  // src/routes/fleet/pm/template/model.ts
154622
154946
  var PmTemplateModel;
@@ -154627,7 +154951,7 @@ var PmTemplateModel;
154627
154951
  PmTemplateModel.update = OmitBaseSchema(updateSchema);
154628
154952
  PmTemplateModel.select = t.Composite([PaginationSchema]);
154629
154953
  })(PmTemplateModel ||= {});
154630
- var model_default31 = PmTemplateModel;
154954
+ var model_default35 = PmTemplateModel;
154631
154955
 
154632
154956
  // src/routes/fleet/pm/template/product/logic.ts
154633
154957
  var PmTemplateProductLogic;
@@ -154658,7 +154982,7 @@ var PmTemplateProductLogic;
154658
154982
  }).where(and(eq(pmTemplateProductTable.id, id)));
154659
154983
  };
154660
154984
  })(PmTemplateProductLogic ||= {});
154661
- var logic_default32 = PmTemplateProductLogic;
154985
+ var logic_default36 = PmTemplateProductLogic;
154662
154986
 
154663
154987
  // src/routes/fleet/pm/template/product/model.ts
154664
154988
  var PmTemplateProductModel;
@@ -154674,7 +154998,7 @@ var PmTemplateProductModel;
154674
154998
  })
154675
154999
  ]);
154676
155000
  })(PmTemplateProductModel ||= {});
154677
- var model_default32 = PmTemplateProductModel;
155001
+ var model_default36 = PmTemplateProductModel;
154678
155002
 
154679
155003
  // src/routes/fleet/pm/template/product/index.ts
154680
155004
  var productRoutes4 = new Elysia({
@@ -154682,15 +155006,15 @@ var productRoutes4 = new Elysia({
154682
155006
  tags: ["PmTemplateProduct"]
154683
155007
  }).use(better_auth_default).guard({
154684
155008
  userKind: "COMPANY_ADMIN"
154685
- }).get("/", async ({ query }) => logic_default32.select(query), {
154686
- query: model_default32.select
154687
- }).post("/", async ({ body }) => logic_default32.create(body), {
154688
- body: model_default32.create
155009
+ }).get("/", async ({ query }) => logic_default36.select(query), {
155010
+ query: model_default36.select
155011
+ }).post("/", async ({ body }) => logic_default36.create(body), {
155012
+ body: model_default36.create
154689
155013
  }).guard({
154690
155014
  params: IdSchema
154691
- }).put("/:id", async ({ body, params: { id } }) => logic_default32.update(id, body), {
154692
- body: model_default32.update
154693
- }).delete("/:id", async ({ params: { id } }) => logic_default32.remove(id));
155015
+ }).put("/:id", async ({ body, params: { id } }) => logic_default36.update(id, body), {
155016
+ body: model_default36.update
155017
+ }).delete("/:id", async ({ params: { id } }) => logic_default36.remove(id));
154694
155018
  var product_default4 = productRoutes4;
154695
155019
 
154696
155020
  // src/routes/fleet/pm/template/index.ts
@@ -154699,15 +155023,15 @@ var templateRoutes2 = new Elysia({
154699
155023
  tags: ["PmTemplate"]
154700
155024
  }).use(better_auth_default).use(product_default4).guard({
154701
155025
  userKind: "COMPANY_ADMIN"
154702
- }).get("/", async ({ query, user: user2 }) => logic_default31.select(query, user2), {
154703
- query: model_default31.select
154704
- }).post("/", async ({ body, user: user2 }) => logic_default31.create(body, user2), {
154705
- body: model_default31.create
155026
+ }).get("/", async ({ query, user: user2 }) => logic_default35.select(query, user2), {
155027
+ query: model_default35.select
155028
+ }).post("/", async ({ body, user: user2 }) => logic_default35.create(body, user2), {
155029
+ body: model_default35.create
154706
155030
  }).guard({
154707
155031
  params: IdSchema
154708
- }).put("/:id", async ({ body, params: { id }, user: user2 }) => logic_default31.update(id, body, user2), {
154709
- body: model_default31.update
154710
- }).delete("/:id", async ({ params: { id }, user: user2 }) => logic_default31.remove(id, user2));
155032
+ }).put("/:id", async ({ body, params: { id }, user: user2 }) => logic_default35.update(id, body, user2), {
155033
+ body: model_default35.update
155034
+ }).delete("/:id", async ({ params: { id }, user: user2 }) => logic_default35.remove(id, user2));
154711
155035
  var template_default2 = templateRoutes2;
154712
155036
 
154713
155037
  // src/routes/fleet/pm/index.ts
@@ -154751,7 +155075,7 @@ var UomCategoryLogic;
154751
155075
  }).where(and(eq(uomCategoryTable.id, id)));
154752
155076
  };
154753
155077
  })(UomCategoryLogic ||= {});
154754
- var logic_default33 = UomCategoryLogic;
155078
+ var logic_default37 = UomCategoryLogic;
154755
155079
 
154756
155080
  // src/routes/uom/category/model.ts
154757
155081
  var UomCategoryModel;
@@ -154762,7 +155086,7 @@ var UomCategoryModel;
154762
155086
  UomCategoryModel.update = OmitBaseSchema(updateSchema);
154763
155087
  UomCategoryModel.select = t.Composite([PaginationSchema]);
154764
155088
  })(UomCategoryModel ||= {});
154765
- var model_default33 = UomCategoryModel;
155089
+ var model_default37 = UomCategoryModel;
154766
155090
 
154767
155091
  // src/routes/uom/category/index.ts
154768
155092
  var categoryRoutes = new Elysia({
@@ -154770,15 +155094,15 @@ var categoryRoutes = new Elysia({
154770
155094
  tags: ["UomCategory"]
154771
155095
  }).use(better_auth_default).guard({
154772
155096
  auth: true
154773
- }).get("/", async ({ query }) => logic_default33.select(query), {
154774
- query: model_default33.select
154775
- }).post("/", async ({ body }) => logic_default33.create(body), {
154776
- body: model_default33.create
155097
+ }).get("/", async ({ query }) => logic_default37.select(query), {
155098
+ query: model_default37.select
155099
+ }).post("/", async ({ body }) => logic_default37.create(body), {
155100
+ body: model_default37.create
154777
155101
  }).guard({
154778
155102
  params: IdSchema
154779
- }).put("/:id", async ({ body, params: { id } }) => logic_default33.update(id, body), {
154780
- body: model_default33.update
154781
- }).delete("/:id", async ({ params: { id } }) => logic_default33.remove(id));
155103
+ }).put("/:id", async ({ body, params: { id } }) => logic_default37.update(id, body), {
155104
+ body: model_default37.update
155105
+ }).delete("/:id", async ({ params: { id } }) => logic_default37.remove(id));
154782
155106
  var category_default = categoryRoutes;
154783
155107
 
154784
155108
  // src/routes/uom/conversion/logic.ts
@@ -154812,7 +155136,7 @@ var UomConversionLogic;
154812
155136
  }).where(and(eq(uomConversionTable.id, id)));
154813
155137
  };
154814
155138
  })(UomConversionLogic ||= {});
154815
- var logic_default34 = UomConversionLogic;
155139
+ var logic_default38 = UomConversionLogic;
154816
155140
 
154817
155141
  // src/routes/uom/conversion/model.ts
154818
155142
  var UomConversionModel;
@@ -154829,7 +155153,7 @@ var UomConversionModel;
154829
155153
  })
154830
155154
  ]);
154831
155155
  })(UomConversionModel ||= {});
154832
- var model_default34 = UomConversionModel;
155156
+ var model_default38 = UomConversionModel;
154833
155157
 
154834
155158
  // src/routes/uom/conversion/index.ts
154835
155159
  var conversionRoutes = new Elysia({
@@ -154837,15 +155161,15 @@ var conversionRoutes = new Elysia({
154837
155161
  tags: ["UomConversion"]
154838
155162
  }).use(better_auth_default).guard({
154839
155163
  auth: true
154840
- }).get("/", async ({ query }) => logic_default34.select(query), {
154841
- query: model_default34.select
154842
- }).post("/", async ({ body }) => logic_default34.create(body), {
154843
- body: model_default34.create
155164
+ }).get("/", async ({ query }) => logic_default38.select(query), {
155165
+ query: model_default38.select
155166
+ }).post("/", async ({ body }) => logic_default38.create(body), {
155167
+ body: model_default38.create
154844
155168
  }).guard({
154845
155169
  params: IdSchema
154846
- }).put("/:id", async ({ body, params: { id } }) => logic_default34.update(id, body), {
154847
- body: model_default34.update
154848
- }).delete("/:id", async ({ params: { id } }) => logic_default34.remove(id));
155170
+ }).put("/:id", async ({ body, params: { id } }) => logic_default38.update(id, body), {
155171
+ body: model_default38.update
155172
+ }).delete("/:id", async ({ params: { id } }) => logic_default38.remove(id));
154849
155173
  var conversion_default = conversionRoutes;
154850
155174
 
154851
155175
  // src/routes/uom/logic.ts
@@ -154879,7 +155203,7 @@ var UomLogic;
154879
155203
  }).where(and(eq(uomTable.id, id)));
154880
155204
  };
154881
155205
  })(UomLogic ||= {});
154882
- var logic_default35 = UomLogic;
155206
+ var logic_default39 = UomLogic;
154883
155207
 
154884
155208
  // src/routes/uom/model.ts
154885
155209
  var UomModel;
@@ -154895,25 +155219,25 @@ var UomModel;
154895
155219
  })
154896
155220
  ]);
154897
155221
  })(UomModel ||= {});
154898
- var model_default35 = UomModel;
155222
+ var model_default39 = UomModel;
154899
155223
 
154900
155224
  // src/routes/uom/index.ts
154901
155225
  var uomSchemaRoutes = new Elysia({
154902
155226
  prefix: "/uom"
154903
155227
  }).use(better_auth_default).use(category_default).use(conversion_default).guard({
154904
155228
  userKind: "ADMIN"
154905
- }).get("/", async ({ query }) => logic_default35.select(query), {
154906
- query: model_default35.select,
155229
+ }).get("/", async ({ query }) => logic_default39.select(query), {
155230
+ query: model_default39.select,
154907
155231
  tags: ["Uom"]
154908
- }).post("/", async ({ body }) => logic_default35.create(body), {
154909
- body: model_default35.create,
155232
+ }).post("/", async ({ body }) => logic_default39.create(body), {
155233
+ body: model_default39.create,
154910
155234
  tags: ["Uom"]
154911
155235
  }).guard({
154912
155236
  params: IdSchema
154913
- }).put("/:id", async ({ body, params: { id } }) => logic_default35.update(id, body), {
154914
- body: model_default35.update,
155237
+ }).put("/:id", async ({ body, params: { id } }) => logic_default39.update(id, body), {
155238
+ body: model_default39.update,
154915
155239
  tags: ["Uom"]
154916
- }).delete("/:id", async ({ params: { id } }) => logic_default35.remove(id), {
155240
+ }).delete("/:id", async ({ params: { id } }) => logic_default39.remove(id), {
154917
155241
  tags: ["Uom"]
154918
155242
  });
154919
155243
  var uom_default = uomSchemaRoutes;