autosync_backend2 1.2.32 → 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
@@ -8810,9 +8810,8 @@ export declare const app: Elysia<"", {
8810
8810
  mileageKm: number | null;
8811
8811
  state: "CREATED" | "SCHEDULED" | "IN_PROGRESS" | "COMPLETED";
8812
8812
  stateResult: "FAILED" | "NOT_INSPECTED" | "PASSED" | "RETURNED" | "WAIVED" | null;
8813
- timeScheduled: Date;
8814
- timeStarted: Date;
8815
- timeCompleted: Date;
8813
+ timeScheduled: Date | null;
8814
+ timeCompleted: Date | null;
8816
8815
  note: string | null;
8817
8816
  id: string;
8818
8817
  createdAt: string;
@@ -8845,22 +8844,20 @@ export declare const app: Elysia<"", {
8845
8844
  body: {
8846
8845
  oldId?: number | null | undefined;
8847
8846
  state?: "CREATED" | "SCHEDULED" | "IN_PROGRESS" | "COMPLETED" | undefined;
8847
+ timeCompleted?: Date | null | undefined;
8848
8848
  note?: string | null | undefined;
8849
8849
  hours?: number | null | undefined;
8850
8850
  mileageKm?: number | null | undefined;
8851
8851
  stateResult?: "FAILED" | "NOT_INSPECTED" | "PASSED" | "RETURNED" | "WAIVED" | null | undefined;
8852
- timeCompleted: Date;
8852
+ timeScheduled?: Date | null | undefined;
8853
8853
  templateId: string;
8854
8854
  machineId: string;
8855
- employeeInspectedId: string;
8856
- userInspectedId: string;
8857
- timeScheduled: Date;
8858
- timeStarted: Date;
8859
8855
  };
8860
8856
  params: {};
8861
8857
  query: unknown;
8862
8858
  headers: unknown;
8863
8859
  response: {
8860
+ 400: "Ажилтны мэдээлэл шаардлагатай.";
8864
8861
  401: "Session not found";
8865
8862
  422: {
8866
8863
  type: "validation";
package/dist/index.js CHANGED
@@ -143126,9 +143126,8 @@ var inspectionTable = inspectionSchema.table("inspection", {
143126
143126
  stateResult: inspectionStateResultEnum(),
143127
143127
  timeScheduled: timestamp({
143128
143128
  withTimezone: true
143129
- }).notNull(),
143130
- timeStarted: timestamp({ withTimezone: true }).notNull(),
143131
- timeCompleted: timestamp({ withTimezone: true }).notNull(),
143129
+ }),
143130
+ timeCompleted: timestamp({ withTimezone: true }),
143132
143131
  note: text()
143133
143132
  });
143134
143133
  var inspectionFieldResult = inspectionSchema.table("field_result", {
@@ -154307,8 +154306,15 @@ var InspectionLogic;
154307
154306
  const result = await pagination_helper_default(baseQuery, query.pagination);
154308
154307
  return getPaginationContent(result, query.pagination.size);
154309
154308
  };
154310
- InspectionLogic.create = async (body) => {
154311
- 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
+ });
154312
154318
  };
154313
154319
  InspectionLogic.update = async (id, body) => {
154314
154320
  await db_default.update(inspectionTable).set(body).where(eq(inspectionTable.id, id));
@@ -154324,7 +154330,10 @@ var InspectionModel;
154324
154330
  ((InspectionModel) => {
154325
154331
  const createSchema = createInsertSchema2(inspectionTable);
154326
154332
  const updateSchema = createUpdateSchema(inspectionTable);
154327
- InspectionModel.create = OmitBaseSchema(createSchema);
154333
+ InspectionModel.create = t.Omit(OmitBaseSchema(createSchema), [
154334
+ "employeeInspectedId",
154335
+ "userInspectedId"
154336
+ ]);
154328
154337
  InspectionModel.update = OmitBaseSchema(updateSchema);
154329
154338
  InspectionModel.select = t.Composite([
154330
154339
  PaginationSchema,
@@ -154491,7 +154500,7 @@ var inspectionRoutes2 = new Elysia({
154491
154500
  prefix: "/inspection"
154492
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), {
154493
154502
  query: model_default27.select
154494
- }).post("/", async ({ body }) => logic_default27.create(body), {
154503
+ }).post("/", async ({ body, user: user2 }) => logic_default27.create(body, user2), {
154495
154504
  body: model_default27.create
154496
154505
  });
154497
154506
  var inspection_default2 = inspectionRoutes2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autosync_backend2",
3
- "version": "1.2.32",
3
+ "version": "1.2.33",
4
4
  "module": "src/index.ts",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",