autosync_backend2 1.2.92 → 1.2.96

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
@@ -11845,7 +11845,8 @@ export declare const app: Elysia<"", {
11845
11845
  body: unknown;
11846
11846
  params: {};
11847
11847
  query: {
11848
- workOrderId?: string | null | undefined;
11848
+ workOrderId?: string | undefined;
11849
+ isWorkOrderId?: boolean | undefined;
11849
11850
  pagination: {
11850
11851
  size: number;
11851
11852
  page: number;
package/dist/index.js CHANGED
@@ -282464,7 +282464,7 @@ class Pocket {
282464
282464
  }
282465
282465
 
282466
282466
  // src/routes/crm/cpOrder/payment/gateways/index.ts
282467
- var CALLBACK_URL = env_default.NODE_ENV === "production" ? "https://v2.api.autosync.mn/api/crm/cp-order/payment" : "http://202.70.40.82:3000/api/crm/cp-order/payment";
282467
+ var CALLBACK_URL = env_default.NODE_ENV === "production" ? "https://api.autosync.mn/api/crm/cp-order/payment" : "http://202.70.40.82:3000/api/crm/cp-order/payment";
282468
282468
 
282469
282469
  class PaymentGateway {
282470
282470
  token = undefined;
@@ -283228,6 +283228,19 @@ var CrmCpOrderPaymentLogic;
283228
283228
  return status("Internal Server Error", "\u0421\u0435\u0440\u0432\u0435\u0440 \u0430\u043B\u0434\u0430\u0430 \u0433\u0430\u0440\u043B\u0430\u0430");
283229
283229
  }
283230
283230
  };
283231
+ CrmCpOrderPaymentLogic.getPocketData = async (body) => {
283232
+ const filter = and(eq(crmCpOrderTable.companyId, body.companyId).if(body.companyId), eq(crmCpOrderPaymentTable.state, "PAID"));
283233
+ const [payments, total] = await Promise.all([
283234
+ db_default.select().from(crmCpOrderPaymentTable).innerJoin(crmCpOrderTable, eq(crmCpOrderTable.id, crmCpOrderPaymentTable.cpOrderId)).where(filter),
283235
+ db_default.select({
283236
+ total: sum(crmCpOrderPaymentTable.amount)
283237
+ }).from(crmCpOrderPaymentTable).innerJoin(crmCpOrderTable, eq(crmCpOrderTable.id, crmCpOrderPaymentTable.cpOrderId)).where(filter)
283238
+ ]);
283239
+ return {
283240
+ payments,
283241
+ totalAmount: total[0]?.total ?? 0
283242
+ };
283243
+ };
283231
283244
  })(CrmCpOrderPaymentLogic ||= {});
283232
283245
  var getPaymentInfo = async (type, user2) => {
283233
283246
  const cacheKey = `crm_payment:${user2.companyId}:${type}:${user2.branchId ?? "null"}`;
@@ -284037,6 +284050,9 @@ var CrmCpOrderPaymentModel;
284037
284050
  CrmCpOrderPaymentModel.wsBody = t.Object({
284038
284051
  state: t.UnionEnum(["PENDING", "PAID", "CANCELED"])
284039
284052
  });
284053
+ CrmCpOrderPaymentModel.getPocketData = t.Partial(t.Object({
284054
+ companyId: t.String({ format: "uuid" })
284055
+ }));
284040
284056
  })(CrmCpOrderPaymentModel ||= {});
284041
284057
  var model_default13 = CrmCpOrderPaymentModel;
284042
284058
 
@@ -286556,7 +286572,7 @@ var model_default37 = WorkOrderModel;
286556
286572
  var WorkOrderTaskLogic;
286557
286573
  ((WorkOrderTaskLogic) => {
286558
286574
  WorkOrderTaskLogic.select = async (query) => {
286559
- const filter = and(softDeletedFilter(workOrderTaskTable), eq(workOrderTaskTable.workOrderId, query.workOrderId).if(query.workOrderId), isNull2(workOrderTaskTable.workOrderId).if(query.workOrderId === null));
286575
+ const filter = and(softDeletedFilter(workOrderTaskTable), eq(workOrderTaskTable.workOrderId, query.workOrderId).if(query.workOrderId), isNull2(workOrderTaskTable.workOrderId).if(query.isWorkOrderId === false), isNotNull(workOrderTaskTable.workOrderId).if(query.isWorkOrderId === true));
286560
286576
  const companyServiceKind = alias(companyServiceKindTable, "companyServiceKind");
286561
286577
  const baseQuery = db_default.select({
286562
286578
  task: workOrderTaskTable,
@@ -286598,7 +286614,8 @@ var WorkOrderTaskModel;
286598
286614
  WorkOrderTaskModel.select = t.Composite([
286599
286615
  PaginationSchema,
286600
286616
  t.Partial(t.Object({
286601
- workOrderId: t.Nullable(t.String({ format: "uuid" }))
286617
+ workOrderId: t.String({ format: "uuid" }),
286618
+ isWorkOrderId: t.Boolean()
286602
286619
  }))
286603
286620
  ]);
286604
286621
  })(WorkOrderTaskModel ||= {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autosync_backend2",
3
- "version": "1.2.92",
3
+ "version": "1.2.96",
4
4
  "module": "src/index.ts",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",