autosync_backend2 1.2.27 → 1.2.28

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
@@ -3984,8 +3984,8 @@ export declare const app: Elysia<"", {
3984
3984
  body: {
3985
3985
  phone?: string | undefined;
3986
3986
  licensePlate?: string | undefined;
3987
- vehicleKindId?: string | undefined;
3988
3987
  vin?: string | undefined;
3988
+ vehicleKindId?: string | undefined;
3989
3989
  };
3990
3990
  params: {};
3991
3991
  query: unknown;
@@ -5161,8 +5161,8 @@ export declare const app: Elysia<"", {
5161
5161
  body: {
5162
5162
  customerId?: string | undefined;
5163
5163
  licensePlate?: string | undefined;
5164
- vehicleKindId?: string | undefined;
5165
5164
  vin?: string | undefined;
5165
+ vehicleKindId?: string | undefined;
5166
5166
  };
5167
5167
  params: {};
5168
5168
  query: unknown;
@@ -5177,7 +5177,6 @@ export declare const app: Elysia<"", {
5177
5177
  oldId: number | null;
5178
5178
  customerId: string | null;
5179
5179
  licensePlate: string | null;
5180
- vehicleKindId: string;
5181
5180
  vin: string | null;
5182
5181
  color: string | null;
5183
5182
  engineCc: string | null;
@@ -5193,6 +5192,7 @@ export declare const app: Elysia<"", {
5193
5192
  driveTrain: string | null;
5194
5193
  km: number;
5195
5194
  customData: unknown;
5195
+ vehicleKindId: string;
5196
5196
  };
5197
5197
  400: "Машины дугаар болон VIN хоёроос нэгийг нь оруулна уу." | "Машины VIN оруулсан бол машины төрөл оруулна уу.";
5198
5198
  401: "Session not found";
@@ -5317,7 +5317,6 @@ export declare const app: Elysia<"", {
5317
5317
  oldId?: number | null | undefined;
5318
5318
  customerId?: string | null | undefined;
5319
5319
  licensePlate?: string | null | undefined;
5320
- vehicleKindId?: string | undefined;
5321
5320
  vin?: string | null | undefined;
5322
5321
  color?: string | null | undefined;
5323
5322
  engineCc?: string | null | undefined;
@@ -5333,6 +5332,7 @@ export declare const app: Elysia<"", {
5333
5332
  driveTrain?: string | null | undefined;
5334
5333
  km?: number | undefined;
5335
5334
  customData?: import("drizzle-typebox").Json | undefined;
5335
+ vehicleKindId?: string | undefined;
5336
5336
  };
5337
5337
  params: {
5338
5338
  id: string;
@@ -5480,7 +5480,6 @@ export declare const app: Elysia<"", {
5480
5480
  oldId: number | null;
5481
5481
  customerId: string | null;
5482
5482
  licensePlate: string | null;
5483
- vehicleKindId: string;
5484
5483
  vin: string | null;
5485
5484
  color: string | null;
5486
5485
  engineCc: string | null;
@@ -5496,6 +5495,7 @@ export declare const app: Elysia<"", {
5496
5495
  driveTrain: string | null;
5497
5496
  km: number;
5498
5497
  customData: unknown;
5498
+ vehicleKindId: string;
5499
5499
  }[];
5500
5500
  }[];
5501
5501
  };
@@ -8254,6 +8254,322 @@ export declare const app: Elysia<"", {
8254
8254
  };
8255
8255
  };
8256
8256
  };
8257
+ } & {
8258
+ fleet: {
8259
+ pm: {
8260
+ template: {};
8261
+ } & {
8262
+ template: {
8263
+ get: {
8264
+ body: unknown;
8265
+ params: {};
8266
+ query: {
8267
+ pagination: {
8268
+ size: number;
8269
+ page: number;
8270
+ };
8271
+ };
8272
+ headers: unknown;
8273
+ response: {
8274
+ 200: {
8275
+ totalCount: number;
8276
+ totalPage: number;
8277
+ result: Omit<{
8278
+ totalCount: number;
8279
+ machineKindId: string;
8280
+ companyId: string | null;
8281
+ operationAmount: number | null;
8282
+ uomId: string;
8283
+ serviceKindId: string;
8284
+ name: string;
8285
+ description: string | null;
8286
+ id: string;
8287
+ createdAt: string;
8288
+ updatedAt: string;
8289
+ deletedAt: string | null;
8290
+ oldId: number | null;
8291
+ }, "totalCount">[];
8292
+ };
8293
+ 422: {
8294
+ type: "validation";
8295
+ on: string;
8296
+ summary?: string;
8297
+ message?: string;
8298
+ found?: unknown;
8299
+ property?: string;
8300
+ expected?: string;
8301
+ };
8302
+ };
8303
+ };
8304
+ };
8305
+ } & {
8306
+ template: {
8307
+ post: {
8308
+ body: {
8309
+ companyId?: string | null | undefined;
8310
+ oldId?: number | null | undefined;
8311
+ description?: string | null | undefined;
8312
+ operationAmount?: number | null | undefined;
8313
+ name: string;
8314
+ serviceKindId: string;
8315
+ machineKindId: string;
8316
+ uomId: string;
8317
+ };
8318
+ params: {};
8319
+ query: unknown;
8320
+ headers: unknown;
8321
+ response: {
8322
+ 422: {
8323
+ type: "validation";
8324
+ on: string;
8325
+ summary?: string;
8326
+ message?: string;
8327
+ found?: unknown;
8328
+ property?: string;
8329
+ expected?: string;
8330
+ };
8331
+ };
8332
+ };
8333
+ };
8334
+ } & {
8335
+ template: {
8336
+ ":id": {
8337
+ put: {
8338
+ body: {
8339
+ name?: string | undefined;
8340
+ companyId?: string | null | undefined;
8341
+ oldId?: number | null | undefined;
8342
+ serviceKindId?: string | undefined;
8343
+ description?: string | null | undefined;
8344
+ machineKindId?: string | undefined;
8345
+ operationAmount?: number | null | undefined;
8346
+ uomId?: string | undefined;
8347
+ };
8348
+ params: {
8349
+ id: string;
8350
+ };
8351
+ query: unknown;
8352
+ headers: unknown;
8353
+ response: {
8354
+ 422: {
8355
+ type: "validation";
8356
+ on: string;
8357
+ summary?: string;
8358
+ message?: string;
8359
+ found?: unknown;
8360
+ property?: string;
8361
+ expected?: string;
8362
+ };
8363
+ };
8364
+ };
8365
+ };
8366
+ };
8367
+ } & {
8368
+ template: {
8369
+ ":id": {
8370
+ delete: {
8371
+ body: unknown;
8372
+ params: {
8373
+ id: string;
8374
+ };
8375
+ query: unknown;
8376
+ headers: unknown;
8377
+ response: {
8378
+ 422: {
8379
+ type: "validation";
8380
+ on: string;
8381
+ summary?: string;
8382
+ message?: string;
8383
+ found?: unknown;
8384
+ property?: string;
8385
+ expected?: string;
8386
+ };
8387
+ };
8388
+ };
8389
+ };
8390
+ };
8391
+ };
8392
+ };
8393
+ } & {
8394
+ fleet: {
8395
+ machine: {};
8396
+ } & {
8397
+ machine: {
8398
+ get: {
8399
+ body: unknown;
8400
+ params: {};
8401
+ query: {
8402
+ pagination: {
8403
+ size: number;
8404
+ page: number;
8405
+ };
8406
+ };
8407
+ headers: unknown;
8408
+ response: {
8409
+ 200: {
8410
+ totalCount: number;
8411
+ totalPage: number;
8412
+ result: Omit<{
8413
+ totalCount: number;
8414
+ companyId: string | null;
8415
+ machineKindId: string;
8416
+ customerId: string | null;
8417
+ name: string | null;
8418
+ assetCode: string | null;
8419
+ vin: string | null;
8420
+ licensePlate: string | null;
8421
+ color: string | null;
8422
+ engineCc: string | null;
8423
+ cylinder: string | null;
8424
+ gasType: string | null;
8425
+ transmissionType: string | null;
8426
+ vehicleType: string | null;
8427
+ yearManufacture: number | null;
8428
+ yearImport: number | null;
8429
+ steering: string | null;
8430
+ engineCode: string | null;
8431
+ transmissionCode: string | null;
8432
+ driveTrain: string | null;
8433
+ km: number;
8434
+ customData: unknown;
8435
+ id: string;
8436
+ createdAt: string;
8437
+ updatedAt: string;
8438
+ deletedAt: string | null;
8439
+ oldId: number | null;
8440
+ }, "totalCount">[];
8441
+ };
8442
+ 401: "Session not found";
8443
+ 422: {
8444
+ type: "validation";
8445
+ on: string;
8446
+ summary?: string;
8447
+ message?: string;
8448
+ found?: unknown;
8449
+ property?: string;
8450
+ expected?: string;
8451
+ };
8452
+ };
8453
+ };
8454
+ };
8455
+ } & {
8456
+ machine: {
8457
+ post: {
8458
+ body: {
8459
+ name?: string | null | undefined;
8460
+ companyId?: string | null | undefined;
8461
+ oldId?: number | null | undefined;
8462
+ customerId?: string | null | undefined;
8463
+ licensePlate?: string | null | undefined;
8464
+ assetCode?: string | null | undefined;
8465
+ vin?: string | null | undefined;
8466
+ color?: string | null | undefined;
8467
+ engineCc?: string | null | undefined;
8468
+ cylinder?: string | null | undefined;
8469
+ gasType?: string | null | undefined;
8470
+ transmissionType?: string | null | undefined;
8471
+ vehicleType?: string | null | undefined;
8472
+ yearManufacture?: number | null | undefined;
8473
+ yearImport?: number | null | undefined;
8474
+ steering?: string | null | undefined;
8475
+ engineCode?: string | null | undefined;
8476
+ transmissionCode?: string | null | undefined;
8477
+ driveTrain?: string | null | undefined;
8478
+ km?: number | undefined;
8479
+ customData?: import("drizzle-typebox").Json | undefined;
8480
+ machineKindId: string;
8481
+ };
8482
+ params: {};
8483
+ query: unknown;
8484
+ headers: unknown;
8485
+ response: {
8486
+ 401: "Session not found";
8487
+ 422: {
8488
+ type: "validation";
8489
+ on: string;
8490
+ summary?: string;
8491
+ message?: string;
8492
+ found?: unknown;
8493
+ property?: string;
8494
+ expected?: string;
8495
+ };
8496
+ };
8497
+ };
8498
+ };
8499
+ } & {
8500
+ machine: {
8501
+ ":id": {
8502
+ put: {
8503
+ body: {
8504
+ name?: string | null | undefined;
8505
+ companyId?: string | null | undefined;
8506
+ oldId?: number | null | undefined;
8507
+ customerId?: string | null | undefined;
8508
+ licensePlate?: string | null | undefined;
8509
+ machineKindId?: string | undefined;
8510
+ assetCode?: string | null | undefined;
8511
+ vin?: string | null | undefined;
8512
+ color?: string | null | undefined;
8513
+ engineCc?: string | null | undefined;
8514
+ cylinder?: string | null | undefined;
8515
+ gasType?: string | null | undefined;
8516
+ transmissionType?: string | null | undefined;
8517
+ vehicleType?: string | null | undefined;
8518
+ yearManufacture?: number | null | undefined;
8519
+ yearImport?: number | null | undefined;
8520
+ steering?: string | null | undefined;
8521
+ engineCode?: string | null | undefined;
8522
+ transmissionCode?: string | null | undefined;
8523
+ driveTrain?: string | null | undefined;
8524
+ km?: number | undefined;
8525
+ customData?: import("drizzle-typebox").Json | undefined;
8526
+ };
8527
+ params: {
8528
+ id: string;
8529
+ };
8530
+ query: unknown;
8531
+ headers: unknown;
8532
+ response: {
8533
+ 401: "Session not found";
8534
+ 422: {
8535
+ type: "validation";
8536
+ on: string;
8537
+ summary?: string;
8538
+ message?: string;
8539
+ found?: unknown;
8540
+ property?: string;
8541
+ expected?: string;
8542
+ };
8543
+ };
8544
+ };
8545
+ };
8546
+ };
8547
+ } & {
8548
+ machine: {
8549
+ ":id": {
8550
+ delete: {
8551
+ body: unknown;
8552
+ params: {
8553
+ id: string;
8554
+ };
8555
+ query: unknown;
8556
+ headers: unknown;
8557
+ response: {
8558
+ 401: "Session not found";
8559
+ 422: {
8560
+ type: "validation";
8561
+ on: string;
8562
+ summary?: string;
8563
+ message?: string;
8564
+ found?: unknown;
8565
+ property?: string;
8566
+ expected?: string;
8567
+ };
8568
+ };
8569
+ };
8570
+ };
8571
+ };
8572
+ };
8257
8573
  };
8258
8574
  }, {
8259
8575
  derive: {};
package/dist/index.js CHANGED
@@ -142503,6 +142503,7 @@ __export(exports_schema, {
142503
142503
  companyServiceBookingTable: () => companyServiceBookingTable,
142504
142504
  companySchema: () => companySchema,
142505
142505
  companyPackageTable: () => companyPackageTable,
142506
+ companyMachineTable: () => companyMachineTable,
142506
142507
  companyEmployeeTable: () => companyEmployeeTable,
142507
142508
  companyCompanyTable: () => companyCompanyTable,
142508
142509
  companyBranchWorkSchdedule: () => companyBranchWorkSchdedule,
@@ -142749,6 +142750,30 @@ var companyAccountTable = companySchema.table("account", {
142749
142750
  account: varchar().notNull(),
142750
142751
  description: varchar()
142751
142752
  });
142753
+ var companyMachineTable = companySchema.table("machine", {
142754
+ ...base_schema_helper_default,
142755
+ companyId: uuid5(),
142756
+ machineKindId: uuid5().notNull(),
142757
+ customerId: uuid5(),
142758
+ name: varchar(),
142759
+ assetCode: varchar(),
142760
+ vin: varchar().unique(),
142761
+ licensePlate: varchar(),
142762
+ color: varchar(),
142763
+ engineCc: varchar(),
142764
+ cylinder: varchar(),
142765
+ gasType: varchar(),
142766
+ transmissionType: varchar(),
142767
+ vehicleType: varchar(),
142768
+ yearManufacture: integer2(),
142769
+ yearImport: integer2(),
142770
+ steering: varchar(),
142771
+ engineCode: varchar(),
142772
+ transmissionCode: varchar(),
142773
+ driveTrain: varchar(),
142774
+ km: integer2().notNull().default(0),
142775
+ customData: jsonb()
142776
+ });
142752
142777
  // src/lib/db/schema/crm.schema.ts
142753
142778
  var crmSchema = pgSchema("crm");
142754
142779
  var crmCustomerTable = crmSchema.table("customer", {
@@ -147455,7 +147480,7 @@ var WarehouseItemLogic;
147455
147480
  name: user.name,
147456
147481
  kind: user.kind
147457
147482
  }
147458
- }).from(warehouseItemTransactionTable).where(filter).leftJoin(warehouseProductTable, eq(warehouseItemTransactionTable.productId, warehouseProductTable.id)).leftJoin(warehouseItemTable, eq(warehouseItemTransactionTable.itemId, warehouseItemTable.id)).leftJoin(user, eq(warehouseItemTransactionTable.userId, user.id)).$dynamic();
147483
+ }).from(warehouseItemTransactionTable).where(filter).leftJoin(warehouseProductTable, eq(warehouseItemTransactionTable.productId, warehouseProductTable.id)).leftJoin(warehouseItemTable, eq(warehouseItemTransactionTable.itemId, warehouseItemTable.id)).leftJoin(user, eq(warehouseItemTransactionTable.userId, user.id)).orderBy(desc(warehouseItemTransactionTable.createdAt)).$dynamic();
147459
147484
  const result = await pagination_helper_default(baseQuery, query.pagination);
