autosync_backend2 1.2.40 → 1.2.42
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/env.d.ts +4 -0
- package/dist/index.d.ts +159 -9
- package/dist/index.js +182 -85
- package/package.json +1 -1
package/dist/env.d.ts
CHANGED
|
@@ -10,6 +10,10 @@ declare const EnvSchema: import("@sinclair/typebox").TObject<{
|
|
|
10
10
|
ATUT_TOKEN: import("@sinclair/typebox").TString;
|
|
11
11
|
AWS_ACCESS_KEY: import("@sinclair/typebox").TString;
|
|
12
12
|
AWS_SECRET_KEY: import("@sinclair/typebox").TString;
|
|
13
|
+
MBANK_CLIENT_ID: import("@sinclair/typebox").TString;
|
|
14
|
+
MBANK_CLIENT_SECRET: import("@sinclair/typebox").TString;
|
|
15
|
+
MBANK_USERNAME: import("@sinclair/typebox").TString;
|
|
16
|
+
MBANK_PASSWORD: import("@sinclair/typebox").TString;
|
|
13
17
|
}>;
|
|
14
18
|
export type env = typeof EnvSchema.static;
|
|
15
19
|
declare let env: env;
|
package/dist/index.d.ts
CHANGED
|
@@ -8873,6 +8873,130 @@ export declare const app: Elysia<"", {
|
|
|
8873
8873
|
};
|
|
8874
8874
|
};
|
|
8875
8875
|
};
|
|
8876
|
+
} & {
|
|
8877
|
+
inspection: {
|
|
8878
|
+
"field-result": {};
|
|
8879
|
+
} & {
|
|
8880
|
+
"field-result": {
|
|
8881
|
+
get: {
|
|
8882
|
+
body: unknown;
|
|
8883
|
+
params: {};
|
|
8884
|
+
query: {
|
|
8885
|
+
pagination: {
|
|
8886
|
+
size: number;
|
|
8887
|
+
page: number;
|
|
8888
|
+
};
|
|
8889
|
+
inspectionId: string;
|
|
8890
|
+
};
|
|
8891
|
+
headers: unknown;
|
|
8892
|
+
response: {
|
|
8893
|
+
200: {
|
|
8894
|
+
totalCount: number;
|
|
8895
|
+
totalPage: number;
|
|
8896
|
+
result: Omit<{
|
|
8897
|
+
totalCount: number;
|
|
8898
|
+
inspectionId: string;
|
|
8899
|
+
templateFieldId: string;
|
|
8900
|
+
result: string | null;
|
|
8901
|
+
numeric: number | null;
|
|
8902
|
+
comment: string | null;
|
|
8903
|
+
severityLevel: number | null;
|
|
8904
|
+
id: string;
|
|
8905
|
+
createdAt: string;
|
|
8906
|
+
updatedAt: string;
|
|
8907
|
+
deletedAt: string | null;
|
|
8908
|
+
oldId: number | null;
|
|
8909
|
+
}, "totalCount">[];
|
|
8910
|
+
};
|
|
8911
|
+
401: "Session not found";
|
|
8912
|
+
422: {
|
|
8913
|
+
type: "validation";
|
|
8914
|
+
on: string;
|
|
8915
|
+
summary?: string;
|
|
8916
|
+
message?: string;
|
|
8917
|
+
found?: unknown;
|
|
8918
|
+
property?: string;
|
|
8919
|
+
expected?: string;
|
|
8920
|
+
};
|
|
8921
|
+
};
|
|
8922
|
+
};
|
|
8923
|
+
};
|
|
8924
|
+
} & {
|
|
8925
|
+
"field-result": {
|
|
8926
|
+
"create-or-update": {
|
|
8927
|
+
post: {
|
|
8928
|
+
body: {
|
|
8929
|
+
oldId?: number | null | undefined;
|
|
8930
|
+
result?: string | null | undefined;
|
|
8931
|
+
numeric?: number | null | undefined;
|
|
8932
|
+
comment?: string | null | undefined;
|
|
8933
|
+
severityLevel?: number | null | undefined;
|
|
8934
|
+
inspectionId: string;
|
|
8935
|
+
templateFieldId: string;
|
|
8936
|
+
}[];
|
|
8937
|
+
params: {};
|
|
8938
|
+
query: unknown;
|
|
8939
|
+
headers: unknown;
|
|
8940
|
+
response: {
|
|
8941
|
+
200: {
|
|
8942
|
+
inspectionId: string;
|
|
8943
|
+
templateFieldId: string;
|
|
8944
|
+
result: string | null;
|
|
8945
|
+
numeric: number | null;
|
|
8946
|
+
comment: string | null;
|
|
8947
|
+
severityLevel: number | null;
|
|
8948
|
+
id: string;
|
|
8949
|
+
createdAt: string;
|
|
8950
|
+
updatedAt: string;
|
|
8951
|
+
deletedAt: string | null;
|
|
8952
|
+
oldId: number | null;
|
|
8953
|
+
}[];
|
|
8954
|
+
400: "Хяналтын үр дүн оруулах мэдээлэл байхгүй байна." | "Бүх үр дүн нь ижил хяналтын үзлэгт хамаарах ёстой.";
|
|
8955
|
+
401: "Session not found";
|
|
8956
|
+
422: {
|
|
8957
|
+
type: "validation";
|
|
8958
|
+
on: string;
|
|
8959
|
+
summary?: string;
|
|
8960
|
+
message?: string;
|
|
8961
|
+
found?: unknown;
|
|
8962
|
+
property?: string;
|
|
8963
|
+
expected?: string;
|
|
8964
|
+
};
|
|
8965
|
+
};
|
|
8966
|
+
};
|
|
8967
|
+
};
|
|
8968
|
+
};
|
|
8969
|
+
} & {
|
|
8970
|
+
"field-result": {
|
|
8971
|
+
inspection: {
|
|
8972
|
+
":id": {
|
|
8973
|
+
all: {
|
|
8974
|
+
delete: {
|
|
8975
|
+
body: unknown;
|
|
8976
|
+
params: {
|
|
8977
|
+
id: string;
|
|
8978
|
+
};
|
|
8979
|
+
query: unknown;
|
|
8980
|
+
headers: unknown;
|
|
8981
|
+
response: {
|
|
8982
|
+
401: "Session not found";
|
|
8983
|
+
404: "Хяналтын үзлэг олдсонгүй.";
|
|
8984
|
+
422: {
|
|
8985
|
+
type: "validation";
|
|
8986
|
+
on: string;
|
|
8987
|
+
summary?: string;
|
|
8988
|
+
message?: string;
|
|
8989
|
+
found?: unknown;
|
|
8990
|
+
property?: string;
|
|
8991
|
+
expected?: string;
|
|
8992
|
+
};
|
|
8993
|
+
};
|
|
8994
|
+
};
|
|
8995
|
+
};
|
|
8996
|
+
};
|
|
8997
|
+
};
|
|
8998
|
+
};
|
|
8999
|
+
};
|
|
8876
9000
|
} & {
|
|
8877
9001
|
inspection: {
|
|
8878
9002
|
template: {};
|
|
@@ -9515,16 +9639,42 @@ export declare const app: Elysia<"", {
|
|
|
9515
9639
|
totalCount: number;
|
|
9516
9640
|
totalPage: number;
|
|
9517
9641
|
result: Omit<{
|
|
9642
|
+
product: {
|
|
9643
|
+
pmTemplateId: string;
|
|
9644
|
+
productKindId: string;
|
|
9645
|
+
quantity: number | null;
|
|
9646
|
+
uomId: string;
|
|
9647
|
+
id: string;
|
|
9648
|
+
createdAt: string;
|
|
9649
|
+
updatedAt: string;
|
|
9650
|
+
deletedAt: string | null;
|
|
9651
|
+
oldId: number | null;
|
|
9652
|
+
};
|
|
9653
|
+
productKind: {
|
|
9654
|
+
productCategoryId: string;
|
|
9655
|
+
name: string;
|
|
9656
|
+
description: string | null;
|
|
9657
|
+
id: string;
|
|
9658
|
+
createdAt: string;
|
|
9659
|
+
updatedAt: string;
|
|
9660
|
+
deletedAt: string | null;
|
|
9661
|
+
oldId: number | null;
|
|
9662
|
+
} | null;
|
|
9663
|
+
uom: {
|
|
9664
|
+
uomCategoryId: string;
|
|
9665
|
+
code: string | null;
|
|
9666
|
+
name: string;
|
|
9667
|
+
description: string | null;
|
|
9668
|
+
symbol: string | null;
|
|
9669
|
+
isBaseUnit: boolean;
|
|
9670
|
+
baseFactor: number | null;
|
|
9671
|
+
id: string;
|
|
9672
|
+
createdAt: string;
|
|
9673
|
+
updatedAt: string;
|
|
9674
|
+
deletedAt: string | null;
|
|
9675
|
+
oldId: number | null;
|
|
9676
|
+
} | null;
|
|
9518
9677
|
totalCount: number;
|
|
9519
|
-
pmTemplateId: string;
|
|
9520
|
-
productKindId: string;
|
|
9521
|
-
quantity: number | null;
|
|
9522
|
-
uomId: string;
|
|
9523
|
-
id: string;
|
|
9524
|
-
createdAt: string;
|
|
9525
|
-
updatedAt: string;
|
|
9526
|
-
deletedAt: string | null;
|
|
9527
|
-
oldId: number | null;
|
|
9528
9678
|
}, "totalCount">[];
|
|
9529
9679
|
};
|
|
9530
9680
|
422: {
|
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 {
|
|
@@ -152404,7 +152408,7 @@ var CrmInspectionLogic;
|
|
|
152404
152408
|
status: crmInspectionTable.status
|
|
152405
152409
|
}
|
|
152406
152410
|
}).from(crmInspectionTable).where(eq(crmInspectionTable.id, inspection.id)).leftJoin(companyCompanyTable, eq(companyCompanyTable.id, crmInspectionTable.companyId)).leftJoin(crmVehicleTable, eq(crmVehicleTable.id, crmInspectionTable.vehicleId)).leftJoin(techdocVehicleKindTable, eq(techdocVehicleKindTable.id, crmVehicleTable.vehicleKindId)).leftJoin(companyEmployeeTable, eq(companyEmployeeTable.id, crmInspectionTable.employeeId));
|
|
152407
|
-
await distribution_default.post(env_default.NODE_ENV === "development" ? "https://driver-partner-api.dev.ubcabtech.com/v1/webhook/autosync/inspection" : "https://driver-partner-api.ubcabtech.com/v1/webhook/autosync/inspection", {
|
|
152411
|
+
await distribution_default.post(env_default.NODE_ENV === "development" ? "https://driver-partner-api-v4.dev.ubcabtech.com/v1/webhook/autosync/inspection" : "https://driver-partner-api-v4.ubcabtech.com/v1/webhook/autosync/inspection", {
|
|
152408
152412
|
json: result[0],
|
|
152409
152413
|
retry: 3
|
|
152410
152414
|
});
|
|
@@ -154525,6 +154529,98 @@ var fieldGroupRoutes = new Elysia({
|
|
|
154525
154529
|
}).delete("/:id", async ({ params: { id } }) => logic_default29.remove(id)).get("/:id/field", async ({ params: { id } }) => logic_default28.select(id));
|
|
154526
154530
|
var fieldGroup_default = fieldGroupRoutes;
|
|
154527
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
|
+
|
|
154528
154624
|
// src/routes/fleet/inspection/logic.ts
|
|
154529
154625
|
var InspectionLogic;
|
|
154530
154626
|
((InspectionLogic) => {
|
|
@@ -154565,7 +154661,7 @@ var InspectionLogic;
|
|
|
154565
154661
|
await db_default.delete(inspectionTable).where(eq(inspectionTable.id, id));
|
|
154566
154662
|
};
|
|
154567
154663
|
})(InspectionLogic ||= {});
|
|
154568
|
-
var
|
|
154664
|
+
var logic_default31 = InspectionLogic;
|
|
154569
154665
|
|
|
154570
154666
|
// src/routes/fleet/inspection/model.ts
|
|
154571
154667
|
var InspectionModel;
|
|
@@ -154591,7 +154687,7 @@ var InspectionModel;
|
|
|
154591
154687
|
}))
|
|
154592
154688
|
]);
|
|
154593
154689
|
})(InspectionModel ||= {});
|
|
154594
|
-
var
|
|
154690
|
+
var model_default31 = InspectionModel;
|
|
154595
154691
|
|
|
154596
154692
|
// src/routes/fleet/inspection/schedule/logic.ts
|
|
154597
154693
|
var InspectionScheduleLogic;
|
|
@@ -154621,7 +154717,7 @@ var InspectionScheduleLogic;
|
|
|
154621
154717
|
}).where(and(eq(inspectionScheduleTable.id, id), eq(inspectionScheduleTable.companyId, user2.companyId)));
|
|
154622
154718
|
};
|
|
154623
154719
|
})(InspectionScheduleLogic ||= {});
|
|
154624
|
-
var
|
|
154720
|
+
var logic_default32 = InspectionScheduleLogic;
|
|
154625
154721
|
|
|
154626
154722
|
// src/routes/fleet/inspection/schedule/model.ts
|
|
154627
154723
|
var InspectionScheduleModel;
|
|
@@ -154632,18 +154728,18 @@ var InspectionScheduleModel;
|
|
|
154632
154728
|
InspectionScheduleModel.update = OmitBaseSchema(updateSchema);
|
|
154633
154729
|
InspectionScheduleModel.select = t.Composite([PaginationSchema]);
|
|
154634
154730
|
})(InspectionScheduleModel ||= {});
|
|
154635
|
-
var
|
|
154731
|
+
var model_default32 = InspectionScheduleModel;
|
|
154636
154732
|
|
|
154637
154733
|
// src/routes/fleet/inspection/schedule/index.ts
|
|
154638
154734
|
var scheduleRoutes = new Elysia({
|
|
154639
154735
|
prefix: "/schedule"
|
|
154640
|
-
}).use(better_auth_default).guard({ auth: true }).get("/", async ({ query, user: user2 }) =>
|
|
154641
|
-
query:
|
|
154642
|
-
}).post("/", async ({ body, user: user2 }) =>
|
|
154643
|
-
body:
|
|
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
|
|
154644
154740
|
}).guard({
|
|
154645
154741
|
params: IdSchema
|
|
154646
|
-
}).put("/:id", async ({ body, params: { id }, user: 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));
|
|
154647
154743
|
var schedule_default = scheduleRoutes;
|
|
154648
154744
|
|
|
154649
154745
|
// src/routes/fleet/inspection/template/logic.ts
|
|
@@ -154702,7 +154798,7 @@ var InspectionTemplateLogic;
|
|
|
154702
154798
|
}).where(eq(inspectionTemplateFieldTable.id, id));
|
|
154703
154799
|
};
|
|
154704
154800
|
})(InspectionTemplateLogic ||= {});
|
|
154705
|
-
var
|
|
154801
|
+
var logic_default33 = InspectionTemplateLogic;
|
|
154706
154802
|
|
|
154707
154803
|
// src/routes/fleet/inspection/template/model.ts
|
|
154708
154804
|
var InspectionTemplateModel;
|
|
@@ -154717,7 +154813,7 @@ var InspectionTemplateModel;
|
|
|
154717
154813
|
"templateId"
|
|
154718
154814
|
]);
|
|
154719
154815
|
})(InspectionTemplateModel ||= {});
|
|
154720
|
-
var
|
|
154816
|
+
var model_default33 = InspectionTemplateModel;
|
|
154721
154817
|
|
|
154722
154818
|
// src/routes/fleet/inspection/template/index.ts
|
|
154723
154819
|
var templateRoutes = new Elysia({
|
|
@@ -154725,30 +154821,30 @@ var templateRoutes = new Elysia({
|
|
|
154725
154821
|
tags: ["InspectionTemplate"]
|
|
154726
154822
|
}).use(better_auth_default).guard({
|
|
154727
154823
|
userKind: "COMPANY_ADMIN"
|
|
154728
|
-
}).get("/", async ({ query, user: user2 }) =>
|
|
154729
|
-
query:
|
|
154730
|
-
}).post("/", async ({ body, user: user2 }) =>
|
|
154731
|
-
body:
|
|
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
|
|
154732
154828
|
}).guard({
|
|
154733
154829
|
params: IdSchema
|
|
154734
|
-
}).get("/:id", async ({ params: { id }, user: user2 }) =>
|
|
154735
|
-
body:
|
|
154736
|
-
}).delete("/:id", async ({ params: { id }, user: user2 }) =>
|
|
154737
|
-
body:
|
|
154738
|
-
}).delete("/field/:id", async ({ params: { 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));
|
|
154739
154835
|
var template_default = templateRoutes;
|
|
154740
154836
|
|
|
154741
154837
|
// src/routes/fleet/inspection/index.ts
|
|
154742
154838
|
var inspectionRoutes2 = new Elysia({
|
|
154743
154839
|
prefix: "/inspection"
|
|
154744
|
-
}).use(fieldGroup_default).use(field_default).use(template_default).use(schedule_default).use(better_auth_default).guard({ auth: true }).get("/", async ({ query, user: user2 }) =>
|
|
154745
|
-
query:
|
|
154746
|
-
}).post("/", async ({ body, user: user2 }) =>
|
|
154747
|
-
body:
|
|
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
|
|
154748
154844
|
}).guard({
|
|
154749
154845
|
params: IdSchema
|
|
154750
|
-
}).put("/:id", async ({ body, params: { id } }) =>
|
|
154751
|
-
body:
|
|
154846
|
+
}).put("/:id", async ({ body, params: { id } }) => logic_default31.update(id, body), {
|
|
154847
|
+
body: model_default31.update
|
|
154752
154848
|
});
|
|
154753
154849
|
var inspection_default2 = inspectionRoutes2;
|
|
154754
154850
|
|
|
@@ -154782,7 +154878,7 @@ var MachineLogic;
|
|
|
154782
154878
|
}).where(and(eq(companyMachineTable.id, id), eq(companyMachineTable.companyId, user2.companyId).if(user2.kind !== "ADMIN")));
|
|
154783
154879
|
};
|
|
154784
154880
|
})(MachineLogic ||= {});
|
|
154785
|
-
var
|
|
154881
|
+
var logic_default34 = MachineLogic;
|
|
154786
154882
|
|
|
154787
154883
|
// src/routes/fleet/machine/model.ts
|
|
154788
154884
|
var MachineModel;
|
|
@@ -154793,7 +154889,7 @@ var MachineModel;
|
|
|
154793
154889
|
MachineModel.update = OmitBaseSchema(updateSchema);
|
|
154794
154890
|
MachineModel.select = t.Composite([PaginationSchema]);
|
|
154795
154891
|
})(MachineModel ||= {});
|
|
154796
|
-
var
|
|
154892
|
+
var model_default34 = MachineModel;
|
|
154797
154893
|
|
|
154798
154894
|
// src/routes/fleet/machine/index.ts
|
|
154799
154895
|
var machineRoutes = new Elysia({
|
|
@@ -154801,15 +154897,15 @@ var machineRoutes = new Elysia({
|
|
|
154801
154897
|
tags: ["FleetMachine"]
|
|
154802
154898
|
}).use(better_auth_default).guard({
|
|
154803
154899
|
auth: true
|
|
154804
|
-
}).get("/", async ({ query, user: user2 }) =>
|
|
154805
|
-
query:
|
|
154806
|
-
}).post("/", async ({ body, user: user2 }) =>
|
|
154807
|
-
body:
|
|
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
|
|
154808
154904
|
}).guard({
|
|
154809
154905
|
params: IdSchema
|
|
154810
|
-
}).put("/:id", async ({ body, params: { id }, user: user2 }) =>
|
|
154811
|
-
body:
|
|
154812
|
-
}).delete("/:id", async ({ params: { id }, user: 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));
|
|
154813
154909
|
var machine_default = machineRoutes;
|
|
154814
154910
|
|
|
154815
154911
|
// src/routes/fleet/pm/template/logic.ts
|
|
@@ -154844,7 +154940,7 @@ var PmTemplateLogic;
|
|
|
154844
154940
|
}).where(and(eq(pmTemplateTable.id, id), eq(pmTemplateTable.companyId, user2.companyId).if(user2.kind !== "ADMIN")));
|
|
154845
154941
|
};
|
|
154846
154942
|
})(PmTemplateLogic ||= {});
|
|
154847
|
-
var
|
|
154943
|
+
var logic_default35 = PmTemplateLogic;
|
|
154848
154944
|
|
|
154849
154945
|
// src/routes/fleet/pm/template/model.ts
|
|
154850
154946
|
var PmTemplateModel;
|
|
@@ -154855,18 +154951,19 @@ var PmTemplateModel;
|
|
|
154855
154951
|
PmTemplateModel.update = OmitBaseSchema(updateSchema);
|
|
154856
154952
|
PmTemplateModel.select = t.Composite([PaginationSchema]);
|
|
154857
154953
|
})(PmTemplateModel ||= {});
|
|
154858
|
-
var
|
|
154954
|
+
var model_default35 = PmTemplateModel;
|
|
154859
154955
|
|
|
154860
154956
|
// src/routes/fleet/pm/template/product/logic.ts
|
|
154861
154957
|
var PmTemplateProductLogic;
|
|
154862
154958
|
((PmTemplateProductLogic) => {
|
|
154863
154959
|
PmTemplateProductLogic.select = async (query) => {
|
|
154864
154960
|
const filter = and(softDeletedFilter(pmTemplateProductTable), eq(pmTemplateProductTable.pmTemplateId, query.pmTemplateId));
|
|
154865
|
-
const columns = getTableColumns(pmTemplateProductTable);
|
|
154866
154961
|
const baseQuery = db_default.select({
|
|
154867
|
-
|
|
154962
|
+
product: pmTemplateProductTable,
|
|
154963
|
+
productKind: techdocProductKindTable,
|
|
154964
|
+
uom: uomTable,
|
|
154868
154965
|
totalCount: totalCountSql
|
|
154869
|
-
}).from(pmTemplateProductTable).where(filter).$dynamic();
|
|
154966
|
+
}).from(pmTemplateProductTable).leftJoin(techdocProductKindTable, eq(techdocProductKindTable.id, pmTemplateProductTable.productKindId)).leftJoin(uomTable, eq(uomTable.id, pmTemplateProductTable.uomId)).where(filter).$dynamic();
|
|
154870
154967
|
const result = await pagination_helper_default(baseQuery, query.pagination);
|
|
154871
154968
|
return getPaginationContent(result, query.pagination.size);
|
|
154872
154969
|
};
|
|
@@ -154886,7 +154983,7 @@ var PmTemplateProductLogic;
|
|
|
154886
154983
|
}).where(and(eq(pmTemplateProductTable.id, id)));
|
|
154887
154984
|
};
|
|
154888
154985
|
})(PmTemplateProductLogic ||= {});
|
|
154889
|
-
var
|
|
154986
|
+
var logic_default36 = PmTemplateProductLogic;
|
|
154890
154987
|
|
|
154891
154988
|
// src/routes/fleet/pm/template/product/model.ts
|
|
154892
154989
|
var PmTemplateProductModel;
|
|
@@ -154902,7 +154999,7 @@ var PmTemplateProductModel;
|
|
|
154902
154999
|
})
|
|
154903
155000
|
]);
|
|
154904
155001
|
})(PmTemplateProductModel ||= {});
|
|
154905
|
-
var
|
|
155002
|
+
var model_default36 = PmTemplateProductModel;
|
|
154906
155003
|
|
|
154907
155004
|
// src/routes/fleet/pm/template/product/index.ts
|
|
154908
155005
|
var productRoutes4 = new Elysia({
|
|
@@ -154910,15 +155007,15 @@ var productRoutes4 = new Elysia({
|
|
|
154910
155007
|
tags: ["PmTemplateProduct"]
|
|
154911
155008
|
}).use(better_auth_default).guard({
|
|
154912
155009
|
userKind: "COMPANY_ADMIN"
|
|
154913
|
-
}).get("/", async ({ query }) =>
|
|
154914
|
-
query:
|
|
154915
|
-
}).post("/", async ({ body }) =>
|
|
154916
|
-
body:
|
|
155010
|
+
}).get("/", async ({ query }) => logic_default36.select(query), {
|
|
155011
|
+
query: model_default36.select
|
|
155012
|
+
}).post("/", async ({ body }) => logic_default36.create(body), {
|
|
155013
|
+
body: model_default36.create
|
|
154917
155014
|
}).guard({
|
|
154918
155015
|
params: IdSchema
|
|
154919
|
-
}).put("/:id", async ({ body, params: { id } }) =>
|
|
154920
|
-
body:
|
|
154921
|
-
}).delete("/:id", async ({ params: { id } }) =>
|
|
155016
|
+
}).put("/:id", async ({ body, params: { id } }) => logic_default36.update(id, body), {
|
|
155017
|
+
body: model_default36.update
|
|
155018
|
+
}).delete("/:id", async ({ params: { id } }) => logic_default36.remove(id));
|
|
154922
155019
|
var product_default4 = productRoutes4;
|
|
154923
155020
|
|
|
154924
155021
|
// src/routes/fleet/pm/template/index.ts
|
|
@@ -154927,15 +155024,15 @@ var templateRoutes2 = new Elysia({
|
|
|
154927
155024
|
tags: ["PmTemplate"]
|
|
154928
155025
|
}).use(better_auth_default).use(product_default4).guard({
|
|
154929
155026
|
userKind: "COMPANY_ADMIN"
|
|
154930
|
-
}).get("/", async ({ query, user: user2 }) =>
|
|
154931
|
-
query:
|
|
154932
|
-
}).post("/", async ({ body, user: user2 }) =>
|
|
154933
|
-
body:
|
|
155027
|
+
}).get("/", async ({ query, user: user2 }) => logic_default35.select(query, user2), {
|
|
155028
|
+
query: model_default35.select
|
|
155029
|
+
}).post("/", async ({ body, user: user2 }) => logic_default35.create(body, user2), {
|
|
155030
|
+
body: model_default35.create
|
|
154934
155031
|
}).guard({
|
|
154935
155032
|
params: IdSchema
|
|
154936
|
-
}).put("/:id", async ({ body, params: { id }, user: user2 }) =>
|
|
154937
|
-
body:
|
|
154938
|
-
}).delete("/:id", async ({ params: { id }, user: user2 }) =>
|
|
155033
|
+
}).put("/:id", async ({ body, params: { id }, user: user2 }) => logic_default35.update(id, body, user2), {
|
|
155034
|
+
body: model_default35.update
|
|
155035
|
+
}).delete("/:id", async ({ params: { id }, user: user2 }) => logic_default35.remove(id, user2));
|
|
154939
155036
|
var template_default2 = templateRoutes2;
|
|
154940
155037
|
|
|
154941
155038
|
// src/routes/fleet/pm/index.ts
|
|
@@ -154979,7 +155076,7 @@ var UomCategoryLogic;
|
|
|
154979
155076
|
}).where(and(eq(uomCategoryTable.id, id)));
|
|
154980
155077
|
};
|
|
154981
155078
|
})(UomCategoryLogic ||= {});
|
|
154982
|
-
var
|
|
155079
|
+
var logic_default37 = UomCategoryLogic;
|
|
154983
155080
|
|
|
154984
155081
|
// src/routes/uom/category/model.ts
|
|
154985
155082
|
var UomCategoryModel;
|
|
@@ -154990,7 +155087,7 @@ var UomCategoryModel;
|
|
|
154990
155087
|
UomCategoryModel.update = OmitBaseSchema(updateSchema);
|
|
154991
155088
|
UomCategoryModel.select = t.Composite([PaginationSchema]);
|
|
154992
155089
|
})(UomCategoryModel ||= {});
|
|
154993
|
-
var
|
|
155090
|
+
var model_default37 = UomCategoryModel;
|
|
154994
155091
|
|
|
154995
155092
|
// src/routes/uom/category/index.ts
|
|
154996
155093
|
var categoryRoutes = new Elysia({
|
|
@@ -154998,15 +155095,15 @@ var categoryRoutes = new Elysia({
|
|
|
154998
155095
|
tags: ["UomCategory"]
|
|
154999
155096
|
}).use(better_auth_default).guard({
|
|
155000
155097
|
auth: true
|
|
155001
|
-
}).get("/", async ({ query }) =>
|
|
155002
|
-
query:
|
|
155003
|
-
}).post("/", async ({ body }) =>
|
|
155004
|
-
body:
|
|
155098
|
+
}).get("/", async ({ query }) => logic_default37.select(query), {
|
|
155099
|
+
query: model_default37.select
|
|
155100
|
+
}).post("/", async ({ body }) => logic_default37.create(body), {
|
|
155101
|
+
body: model_default37.create
|
|
155005
155102
|
}).guard({
|
|
155006
155103
|
params: IdSchema
|
|
155007
|
-
}).put("/:id", async ({ body, params: { id } }) =>
|
|
155008
|
-
body:
|
|
155009
|
-
}).delete("/:id", async ({ params: { id } }) =>
|
|
155104
|
+
}).put("/:id", async ({ body, params: { id } }) => logic_default37.update(id, body), {
|
|
155105
|
+
body: model_default37.update
|
|
155106
|
+
}).delete("/:id", async ({ params: { id } }) => logic_default37.remove(id));
|
|
155010
155107
|
var category_default = categoryRoutes;
|
|
155011
155108
|
|
|
155012
155109
|
// src/routes/uom/conversion/logic.ts
|
|
@@ -155040,7 +155137,7 @@ var UomConversionLogic;
|
|
|
155040
155137
|
}).where(and(eq(uomConversionTable.id, id)));
|
|
155041
155138
|
};
|
|
155042
155139
|
})(UomConversionLogic ||= {});
|
|
155043
|
-
var
|
|
155140
|
+
var logic_default38 = UomConversionLogic;
|
|
155044
155141
|
|
|
155045
155142
|
// src/routes/uom/conversion/model.ts
|
|
155046
155143
|
var UomConversionModel;
|
|
@@ -155057,7 +155154,7 @@ var UomConversionModel;
|
|
|
155057
155154
|
})
|
|
155058
155155
|
]);
|
|
155059
155156
|
})(UomConversionModel ||= {});
|
|
155060
|
-
var
|
|
155157
|
+
var model_default38 = UomConversionModel;
|
|
155061
155158
|
|
|
155062
155159
|
// src/routes/uom/conversion/index.ts
|
|
155063
155160
|
var conversionRoutes = new Elysia({
|
|
@@ -155065,15 +155162,15 @@ var conversionRoutes = new Elysia({
|
|
|
155065
155162
|
tags: ["UomConversion"]
|
|
155066
155163
|
}).use(better_auth_default).guard({
|
|
155067
155164
|
auth: true
|
|
155068
|
-
}).get("/", async ({ query }) =>
|
|
155069
|
-
query:
|
|
155070
|
-
}).post("/", async ({ body }) =>
|
|
155071
|
-
body:
|
|
155165
|
+
}).get("/", async ({ query }) => logic_default38.select(query), {
|
|
155166
|
+
query: model_default38.select
|
|
155167
|
+
}).post("/", async ({ body }) => logic_default38.create(body), {
|
|
155168
|
+
body: model_default38.create
|
|
155072
155169
|
}).guard({
|
|
155073
155170
|
params: IdSchema
|
|
155074
|
-
}).put("/:id", async ({ body, params: { id } }) =>
|
|
155075
|
-
body:
|
|
155076
|
-
}).delete("/:id", async ({ params: { id } }) =>
|
|
155171
|
+
}).put("/:id", async ({ body, params: { id } }) => logic_default38.update(id, body), {
|
|
155172
|
+
body: model_default38.update
|
|
155173
|
+
}).delete("/:id", async ({ params: { id } }) => logic_default38.remove(id));
|
|
155077
155174
|
var conversion_default = conversionRoutes;
|
|
155078
155175
|
|
|
155079
155176
|
// src/routes/uom/logic.ts
|
|
@@ -155107,7 +155204,7 @@ var UomLogic;
|
|
|
155107
155204
|
}).where(and(eq(uomTable.id, id)));
|
|
155108
155205
|
};
|
|
155109
155206
|
})(UomLogic ||= {});
|
|
155110
|
-
var
|
|
155207
|
+
var logic_default39 = UomLogic;
|
|
155111
155208
|
|
|
155112
155209
|
// src/routes/uom/model.ts
|
|
155113
155210
|
var UomModel;
|
|
@@ -155123,25 +155220,25 @@ var UomModel;
|
|
|
155123
155220
|
})
|
|
155124
155221
|
]);
|
|
155125
155222
|
})(UomModel ||= {});
|
|
155126
|
-
var
|
|
155223
|
+
var model_default39 = UomModel;
|
|
155127
155224
|
|
|
155128
155225
|
// src/routes/uom/index.ts
|
|
155129
155226
|
var uomSchemaRoutes = new Elysia({
|
|
155130
155227
|
prefix: "/uom"
|
|
155131
155228
|
}).use(better_auth_default).use(category_default).use(conversion_default).guard({
|
|
155132
155229
|
userKind: "ADMIN"
|
|
155133
|
-
}).get("/", async ({ query }) =>
|
|
155134
|
-
query:
|
|
155230
|
+
}).get("/", async ({ query }) => logic_default39.select(query), {
|
|
155231
|
+
query: model_default39.select,
|
|
155135
155232
|
tags: ["Uom"]
|
|
155136
|
-
}).post("/", async ({ body }) =>
|
|
155137
|
-
body:
|
|
155233
|
+
}).post("/", async ({ body }) => logic_default39.create(body), {
|
|
155234
|
+
body: model_default39.create,
|
|
155138
155235
|
tags: ["Uom"]
|
|
155139
155236
|
}).guard({
|
|
155140
155237
|
params: IdSchema
|
|
155141
|
-
}).put("/:id", async ({ body, params: { id } }) =>
|
|
155142
|
-
body:
|
|
155238
|
+
}).put("/:id", async ({ body, params: { id } }) => logic_default39.update(id, body), {
|
|
155239
|
+
body: model_default39.update,
|
|
155143
155240
|
tags: ["Uom"]
|
|
155144
|
-
}).delete("/:id", async ({ params: { id } }) =>
|
|
155241
|
+
}).delete("/:id", async ({ params: { id } }) => logic_default39.remove(id), {
|
|
155145
155242
|
tags: ["Uom"]
|
|
155146
155243
|
});
|
|
155147
155244
|
var uom_default = uomSchemaRoutes;
|