autosync_backend2 1.2.31 → 1.2.33

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
@@ -1371,6 +1371,7 @@ export declare const app: Elysia<"", {
1371
1371
  oldId: number | null;
1372
1372
  }[];
1373
1373
  };
1374
+ 401: "Session not found";
1374
1375
  422: {
1375
1376
  type: "validation";
1376
1377
  on: string;
@@ -1407,6 +1408,7 @@ export declare const app: Elysia<"", {
1407
1408
  oldId: number | null;
1408
1409
  description: string | null;
1409
1410
  };
1411
+ 401: "Session not found";
1410
1412
  422: {
1411
1413
  type: "validation";
1412
1414
  on: string;
@@ -1445,6 +1447,7 @@ export declare const app: Elysia<"", {
1445
1447
  deletedAt: string | null;
1446
1448
  oldId: number | null;
1447
1449
  };
1450
+ 401: "Session not found";
1448
1451
  404: "Агуулах олдсонгүй.";
1449
1452
  422: {
1450
1453
  type: "validation";
@@ -1470,6 +1473,7 @@ export declare const app: Elysia<"", {
1470
1473
  query: unknown;
1471
1474
  headers: unknown;
1472
1475
  response: {
1476
+ 401: "Session not found";
1473
1477
  422: {
1474
1478
  type: "validation";
1475
1479
  on: string;
@@ -4394,6 +4398,7 @@ export declare const app: Elysia<"", {
4394
4398
  timeCompleted: string | null;
4395
4399
  km: number;
4396
4400
  type: "Service" | "ProductSell";
4401
+ description: string | null;
4397
4402
  id: string;
4398
4403
  createdAt: string;
4399
4404
  updatedAt: string;
@@ -4513,6 +4518,7 @@ export declare const app: Elysia<"", {
4513
4518
  timeCompleted: string | null;
4514
4519
  km: number;
4515
4520
  type: "Service" | "ProductSell";
4521
+ description: string | null;
4516
4522
  id: string;
4517
4523
  createdAt: string;
4518
4524
  updatedAt: string;
@@ -4625,6 +4631,7 @@ export declare const app: Elysia<"", {
4625
4631
  companyId: string;
4626
4632
  deletedAt: string | null;
4627
4633
  oldId: number | null;
4634
+ description: string | null;
4628
4635
  isNoat: boolean | null;
4629
4636
  companyBranchId: string;
4630
4637
  customerId: string | null;
@@ -4728,6 +4735,7 @@ export declare const app: Elysia<"", {
4728
4735
  timeCompleted: string | null;
4729
4736
  km: number;
4730
4737
  type: "Service" | "ProductSell";
4738
+ description: string | null;
4731
4739
  id: string;
4732
4740
  createdAt: string;
4733
4741
  updatedAt: string;
@@ -4771,6 +4779,7 @@ export declare const app: Elysia<"", {
4771
4779
  type?: "Service" | "ProductSell" | undefined;
4772
4780
  companyId?: string | undefined;
4773
4781
  oldId?: number | null | undefined;
4782
+ description?: string | null | undefined;
4774
4783
  isNoat?: boolean | null | undefined;
4775
4784
  companyBranchId?: string | undefined;
4776
4785
  customerId?: string | null | undefined;
@@ -4797,6 +4806,7 @@ export declare const app: Elysia<"", {
4797
4806
  timeCompleted: string | null;
4798
4807
  km: number;
4799
4808
  type: "Service" | "ProductSell";
4809
+ description: string | null;
4800
4810
  id: string;
4801
4811
  createdAt: string;
4802
4812
  updatedAt: string;
@@ -7246,6 +7256,7 @@ export declare const app: Elysia<"", {
7246
7256
  timeCompleted: string | null;
7247
7257
  km: number;
7248
7258
  type: "Service" | "ProductSell";
7259
+ description: string | null;
7249
7260
  id: string;
7250
7261
  createdAt: string;
7251
7262
  updatedAt: string;
@@ -7484,6 +7495,7 @@ export declare const app: Elysia<"", {
7484
7495
  timeCompleted: string | null;
7485
7496
  km: number;
7486
7497
  type: "Service" | "ProductSell";
7498
+ description: string | null;
7487
7499
  id: string;
7488
7500
  createdAt: string;
7489
7501
  updatedAt: string;
@@ -8798,9 +8810,8 @@ export declare const app: Elysia<"", {
8798
8810
  mileageKm: number | null;
8799
8811
  state: "CREATED" | "SCHEDULED" | "IN_PROGRESS" | "COMPLETED";
8800
8812
  stateResult: "FAILED" | "NOT_INSPECTED" | "PASSED" | "RETURNED" | "WAIVED" | null;
8801
- timeScheduled: Date;
8802
- timeStarted: Date;
8803
- timeCompleted: Date;
8813
+ timeScheduled: Date | null;
8814
+ timeCompleted: Date | null;
8804
8815
  note: string | null;
8805
8816
  id: string;
8806
8817
  createdAt: string;
@@ -8833,22 +8844,20 @@ export declare const app: Elysia<"", {
8833
8844
  body: {
8834
8845
  oldId?: number | null | undefined;
8835
8846
  state?: "CREATED" | "SCHEDULED" | "IN_PROGRESS" | "COMPLETED" | undefined;
8847
+ timeCompleted?: Date | null | undefined;
8836
8848
  note?: string | null | undefined;
8837
8849
  hours?: number | null | undefined;
8838
8850
  mileageKm?: number | null | undefined;
8839
8851
  stateResult?: "FAILED" | "NOT_INSPECTED" | "PASSED" | "RETURNED" | "WAIVED" | null | undefined;
8840
- timeCompleted: Date;
8852
+ timeScheduled?: Date | null | undefined;
8841
8853
  templateId: string;
8842
8854
  machineId: string;
8843
- employeeInspectedId: string;
8844
- userInspectedId: string;
8845
- timeScheduled: Date;
8846
- timeStarted: Date;
8847
8855
  };
8848
8856
  params: {};
8849
8857
  query: unknown;
8850
8858
  headers: unknown;
8851
8859
  response: {
8860
+ 400: "Ажилтны мэдээлэл шаардлагатай.";
8852
8861
  401: "Session not found";
8853
8862
  422: {
8854
8863
  type: "validation";
package/dist/index.js CHANGED
@@ -142906,7 +142906,8 @@ var crmCpOrderTable = crmSchema.table("cp_order", {
142906
142906
  mode: "string"
142907
142907
  }),
142908
142908
  km: integer2().notNull().default(0),
142909
- type: crmCpOrderTypeEnum().default("Service").notNull()
142909
+ type: crmCpOrderTypeEnum().default("Service").notNull(),
142910
+ description: text()
142910
142911
  }, (t2) => [
142911
142912
  index().on(t2.companyId),
142912
142913
  index().on(t2.companyBranchId),
@@ -143125,9 +143126,8 @@ var inspectionTable = inspectionSchema.table("inspection", {
143125
143126
  stateResult: inspectionStateResultEnum(),
143126
143127
  timeScheduled: timestamp({
143127
143128
  withTimezone: true
143128
- }).notNull(),
143129
- timeStarted: timestamp({ withTimezone: true }).notNull(),
143130
- timeCompleted: timestamp({ withTimezone: true }).notNull(),
143129
+ }),
143130
+ timeCompleted: timestamp({ withTimezone: true }),
143131
143131
  note: text()
143132
143132
  });
143133
143133
  var inspectionFieldResult = inspectionSchema.table("field_result", {
@@ -154096,7 +154096,7 @@ var WarehouseWarehouseLogic;
154096
154096
  ((WarehouseWarehouseLogic) => {
154097
154097
  WarehouseWarehouseLogic.select = async (query, user2) => {
154098
154098
  const columns = getTableColumns(warehouseWarehouseTable);
154099
- const filter = and(eq(warehouseWarehouseTable.companyId, user2.companyId), eq(warehouseWarehouseTable.branchId, query.branchId ?? user2.branchId).if(query.branchId && user2.kind === "COMPANY_ADMIN"), softDeletedFilter(warehouseWarehouseTable));
154099
+ const filter = and(eq(warehouseWarehouseTable.companyId, user2.companyId), eq(warehouseWarehouseTable.branchId, query.branchId ?? user2.branchId), softDeletedFilter(warehouseWarehouseTable));
154100
154100
  const baseQuery = db_default.select({
154101
154101
  ...columns,
154102
154102
  totalCount: totalCountSql
@@ -154156,8 +154156,10 @@ var model_default24 = WarehouseWarehouseModel;
154156
154156
  var warehouseRoutes = new Elysia({
154157
154157
  prefix: "/warehouse",
154158
154158
  tags: ["Warehouse"]
154159
- }).use(better_auth_default).guard({ userKind: "COMPANY_ADMIN" }).get("/", async ({ query, user: user2 }) => logic_default24.select(query, user2), {
154159
+ }).use(better_auth_default).guard({ auth: true }).get("/", async ({ query, user: user2 }) => logic_default24.select(query, user2), {
154160
154160
  query: model_default24.select
154161
+ }).guard({
154162
+ userKind: "COMPANY_ADMIN"
154161
154163
  }).post("/", async ({ body, user: user2 }) => logic_default24.create(body, user2), {
154162
154164
  body: model_default24.create
154163
154165
  }).guard({
@@ -154304,8 +154306,15 @@ var InspectionLogic;
154304
154306
  const result = await pagination_helper_default(baseQuery, query.pagination);
154305
154307
  return getPaginationContent(result, query.pagination.size);
154306
154308
  };
154307
- InspectionLogic.create = async (body) => {
154308
- await db_default.insert(inspectionTable).values(body);
154309
+ InspectionLogic.create = async (body, user2) => {
154310
+ if (!user2.employeeId) {
154311
+ return status("Bad Request", "\u0410\u0436\u0438\u043B\u0442\u043D\u044B \u043C\u044D\u0434\u044D\u044D\u043B\u044D\u043B \u0448\u0430\u0430\u0440\u0434\u043B\u0430\u0433\u0430\u0442\u0430\u0439.");
154312
+ }
154313
+ await db_default.insert(inspectionTable).values({
154314
+ ...body,
154315
+ employeeInspectedId: user2.employeeId,
154316
+ userInspectedId: user2.id
154317
+ });
154309
154318
  };
154310
154319
  InspectionLogic.update = async (id, body) => {
154311
154320
  await db_default.update(inspectionTable).set(body).where(eq(inspectionTable.id, id));
@@ -154321,7 +154330,10 @@ var InspectionModel;
154321
154330
  ((InspectionModel) => {
154322
154331
  const createSchema = createInsertSchema2(inspectionTable);
154323
154332
  const updateSchema = createUpdateSchema(inspectionTable);
154324
- InspectionModel.create = OmitBaseSchema(createSchema);
154333
+ InspectionModel.create = t.Omit(OmitBaseSchema(createSchema), [
154334
+ "employeeInspectedId",
154335
+ "userInspectedId"
154336
+ ]);
154325
154337
  InspectionModel.update = OmitBaseSchema(updateSchema);
154326
154338
  InspectionModel.select = t.Composite([
154327
154339
  PaginationSchema,
@@ -154488,7 +154500,7 @@ var inspectionRoutes2 = new Elysia({
154488
154500
  prefix: "/inspection"
154489
154501
  }).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), {
154490
154502
  query: model_default27.select
154491
- }).post("/", async ({ body }) => logic_default27.create(body), {
154503
+ }).post("/", async ({ body, user: user2 }) => logic_default27.create(body, user2), {
154492
154504
  body: model_default27.create
154493
154505
  });
154494
154506
  var inspection_default2 = inspectionRoutes2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autosync_backend2",
3
- "version": "1.2.31",
3
+ "version": "1.2.33",
4
4
  "module": "src/index.ts",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",