147460
147485
  const content = {
147461
147486
  totalCount: result[0]?.totalCount ?? 0,
@@ -154399,8 +154424,134 @@ var inspectionRoutes2 = new Elysia({
154399
154424
  });
154400
154425
  var inspection_default2 = inspectionRoutes2;
154401
154426
 
154427
+ // src/routes/fleet/machine/logic.ts
154428
+ var MachineLogic;
154429
+ ((MachineLogic) => {
154430
+ MachineLogic.select = async (query, user2) => {
154431
+ const filter = and(or(isNull2(companyMachineTable.companyId), eq(companyMachineTable.companyId, user2.companyId).if(user2.kind !== "ADMIN")));
154432
+ const columns = getTableColumns(companyMachineTable);
154433
+ const baseQuery = db_default.select({
154434
+ ...columns,
154435
+ totalCount: totalCountSql
154436
+ }).from(companyMachineTable).where(filter).$dynamic();
154437
+ const result = await pagination_helper_default(baseQuery, query.pagination);
154438
+ return getPaginationContent(result, query.pagination.size);
154439
+ };
154440
+ MachineLogic.create = async (body, user2) => {
154441
+ await db_default.insert(companyMachineTable).values({
154442
+ ...body,
154443
+ companyId: user2.kind !== "ADMIN" ? user2.companyId : body.companyId
154444
+ });
154445
+ };
154446
+ MachineLogic.update = async (id, body, user2) => {
154447
+ await db_default.update(companyMachineTable).set({
154448
+ ...body
154449
+ }).where(and(eq(companyMachineTable.id, id), eq(companyMachineTable.companyId, user2.companyId).if(user2.kind !== "ADMIN")));
154450
+ };
154451
+ MachineLogic.remove = async (id, user2) => {
154452
+ await db_default.update(companyMachineTable).set({
154453
+ deletedAt: nowSql_helper_default
154454
+ }).where(and(eq(companyMachineTable.id, id), eq(companyMachineTable.companyId, user2.companyId).if(user2.kind !== "ADMIN")));
154455
+ };
154456
+ })(MachineLogic ||= {});
154457
+ var logic_default30 = MachineLogic;
154458
+
154459
+ // src/routes/fleet/machine/model.ts
154460
+ var MachineModel;
154461
+ ((MachineModel) => {
154462
+ const createSchema = createInsertSchema2(companyMachineTable);
154463
+ const updateSchema = createUpdateSchema(companyMachineTable);
154464
+ MachineModel.create = OmitBaseSchema(createSchema);
154465
+ MachineModel.update = OmitBaseSchema(updateSchema);
154466
+ MachineModel.select = t.Composite([PaginationSchema]);
154467
+ })(MachineModel ||= {});
154468
+ var model_default30 = MachineModel;
154469
+
154470
+ // src/routes/fleet/machine/index.ts
154471
+ var machineRoutes = new Elysia({
154472
+ prefix: "/machine",
154473
+ tags: ["FleetMachine"]
154474
+ }).use(better_auth_default).guard({
154475
+ auth: true
154476
+ }).get("/", async ({ query, user: user2 }) => logic_default30.select(query, user2), {
154477
+ query: model_default30.select
154478
+ }).post("/", async ({ body, user: user2 }) => logic_default30.create(body, user2), {
154479
+ body: model_default30.create
154480
+ }).guard({
154481
+ params: IdSchema
154482
+ }).put("/:id", async ({ body, params: { id }, user: user2 }) => logic_default30.update(id, body, user2), {
154483
+ body: model_default30.update
154484
+ }).delete("/:id", async ({ params: { id }, user: user2 }) => logic_default30.remove(id, user2));
154485
+ var machine_default = machineRoutes;
154486
+
154487
+ // src/routes/fleet/pm/template/logic.ts
154488
+ var PmTemplateLogic;
154489
+ ((PmTemplateLogic) => {
154490
+ PmTemplateLogic.select = async (query, user2) => {
154491
+ const filter = and(or(isNull2(pmTemplateTable.companyId), eq(pmTemplateTable.companyId, user2.companyId).if(user2.kind !== "ADMIN")));
154492
+ const columns = getTableColumns(pmTemplateTable);
154493
+ const baseQuery = db_default.select({
154494
+ ...columns,
154495
+ totalCount: totalCountSql
154496
+ }).from(pmTemplateTable).where(filter).$dynamic();
154497
+ const result = await pagination_helper_default(baseQuery, query.pagination);
154498
+ return getPaginationContent(result, query.pagination.size);
154499
+ };
154500
+ PmTemplateLogic.create = async (body, user2) => {
154501
+ await db_default.insert(pmTemplateTable).values({
154502
+ ...body,
154503
+ companyId: user2.kind !== "ADMIN" ? user2.companyId : body.companyId
154504
+ });
154505
+ };
154506
+ PmTemplateLogic.update = async (id, body, user2) => {
154507
+ await db_default.update(pmTemplateTable).set({
154508
+ ...body
154509
+ }).where(and(eq(pmTemplateTable.id, id), eq(pmTemplateTable.companyId, user2.companyId).if(user2.kind !== "ADMIN")));
154510
+ };
154511
+ PmTemplateLogic.remove = async (id, user2) => {
154512
+ await db_default.update(pmTemplateTable).set({
154513
+ deletedAt: nowSql_helper_default
154514
+ }).where(and(eq(pmTemplateTable.id, id), eq(pmTemplateTable.companyId, user2.companyId).if(user2.kind !== "ADMIN")));
154515
+ };
154516
+ })(PmTemplateLogic ||= {});
154517
+ var logic_default31 = PmTemplateLogic;
154518
+
154519
+ // src/routes/fleet/pm/template/model.ts
154520
+ var PmTemplateModel;
154521
+ ((PmTemplateModel) => {
154522
+ const createSchema = createInsertSchema2(pmTemplateTable);
154523
+ const updateSchema = createUpdateSchema(pmTemplateTable);
154524
+ PmTemplateModel.create = OmitBaseSchema(createSchema);
154525
+ PmTemplateModel.update = OmitBaseSchema(updateSchema);
154526
+ PmTemplateModel.select = t.Composite([PaginationSchema]);
154527
+ })(PmTemplateModel ||= {});
154528
+ var model_default31 = PmTemplateModel;
154529
+
154530
+ // src/routes/fleet/pm/template/index.ts
154531
+ var templateRoutes2 = new Elysia({
154532
+ prefix: "/template",
154533
+ tags: ["PmTemplate"]
154534
+ }).use(better_auth_default).guard({
154535
+ userKind: "COMPANY_ADMIN"
154536
+ }).get("/", async ({ query, user: user2 }) => logic_default31.select(query, user2), {
154537
+ query: model_default31.select
154538
+ }).post("/", async ({ body, user: user2 }) => logic_default31.create(body, user2), {
154539
+ body: model_default31.create
154540
+ }).guard({
154541
+ params: IdSchema
154542
+ }).put("/:id", async ({ body, params: { id }, user: user2 }) => logic_default31.update(id, body, user2), {
154543
+ body: model_default31.update
154544
+ }).delete("/:id", async ({ params: { id }, user: user2 }) => logic_default31.remove(id, user2));
154545
+ var template_default2 = templateRoutes2;
154546
+
154547
+ // src/routes/fleet/pm/index.ts
154548
+ var pmRoutes = new Elysia({
154549
+ prefix: "/pm"
154550
+ }).use(template_default2);
154551
+ var pm_default = pmRoutes;
154552
+
154402
154553
  // src/routes/fleet/index.ts
154403
- var fleetRoutes = new Elysia({ prefix: "/fleet" }).use(inspection_default2);
154554
+ var fleetRoutes = new Elysia({ prefix: "/fleet" }).use(inspection_default2).use(pm_default).use(machine_default);
154404
154555
  var fleet_default = fleetRoutes;
154405
154556
 
154406
154557
  // src/routes/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autosync_backend2",
3
- "version": "1.2.27",
3
+ "version": "1.2.28",
4
4
  "module": "src/index.ts",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",