autosync_backend2 1.2.28 → 1.2.29
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 +167 -11
- package/dist/index.js +70 -6
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -8042,18 +8042,48 @@ export declare const app: Elysia<"", {
|
|
|
8042
8042
|
totalCount: number;
|
|
8043
8043
|
totalPage: number;
|
|
8044
8044
|
result: Omit<{
|
|
8045
|
+
schedule: {
|
|
8046
|
+
companyId: string;
|
|
8047
|
+
machineId: string;
|
|
8048
|
+
templateId: string;
|
|
8049
|
+
daysInterval: number | null;
|
|
8050
|
+
timeNextDue: Date | null;
|
|
8051
|
+
isActive: boolean;
|
|
8052
|
+
id: string;
|
|
8053
|
+
createdAt: string;
|
|
8054
|
+
updatedAt: string;
|
|
8055
|
+
deletedAt: string | null;
|
|
8056
|
+
oldId: number | null;
|
|
8057
|
+
};
|
|
8058
|
+
machine: {
|
|
8059
|
+
companyId: string | null;
|
|
8060
|
+
machineKindId: string;
|
|
8061
|
+
customerId: string | null;
|
|
8062
|
+
name: string | null;
|
|
8063
|
+
assetCode: string | null;
|
|
8064
|
+
vin: string | null;
|
|
8065
|
+
licensePlate: string | null;
|
|
8066
|
+
color: string | null;
|
|
8067
|
+
engineCc: string | null;
|
|
8068
|
+
cylinder: string | null;
|
|
8069
|
+
gasType: string | null;
|
|
8070
|
+
transmissionType: string | null;
|
|
8071
|
+
vehicleType: string | null;
|
|
8072
|
+
yearManufacture: number | null;
|
|
8073
|
+
yearImport: number | null;
|
|
8074
|
+
steering: string | null;
|
|
8075
|
+
engineCode: string | null;
|
|
8076
|
+
transmissionCode: string | null;
|
|
8077
|
+
driveTrain: string | null;
|
|
8078
|
+
km: number;
|
|
8079
|
+
customData: unknown;
|
|
8080
|
+
id: string;
|
|
8081
|
+
createdAt: string;
|
|
8082
|
+
updatedAt: string;
|
|
8083
|
+
deletedAt: string | null;
|
|
8084
|
+
oldId: number | null;
|
|
8085
|
+
} | null;
|
|
8045
8086
|
totalCount: number;
|
|
8046
|
-
companyId: string;
|
|
8047
|
-
machineId: string;
|
|
8048
|
-
templateId: string;
|
|
8049
|
-
daysInterval: number | null;
|
|
8050
|
-
timeNextDue: Date | null;
|
|
8051
|
-
isActive: boolean;
|
|
8052
|
-
id: string;
|
|
8053
|
-
createdAt: string;
|
|
8054
|
-
updatedAt: string;
|
|
8055
|
-
deletedAt: string | null;
|
|
8056
|
-
oldId: number | null;
|
|
8057
8087
|
}, "totalCount">[];
|
|
8058
8088
|
};
|
|
8059
8089
|
401: "Session not found";
|
|
@@ -8258,6 +8288,132 @@ export declare const app: Elysia<"", {
|
|
|
8258
8288
|
fleet: {
|
|
8259
8289
|
pm: {
|
|
8260
8290
|
template: {};
|
|
8291
|
+
} & {
|
|
8292
|
+
template: {
|
|
8293
|
+
product: {};
|
|
8294
|
+
} & {
|
|
8295
|
+
product: {
|
|
8296
|
+
get: {
|
|
8297
|
+
body: unknown;
|
|
8298
|
+
params: {};
|
|
8299
|
+
query: {
|
|
8300
|
+
pagination: {
|
|
8301
|
+
size: number;
|
|
8302
|
+
page: number;
|
|
8303
|
+
};
|
|
8304
|
+
pmTemplateId: string;
|
|
8305
|
+
};
|
|
8306
|
+
headers: unknown;
|
|
8307
|
+
response: {
|
|
8308
|
+
200: {
|
|
8309
|
+
totalCount: number;
|
|
8310
|
+
totalPage: number;
|
|
8311
|
+
result: Omit<{
|
|
8312
|
+
totalCount: number;
|
|
8313
|
+
pmTemplateId: string;
|
|
8314
|
+
productKindId: string;
|
|
8315
|
+
quantity: number | null;
|
|
8316
|
+
uomId: string;
|
|
8317
|
+
id: string;
|
|
8318
|
+
createdAt: string;
|
|
8319
|
+
updatedAt: string;
|
|
8320
|
+
deletedAt: string | null;
|
|
8321
|
+
oldId: number | null;
|
|
8322
|
+
}, "totalCount">[];
|
|
8323
|
+
};
|
|
8324
|
+
422: {
|
|
8325
|
+
type: "validation";
|
|
8326
|
+
on: string;
|
|
8327
|
+
summary?: string;
|
|
8328
|
+
message?: string;
|
|
8329
|
+
found?: unknown;
|
|
8330
|
+
property?: string;
|
|
8331
|
+
expected?: string;
|
|
8332
|
+
};
|
|
8333
|
+
};
|
|
8334
|
+
};
|
|
8335
|
+
};
|
|
8336
|
+
} & {
|
|
8337
|
+
product: {
|
|
8338
|
+
post: {
|
|
8339
|
+
body: {
|
|
8340
|
+
oldId?: number | null | undefined;
|
|
8341
|
+
quantity?: number | null | undefined;
|
|
8342
|
+
uomId: string;
|
|
8343
|
+
pmTemplateId: string;
|
|
8344
|
+
productKindId: string;
|
|
8345
|
+
};
|
|
8346
|
+
params: {};
|
|
8347
|
+
query: unknown;
|
|
8348
|
+
headers: unknown;
|
|
8349
|
+
response: {
|
|
8350
|
+
422: {
|
|
8351
|
+
type: "validation";
|
|
8352
|
+
on: string;
|
|
8353
|
+
summary?: string;
|
|
8354
|
+
message?: string;
|
|
8355
|
+
found?: unknown;
|
|
8356
|
+
property?: string;
|
|
8357
|
+
expected?: string;
|
|
8358
|
+
};
|
|
8359
|
+
};
|
|
8360
|
+
};
|
|
8361
|
+
};
|
|
8362
|
+
} & {
|
|
8363
|
+
product: {
|
|
8364
|
+
":id": {
|
|
8365
|
+
put: {
|
|
8366
|
+
body: {
|
|
8367
|
+
oldId?: number | null | undefined;
|
|
8368
|
+
quantity?: number | null | undefined;
|
|
8369
|
+
uomId?: string | undefined;
|
|
8370
|
+
pmTemplateId?: string | undefined;
|
|
8371
|
+
productKindId?: string | undefined;
|
|
8372
|
+
};
|
|
8373
|
+
params: {
|
|
8374
|
+
id: string;
|
|
8375
|
+
};
|
|
8376
|
+
query: unknown;
|
|
8377
|
+
headers: unknown;
|
|
8378
|
+
response: {
|
|
8379
|
+
422: {
|
|
8380
|
+
type: "validation";
|
|
8381
|
+
on: string;
|
|
8382
|
+
summary?: string;
|
|
8383
|
+
message?: string;
|
|
8384
|
+
found?: unknown;
|
|
8385
|
+
property?: string;
|
|
8386
|
+
expected?: string;
|
|
8387
|
+
};
|
|
8388
|
+
};
|
|
8389
|
+
};
|
|
8390
|
+
};
|
|
8391
|
+
};
|
|
8392
|
+
} & {
|
|
8393
|
+
product: {
|
|
8394
|
+
":id": {
|
|
8395
|
+
delete: {
|
|
8396
|
+
body: unknown;
|
|
8397
|
+
params: {
|
|
8398
|
+
id: string;
|
|
8399
|
+
};
|
|
8400
|
+
query: unknown;
|
|
8401
|
+
headers: unknown;
|
|
8402
|
+
response: {
|
|
8403
|
+
422: {
|
|
8404
|
+
type: "validation";
|
|
8405
|
+
on: string;
|
|
8406
|
+
summary?: string;
|
|
8407
|
+
message?: string;
|
|
8408
|
+
found?: unknown;
|
|
8409
|
+
property?: string;
|
|
8410
|
+
expected?: string;
|
|
8411
|
+
};
|
|
8412
|
+
};
|
|
8413
|
+
};
|
|
8414
|
+
};
|
|
8415
|
+
};
|
|
8416
|
+
};
|
|
8261
8417
|
} & {
|
|
8262
8418
|
template: {
|
|
8263
8419
|
get: {
|
package/dist/index.js
CHANGED
|
@@ -142757,7 +142757,7 @@ var companyMachineTable = companySchema.table("machine", {
|
|
|
142757
142757
|
customerId: uuid5(),
|
|
142758
142758
|
name: varchar(),
|
|
142759
142759
|
assetCode: varchar(),
|
|
142760
|
-
vin: varchar()
|
|
142760
|
+
vin: varchar(),
|
|
142761
142761
|
licensePlate: varchar(),
|
|
142762
142762
|
color: varchar(),
|
|
142763
142763
|
engineCc: varchar(),
|
|
@@ -154274,11 +154274,11 @@ var InspectionScheduleLogic;
|
|
|
154274
154274
|
((InspectionScheduleLogic) => {
|
|
154275
154275
|
InspectionScheduleLogic.select = async (query, user2) => {
|
|
154276
154276
|
const filter = and(softDeletedFilter(inspectionScheduleTable), eq(inspectionScheduleTable.companyId, user2.companyId));
|
|
154277
|
-
const columns = getTableColumns(inspectionScheduleTable);
|
|
154278
154277
|
const baseQuery = db_default.select({
|
|
154279
|
-
|
|
154278
|
+
schedule: inspectionScheduleTable,
|
|
154279
|
+
machine: companyMachineTable,
|
|
154280
154280
|
totalCount: totalCountSql
|
|
154281
|
-
}).from(inspectionScheduleTable).where(filter).$dynamic();
|
|
154281
|
+
}).from(inspectionScheduleTable).where(filter).leftJoin(companyMachineTable, eq(inspectionScheduleTable.machineId, companyMachineTable.id)).$dynamic();
|
|
154282
154282
|
const result = await pagination_helper_default(baseQuery, query.pagination);
|
|
154283
154283
|
return getPaginationContent(result, query.pagination.size);
|
|
154284
154284
|
};
|
|
@@ -154428,7 +154428,7 @@ var inspection_default2 = inspectionRoutes2;
|
|
|
154428
154428
|
var MachineLogic;
|
|
154429
154429
|
((MachineLogic) => {
|
|
154430
154430
|
MachineLogic.select = async (query, user2) => {
|
|
154431
|
-
const filter = and(or(isNull2(companyMachineTable.companyId), eq(companyMachineTable.companyId, user2.companyId).if(user2.kind !== "ADMIN")));
|
|
154431
|
+
const filter = and(or(isNull2(companyMachineTable.companyId), eq(companyMachineTable.companyId, user2.companyId).if(user2.kind !== "ADMIN")), softDeletedFilter(companyMachineTable));
|
|
154432
154432
|
const columns = getTableColumns(companyMachineTable);
|
|
154433
154433
|
const baseQuery = db_default.select({
|
|
154434
154434
|
...columns,
|
|
@@ -154527,11 +154527,75 @@ var PmTemplateModel;
|
|
|
154527
154527
|
})(PmTemplateModel ||= {});
|
|
154528
154528
|
var model_default31 = PmTemplateModel;
|
|
154529
154529
|
|
|
154530
|
+
// src/routes/fleet/pm/template/product/logic.ts
|
|
154531
|
+
var PmTemplateProductLogic;
|
|
154532
|
+
((PmTemplateProductLogic) => {
|
|
154533
|
+
PmTemplateProductLogic.select = async (query) => {
|
|
154534
|
+
const filter = and(softDeletedFilter(pmTemplateProductTable), eq(pmTemplateProductTable.pmTemplateId, query.pmTemplateId));
|
|
154535
|
+
const columns = getTableColumns(pmTemplateProductTable);
|
|
154536
|
+
const baseQuery = db_default.select({
|
|
154537
|
+
...columns,
|
|
154538
|
+
totalCount: totalCountSql
|
|
154539
|
+
}).from(pmTemplateProductTable).where(filter).$dynamic();
|
|
154540
|
+
const result = await pagination_helper_default(baseQuery, query.pagination);
|
|
154541
|
+
return getPaginationContent(result, query.pagination.size);
|
|
154542
|
+
};
|
|
154543
|
+
PmTemplateProductLogic.create = async (body) => {
|
|
154544
|
+
await db_default.insert(pmTemplateProductTable).values({
|
|
154545
|
+
...body
|
|
154546
|
+
});
|
|
154547
|
+
};
|
|
154548
|
+
PmTemplateProductLogic.update = async (id, body) => {
|
|
154549
|
+
await db_default.update(pmTemplateProductTable).set({
|
|
154550
|
+
...body
|
|
154551
|
+
}).where(and(eq(pmTemplateProductTable.id, id)));
|
|
154552
|
+
};
|
|
154553
|
+
PmTemplateProductLogic.remove = async (id) => {
|
|
154554
|
+
await db_default.update(pmTemplateProductTable).set({
|
|
154555
|
+
deletedAt: nowSql_helper_default
|
|
154556
|
+
}).where(and(eq(pmTemplateProductTable.id, id)));
|
|
154557
|
+
};
|
|
154558
|
+
})(PmTemplateProductLogic ||= {});
|
|
154559
|
+
var logic_default32 = PmTemplateProductLogic;
|
|
154560
|
+
|
|
154561
|
+
// src/routes/fleet/pm/template/product/model.ts
|
|
154562
|
+
var PmTemplateProductModel;
|
|
154563
|
+
((PmTemplateProductModel) => {
|
|
154564
|
+
const createSchema = createInsertSchema2(pmTemplateProductTable);
|
|
154565
|
+
const updateSchema = createUpdateSchema(pmTemplateProductTable);
|
|
154566
|
+
PmTemplateProductModel.create = OmitBaseSchema(createSchema);
|
|
154567
|
+
PmTemplateProductModel.update = OmitBaseSchema(updateSchema);
|
|
154568
|
+
PmTemplateProductModel.select = t.Composite([
|
|
154569
|
+
PaginationSchema,
|
|
154570
|
+
t.Object({
|
|
154571
|
+
pmTemplateId: t.String({ format: "uuid" })
|
|
154572
|
+
})
|
|
154573
|
+
]);
|
|
154574
|
+
})(PmTemplateProductModel ||= {});
|
|
154575
|
+
var model_default32 = PmTemplateProductModel;
|
|
154576
|
+
|
|
154577
|
+
// src/routes/fleet/pm/template/product/index.ts
|
|
154578
|
+
var productRoutes4 = new Elysia({
|
|
154579
|
+
prefix: "/product",
|
|
154580
|
+
tags: ["PmTemplateProduct"]
|
|
154581
|
+
}).use(better_auth_default).guard({
|
|
154582
|
+
userKind: "COMPANY_ADMIN"
|
|
154583
|
+
}).get("/", async ({ query }) => logic_default32.select(query), {
|
|
154584
|
+
query: model_default32.select
|
|
154585
|
+
}).post("/", async ({ body }) => logic_default32.create(body), {
|
|
154586
|
+
body: model_default32.create
|
|
154587
|
+
}).guard({
|
|
154588
|
+
params: IdSchema
|
|
154589
|
+
}).put("/:id", async ({ body, params: { id } }) => logic_default32.update(id, body), {
|
|
154590
|
+
body: model_default32.update
|
|
154591
|
+
}).delete("/:id", async ({ params: { id } }) => logic_default32.remove(id));
|
|
154592
|
+
var product_default4 = productRoutes4;
|
|
154593
|
+
|
|
154530
154594
|
// src/routes/fleet/pm/template/index.ts
|
|
154531
154595
|
var templateRoutes2 = new Elysia({
|
|
154532
154596
|
prefix: "/template",
|
|
154533
154597
|
tags: ["PmTemplate"]
|
|
154534
|
-
}).use(better_auth_default).guard({
|
|
154598
|
+
}).use(better_auth_default).use(product_default4).guard({
|
|
154535
154599
|
userKind: "COMPANY_ADMIN"
|
|
154536
154600
|
}).get("/", async ({ query, user: user2 }) => logic_default31.select(query, user2), {
|
|
154537
154601
|
query: model_default31.select
|