autosync_backend2 1.2.26 → 1.2.27

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
@@ -41,7 +41,7 @@ export declare const app: Elysia<"", {
41
41
  route: string;
42
42
  request: Request;
43
43
  store: {};
44
- status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 100 | 200 | 400 | 101 | 102 | 103 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 300 | 301 | 302 | 303 | 304 | 307 | 308 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
44
+ status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 200 | 400 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 300 | 301 | 302 | 303 | 304 | 307 | 308 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
45
45
  readonly 100: "Continue";
46
46
  readonly 101: "Switching Protocols";
47
47
  readonly 102: "Processing";
@@ -199,7 +199,7 @@ export declare const app: Elysia<"", {
199
199
  route: string;
200
200
  request: Request;
201
201
  store: {};
202
- status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 100 | 200 | 400 | 101 | 102 | 103 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 300 | 301 | 302 | 303 | 304 | 307 | 308 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
202
+ status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 200 | 400 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 300 | 301 | 302 | 303 | 304 | 307 | 308 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
203
203
  readonly 100: "Continue";
204
204
  readonly 101: "Switching Protocols";
205
205
  readonly 102: "Processing";
@@ -357,7 +357,7 @@ export declare const app: Elysia<"", {
357
357
  route: string;
358
358
  request: Request;
359
359
  store: {};
360
- status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 100 | 200 | 400 | 101 | 102 | 103 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 300 | 301 | 302 | 303 | 304 | 307 | 308 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
360
+ status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 200 | 400 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 300 | 301 | 302 | 303 | 304 | 307 | 308 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
361
361
  readonly 100: "Continue";
362
362
  readonly 101: "Switching Protocols";
363
363
  readonly 102: "Processing";
@@ -1335,6 +1335,18 @@ export declare const app: Elysia<"", {
1335
1335
  };
1336
1336
  };
1337
1337
  };
1338
+ } & {
1339
+ item: {
1340
+ order: {
1341
+ post: {
1342
+ body: unknown;
1343
+ params: {};
1344
+ query: unknown;
1345
+ headers: unknown;
1346
+ response: {};
1347
+ };
1348
+ };
1349
+ };
1338
1350
  } & {
1339
1351
  item: {
1340
1352
  ":id": {
@@ -4779,6 +4791,7 @@ export declare const app: Elysia<"", {
4779
4791
  params: {};
4780
4792
  query: {
4781
4793
  name?: string | undefined;
4794
+ id?: string | undefined;
4782
4795
  companyBranchId?: string | null | undefined;
4783
4796
  priceTotal?: number | undefined;
4784
4797
  pagination: {
package/dist/index.js CHANGED
@@ -142447,6 +142447,12 @@ __export(exports_schema, {
142447
142447
  techdocSchema: () => techdocSchema,
142448
142448
  techdocProductTable: () => techdocProductTable,
142449
142449
  session: () => session,
142450
+ pmTemplateTable: () => pmTemplateTable,
142451
+ pmTemplateProductTable: () => pmTemplateProductTable,
142452
+ pmSchema: () => pmSchema,
142453
+ pmPlanTable: () => pmPlanTable,
142454
+ pmPlanProductTable: () => pmPlanProductTable,
142455
+ pmPlanMachineTable: () => pmPlanMachineTable,
142450
142456
  permissionTable: () => permissionTable,
142451
142457
  permissionGroupTable: () => permissionGroupTable,
142452
142458
  logTable: () => logTable,
@@ -143078,6 +143084,53 @@ var inspectionScheduleTable = inspectionSchema.table("schedule", {
143078
143084
  timeNextDue: timestamp({ withTimezone: true }),
143079
143085
  isActive: boolean4().notNull().default(true)
143080
143086
  });
143087
+ var pmSchema = pgSchema("pm");
143088
+ var pmTemplateTable = pmSchema.table("template", {
143089
+ ...base_schema_helper_default,
143090
+ machineKindId: uuid5().notNull(),
143091
+ companyId: uuid5(),
143092
+ operationAmount: numeric({ mode: "number" }),
143093
+ uomId: uuid5().notNull(),
143094
+ serviceKindId: uuid5().notNull(),
143095
+ name: varchar().notNull(),
143096
+ description: text()
143097
+ });
143098
+ var pmTemplateProductTable = pmSchema.table("template_product", {
143099
+ ...base_schema_helper_default,
143100
+ pmTemplateId: uuid5().notNull(),
143101
+ productKindId: uuid5().notNull(),
143102
+ quantity: numeric({ mode: "number" }),
143103
+ uomId: uuid5().notNull()
143104
+ });
143105
+ var pmPlanTable = pmSchema.table("plan", {
143106
+ ...base_schema_helper_default,
143107
+ companyId: uuid5().notNull(),
143108
+ name: varchar().notNull(),
143109
+ description: text(),
143110
+ dateStart: timestamp({
143111
+ withTimezone: true
143112
+ }),
143113
+ dateEnd: timestamp({
143114
+ withTimezone: true
143115
+ })
143116
+ });
143117
+ var pmPlanMachineTable = pmSchema.table("plan_machine", {
143118
+ ...base_schema_helper_default,
143119
+ pmPlanId: uuid5().notNull(),
143120
+ pmTemplateId: uuid5().notNull(),
143121
+ machineId: uuid5().notNull(),
143122
+ employeeCreatedId: uuid5().notNull(),
143123
+ userCreatedId: uuid5().notNull(),
143124
+ note: text()
143125
+ });
143126
+ var pmPlanProductTable = pmSchema.table("plan_product", {
143127
+ ...base_schema_helper_default,
143128
+ pmPlanId: uuid5().notNull(),
143129
+ productKindId: uuid5().notNull(),
143130
+ uomId: uuid5().notNull(),
143131
+ quantity: numeric({ mode: "number" }),
143132
+ pmQuantity: uuid5().notNull()
143133
+ });
143081
143134
  // src/lib/db/schema/techdoc.schema.ts
143082
143135
  var techdocSchema = pgSchema("techdoc");
143083
143136
  var techdocVehicleKindEnum = pgEnum("vehicle_kind_enum", [
@@ -146125,7 +146178,10 @@ var auth2 = betterAuth({
146125
146178
  console[level](...args);
146126
146179
  }
146127
146180
  },
146128
- trustedOrigins: ["https://user.autosync.mn", "https://admin.autosync.mn"]
146181
+ trustedOrigins: ["https://user.autosync.mn", "https://admin.autosync.mn"],
146182
+ advanced: {
146183
+ useSecureCookies: false
146184
+ }
146129
146185
  });
146130
146186
  var _schema;
146131
146187
  var getSchema2 = async () => _schema ??= auth2.api.generateOpenAPISchema();
@@ -146390,7 +146446,6 @@ var PaginationSchema = t.Object({
146390
146446
  default: 1
146391
146447
  }),
146392
146448
  size: t.Integer({
146393
- maximum: 100,
146394
146449
  default: 25,
146395
146450
  minimum: 1
146396
146451
  })
@@ -147287,7 +147342,7 @@ var WarehouseItemLogic;
147287
147342
  supplier: techdocSupplierTable,
147288
147343
  product: warehouseProductTable,
147289
147344
  totalCount: totalCountSql
147290
- }).from(warehouseItemTable).where(filter).innerJoin(warehouseProductTable, and(eq(warehouseItemTable.productId, warehouseProductTable.id), isNull2(warehouseProductTable.deletedAt))).leftJoin(techdocSupplierTable, eq(warehouseProductTable.supplierId, techdocSupplierTable.id)).orderBy(desc(warehouseItemTable.createdAt)).$dynamic();
147345
+ }).from(warehouseItemTable).where(filter).innerJoin(warehouseProductTable, and(eq(warehouseItemTable.productId, warehouseProductTable.id), isNull2(warehouseProductTable.deletedAt))).leftJoin(techdocSupplierTable, eq(warehouseProductTable.supplierId, techdocSupplierTable.id)).orderBy(warehouseItemTable.order, desc(warehouseItemTable.createdAt)).$dynamic();
147291
147346
  const result = await pagination_helper_default(baseQuery, query.pagination);
147292
147347
  const content = {
147293
147348
  totalCount: result[0]?.totalCount ?? 0,
@@ -147772,7 +147827,7 @@ var CrmSpPackageLogic;
147772
147827
  };
147773
147828
  CrmSpPackageLogic.select = async (query, user2) => {
147774
147829
  const columns = getTableColumns(crmSpPackageTable);
147775
- const filter = and(eq(crmSpPackageTable.companyId, user2.companyId), ilike(crmSpPackageTable.name, `%${query.name}%`).if(query.name), eq(crmSpPackageTable.priceTotal, query.priceTotal ?? 0).if(query.priceTotal), or(isNull2(crmSpPackageTable.companyBranchId), eq(crmSpPackageTable.companyBranchId, user2.branchId))?.if(user2.kind === "CUSTOMER"), eq(crmSpPackageTable.companyBranchId, query.companyBranchId ?? "").if(query.companyBranchId), softDeletedFilter(crmSpPackageTable));
147830
+ const filter = and(eq(crmSpPackageTable.companyId, user2.companyId), ilike(crmSpPackageTable.name, `%${query.name}%`).if(query.name), eq(crmSpPackageTable.priceTotal, query.priceTotal ?? 0).if(query.priceTotal), or(isNull2(crmSpPackageTable.companyBranchId), eq(crmSpPackageTable.companyBranchId, user2.branchId))?.if(user2.kind === "CUSTOMER"), eq(crmSpPackageTable.companyBranchId, query.companyBranchId ?? "").if(query.companyBranchId), eq(crmSpPackageTable.id, query.id).if(query.id), softDeletedFilter(crmSpPackageTable));
147776
147831
  const baseQuery = db_default.select({
147777
147832
  ...columns,
147778
147833
  totalCount: totalCountSql,
@@ -151070,7 +151125,7 @@ var CrmCpOrderLogic;
151070
151125
  t2.make.id,
151071
151126
  t2.model.id,
151072
151127
  t2.customer.id
151073
- ]).orderBy(desc(crmCpOrderTable.createdAt), desc(crmCpOrderItemTable.createdAt)).$dynamic();
151128
+ ]).orderBy(desc(crmCpOrderTable.createdAt)).$dynamic();
151074
151129
  const result = await pagination_helper_default(baseQuery, query.pagination);
151075
151130
  const content = {
151076
151131
  totalCount: result[0]?.totalCount ?? 0,
@@ -152865,7 +152920,7 @@ var CrmSpPackageModel;
152865
152920
  CrmSpPackageModel.update = t.Omit(OmitBaseSchema(updateSchema), ["companyId"]);
152866
152921
  CrmSpPackageModel.select = t.Composite([
152867
152922
  PaginationSchema,
152868
- t.Partial(t.Pick(selectSchema, ["name", "priceTotal", "companyBranchId"]))
152923
+ t.Partial(t.Pick(selectSchema, ["name", "priceTotal", "companyBranchId", "id"]))
152869
152924
  ]);
152870
152925
  })(CrmSpPackageModel ||= {});
152871
152926
  var model_default15 = CrmSpPackageModel;
@@ -153909,6 +153964,15 @@ var itemRoutes2 = new Elysia({
153909
153964
  query: model_default23.selectTransaction
153910
153965
  }).post("/change-quantity", async ({ body, user: user2 }) => logic_default6.changeQuantity(body, user2), {
153911
153966
  body: model_default23.changeQuantity
153967
+ }).post("/order", async ({ user: user2 }) => {
153968
+ const current = await db_default.select({
153969
+ id: warehouseItemTable.id
153970
+ }).from(warehouseItemTable).innerJoin(warehouseProductTable, eq(warehouseItemTable.productId, warehouseProductTable.id)).where(eq(warehouseProductTable.companyId, user2.companyId)).orderBy(warehouseProductTable.oldId);
153971
+ for (const [index2, item] of current.entries()) {
153972
+ await db_default.update(warehouseItemTable).set({
153973
+ order: (index2 + 1) / 10
153974
+ }).where(eq(warehouseItemTable.id, item.id));
153975
+ }
153912
153976
  }).guard({
153913
153977
  params: IdSchema
153914
153978
  }).put("/:id", async ({ body, params: { id } }) => logic_default6.update(id, body), {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autosync_backend2",
3
- "version": "1.2.26",
3
+ "version": "1.2.27",
4
4
  "module": "src/index.ts",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",