autosync_backend2 1.2.38 → 1.2.39
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 +57 -0
- package/dist/index.js +14 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -8959,6 +8959,63 @@ export declare const app: Elysia<"", {
|
|
|
8959
8959
|
};
|
|
8960
8960
|
};
|
|
8961
8961
|
};
|
|
8962
|
+
} & {
|
|
8963
|
+
inspection: {
|
|
8964
|
+
":id": {
|
|
8965
|
+
put: {
|
|
8966
|
+
body: {
|
|
8967
|
+
oldId?: number | null | undefined;
|
|
8968
|
+
state?: "CREATED" | "SCHEDULED" | "IN_PROGRESS" | "COMPLETED" | undefined;
|
|
8969
|
+
timeCompleted?: Date | null | undefined;
|
|
8970
|
+
note?: string | null | undefined;
|
|
8971
|
+
templateId?: string | undefined;
|
|
8972
|
+
machineId?: string | undefined;
|
|
8973
|
+
employeeInspectedId?: string | undefined;
|
|
8974
|
+
userInspectedId?: string | undefined;
|
|
8975
|
+
hours?: number | null | undefined;
|
|
8976
|
+
mileageKm?: number | null | undefined;
|
|
8977
|
+
stateResult?: "FAILED" | "NOT_INSPECTED" | "PASSED" | "RETURNED" | "WAIVED" | null | undefined;
|
|
8978
|
+
timeScheduled?: Date | null | undefined;
|
|
8979
|
+
};
|
|
8980
|
+
params: {
|
|
8981
|
+
id: string;
|
|
8982
|
+
};
|
|
8983
|
+
query: unknown;
|
|
8984
|
+
headers: unknown;
|
|
8985
|
+
response: {
|
|
8986
|
+
200: {
|
|
8987
|
+
machineId: string;
|
|
8988
|
+
templateId: string;
|
|
8989
|
+
employeeInspectedId: string;
|
|
8990
|
+
userInspectedId: string;
|
|
8991
|
+
hours: number | null;
|
|
8992
|
+
mileageKm: number | null;
|
|
8993
|
+
state: "CREATED" | "SCHEDULED" | "IN_PROGRESS" | "COMPLETED";
|
|
8994
|
+
stateResult: "FAILED" | "NOT_INSPECTED" | "PASSED" | "RETURNED" | "WAIVED" | null;
|
|
8995
|
+
timeScheduled: Date | null;
|
|
8996
|
+
timeCompleted: Date | null;
|
|
8997
|
+
note: string | null;
|
|
8998
|
+
id: string;
|
|
8999
|
+
createdAt: string;
|
|
9000
|
+
updatedAt: string;
|
|
9001
|
+
deletedAt: string | null;
|
|
9002
|
+
oldId: number | null;
|
|
9003
|
+
};
|
|
9004
|
+
401: "Session not found";
|
|
9005
|
+
404: "Хяналтын үзлэг олдсонгүй.";
|
|
9006
|
+
422: {
|
|
9007
|
+
type: "validation";
|
|
9008
|
+
on: string;
|
|
9009
|
+
summary?: string;
|
|
9010
|
+
message?: string;
|
|
9011
|
+
found?: unknown;
|
|
9012
|
+
property?: string;
|
|
9013
|
+
expected?: string;
|
|
9014
|
+
};
|
|
9015
|
+
};
|
|
9016
|
+
};
|
|
9017
|
+
};
|
|
9018
|
+
};
|
|
8962
9019
|
};
|
|
8963
9020
|
} & {
|
|
8964
9021
|
fleet: {
|
package/dist/index.js
CHANGED
|
@@ -146989,7 +146989,7 @@ var branchRoutes = new Elysia({
|
|
|
146989
146989
|
}).get("/", async ({ query }) => await service2.get(query), {
|
|
146990
146990
|
query: model_default2.select,
|
|
146991
146991
|
userKind: "COMPANY_ADMIN"
|
|
146992
|
-
}).get("/me", async ({ user: user2 }) =>
|
|
146992
|
+
}).get("/me", async ({ user: user2 }) => service2.get({
|
|
146993
146993
|
id: user2.branchId,
|
|
146994
146994
|
pagination: {
|
|
146995
146995
|
page: 1,
|
|
@@ -154317,14 +154317,21 @@ var InspectionLogic;
|
|
|
154317
154317
|
if (!user2.employeeId) {
|
|
154318
154318
|
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.");
|
|
154319
154319
|
}
|
|
154320
|
-
await db_default.insert(inspectionTable).values({
|
|
154320
|
+
const [res] = await db_default.insert(inspectionTable).values({
|
|
154321
154321
|
...body,
|
|
154322
154322
|
employeeInspectedId: user2.employeeId,
|
|
154323
154323
|
userInspectedId: user2.id
|
|
154324
|
+
}).returning({
|
|
154325
|
+
id: inspectionTable.id
|
|
154324
154326
|
});
|
|
154327
|
+
return res.id;
|
|
154325
154328
|
};
|
|
154326
154329
|
InspectionLogic.update = async (id, body) => {
|
|
154327
|
-
await db_default.update(inspectionTable).set(body).where(eq(inspectionTable.id, id));
|
|
154330
|
+
const [result] = await db_default.update(inspectionTable).set(body).where(eq(inspectionTable.id, id)).returning();
|
|
154331
|
+
if (!result) {
|
|
154332
|
+
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.");
|
|
154333
|
+
}
|
|
154334
|
+
return result;
|
|
154328
154335
|
};
|
|
154329
154336
|
InspectionLogic.remove = async (id) => {
|
|
154330
154337
|
await db_default.delete(inspectionTable).where(eq(inspectionTable.id, id));
|
|
@@ -154510,6 +154517,10 @@ var inspectionRoutes2 = new Elysia({
|
|
|
154510
154517
|
query: model_default27.select
|
|
154511
154518
|
}).post("/", async ({ body, user: user2 }) => logic_default27.create(body, user2).catch((err2) => console.error(err2)), {
|
|
154512
154519
|
body: model_default27.create
|
|
154520
|
+
}).guard({
|
|
154521
|
+
params: IdSchema
|
|
154522
|
+
}).put("/:id", async ({ body, params: { id } }) => logic_default27.update(id, body), {
|
|
154523
|
+
body: model_default27.update
|
|
154513
154524
|
});
|
|
154514
154525
|
var inspection_default2 = inspectionRoutes2;
|
|
154515
154526
|
|