autosync_backend2 1.2.32 → 1.2.34
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 +6 -8
- package/dist/index.js +20 -10
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -8785,6 +8785,7 @@ export declare const app: Elysia<"", {
|
|
|
8785
8785
|
body: unknown;
|
|
8786
8786
|
params: {};
|
|
8787
8787
|
query: {
|
|
8788
|
+
id?: string | undefined;
|
|
8788
8789
|
state?: "CREATED" | "SCHEDULED" | "IN_PROGRESS" | "COMPLETED" | undefined;
|
|
8789
8790
|
templateId?: string | undefined;
|
|
8790
8791
|
machineId?: string | undefined;
|
|
@@ -8810,9 +8811,8 @@ export declare const app: Elysia<"", {
|
|
|
8810
8811
|
mileageKm: number | null;
|
|
8811
8812
|
state: "CREATED" | "SCHEDULED" | "IN_PROGRESS" | "COMPLETED";
|
|
8812
8813
|
stateResult: "FAILED" | "NOT_INSPECTED" | "PASSED" | "RETURNED" | "WAIVED" | null;
|
|
8813
|
-
timeScheduled: Date;
|
|
8814
|
-
|
|
8815
|
-
timeCompleted: Date;
|
|
8814
|
+
timeScheduled: Date | null;
|
|
8815
|
+
timeCompleted: Date | null;
|
|
8816
8816
|
note: string | null;
|
|
8817
8817
|
id: string;
|
|
8818
8818
|
createdAt: string;
|
|
@@ -8845,22 +8845,20 @@ export declare const app: Elysia<"", {
|
|
|
8845
8845
|
body: {
|
|
8846
8846
|
oldId?: number | null | undefined;
|
|
8847
8847
|
state?: "CREATED" | "SCHEDULED" | "IN_PROGRESS" | "COMPLETED" | undefined;
|
|
8848
|
+
timeCompleted?: Date | null | undefined;
|
|
8848
8849
|
note?: string | null | undefined;
|
|
8849
8850
|
hours?: number | null | undefined;
|
|
8850
8851
|
mileageKm?: number | null | undefined;
|
|
8851
8852
|
stateResult?: "FAILED" | "NOT_INSPECTED" | "PASSED" | "RETURNED" | "WAIVED" | null | undefined;
|
|
8852
|
-
|
|
8853
|
+
timeScheduled?: Date | null | undefined;
|
|
8853
8854
|
templateId: string;
|
|
8854
8855
|
machineId: string;
|
|
8855
|
-
employeeInspectedId: string;
|
|
8856
|
-
userInspectedId: string;
|
|
8857
|
-
timeScheduled: Date;
|
|
8858
|
-
timeStarted: Date;
|
|
8859
8856
|
};
|
|
8860
8857
|
params: {};
|
|
8861
8858
|
query: unknown;
|
|
8862
8859
|
headers: unknown;
|
|
8863
8860
|
response: {
|
|
8861
|
+
400: "Ажилтны мэдээлэл шаардлагатай.";
|
|
8864
8862
|
401: "Session not found";
|
|
8865
8863
|
422: {
|
|
8866
8864
|
type: "validation";
|
package/dist/index.js
CHANGED
|
@@ -143119,16 +143119,15 @@ var inspectionTable = inspectionSchema.table("inspection", {
|
|
|
143119
143119
|
machineId: uuid5().notNull(),
|
|
143120
143120
|
templateId: uuid5().notNull(),
|
|
143121
143121
|
employeeInspectedId: uuid5().notNull(),
|
|
143122
|
-
userInspectedId:
|
|
143122
|
+
userInspectedId: text().notNull(),
|
|
143123
143123
|
hours: numeric({ mode: "number" }),
|
|
143124
143124
|
mileageKm: numeric({ mode: "number" }),
|
|
143125
143125
|
state: inspectionStateEnum().notNull().default("CREATED"),
|
|
143126
143126
|
stateResult: inspectionStateResultEnum(),
|
|
143127
143127
|
timeScheduled: timestamp({
|
|
143128
143128
|
withTimezone: true
|
|
143129
|
-
})
|
|
143130
|
-
|
|
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", {
|
|
@@ -154296,7 +154295,7 @@ var fieldGroup_default = fieldGroupRoutes;
|
|
|
154296
154295
|
var InspectionLogic;
|
|
154297
154296
|
((InspectionLogic) => {
|
|
154298
154297
|
InspectionLogic.select = async (query, user2) => {
|
|
154299
|
-
const filter = and(eq(inspectionTable.machineId, query.machineId).if(query.machineId), eq(inspectionTable.templateId, query.templateId).if(query.templateId), eq(inspectionTable.state, query.state).if(query.state), gte(inspectionTable.createdAt, query.startDate).if(query.startDate), lte(inspectionTable.createdAt, query.endDate).if(query.endDate), eq(inspectionTemplateTable.companyId, user2.companyId));
|
|
154298
|
+
const filter = and(eq(inspectionTable.machineId, query.machineId).if(query.machineId), eq(inspectionTable.templateId, query.templateId).if(query.templateId), eq(inspectionTable.state, query.state).if(query.state), gte(inspectionTable.createdAt, query.startDate).if(query.startDate), lte(inspectionTable.createdAt, query.endDate).if(query.endDate), eq(inspectionTable.id, query.id).if(query.id), or(eq(inspectionTemplateTable.companyId, user2.companyId), isNull2(inspectionTemplateTable.companyId)));
|
|
154300
154299
|
const baseQuery = db_default.select({
|
|
154301
154300
|
inspection: inspectionTable,
|
|
154302
154301
|
totalCount: totalCountSql,
|
|
@@ -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
|
-
|
|
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,
|
|
@@ -154335,7 +154344,8 @@ var InspectionModel;
|
|
|
154335
154344
|
default: undefined
|
|
154336
154345
|
}),
|
|
154337
154346
|
startDate: t.String({ format: "date" }),
|
|
154338
|
-
endDate: t.String({ format: "date" })
|
|
154347
|
+
endDate: t.String({ format: "date" }),
|
|
154348
|
+
id: t.String({ format: "uuid" })
|
|
154339
154349
|
}))
|
|
154340
154350
|
]);
|
|
154341
154351
|
})(InspectionModel ||= {});
|
|
@@ -154491,7 +154501,7 @@ var inspectionRoutes2 = new Elysia({
|
|
|
154491
154501
|
prefix: "/inspection"
|
|
154492
154502
|
}).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
154503
|
query: model_default27.select
|
|
154494
|
-
}).post("/", async ({ body }) => logic_default27.create(body), {
|
|
154504
|
+
}).post("/", async ({ body, user: user2 }) => logic_default27.create(body, user2).catch((err2) => console.error(err2)), {
|
|
154495
154505
|
body: model_default27.create
|
|
154496
154506
|
});
|
|
154497
154507
|
var inspection_default2 = inspectionRoutes2;
|