autosync_backend2 1.2.100 → 1.2.102
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 +270 -270
- package/dist/index.js +190 -186
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -299593,6 +299593,190 @@ var permissionGroupTable = pgTable("permission_group", {
|
|
|
299593
299593
|
name: text().notNull(),
|
|
299594
299594
|
permissions: text().array().notNull().default([])
|
|
299595
299595
|
});
|
|
299596
|
+
// src/lib/db/schema/casstime.schema.ts
|
|
299597
|
+
var bulkTradeSchema = pgSchema("bulk_trade");
|
|
299598
|
+
var btProductTable = bulkTradeSchema.table("product", {
|
|
299599
|
+
...base_schema_helper_default,
|
|
299600
|
+
companyId: uuid5().notNull(),
|
|
299601
|
+
warehouseItemId: uuid5().notNull(),
|
|
299602
|
+
productId: uuid5(),
|
|
299603
|
+
baseQuantity: integer2().notNull().default(0),
|
|
299604
|
+
uomId: uuid5(),
|
|
299605
|
+
price: numeric({
|
|
299606
|
+
mode: "number"
|
|
299607
|
+
}).notNull().default(0),
|
|
299608
|
+
currency: varchar({ length: 3 }).notNull().default("MNT")
|
|
299609
|
+
});
|
|
299610
|
+
var btOrderStateEnum = bulkTradeSchema.enum("order_state", [
|
|
299611
|
+
"DRAFT",
|
|
299612
|
+
"CONFIRMED",
|
|
299613
|
+
"PROCESSING",
|
|
299614
|
+
"SHIPPED",
|
|
299615
|
+
"DELIVERED",
|
|
299616
|
+
"CANCELLED",
|
|
299617
|
+
"ON_HOLD",
|
|
299618
|
+
"PARTIALLY_SHIPPED",
|
|
299619
|
+
"PARTIALLY_DELIVERED"
|
|
299620
|
+
]);
|
|
299621
|
+
var btOrderTable = bulkTradeSchema.table("order", {
|
|
299622
|
+
...base_schema_helper_default,
|
|
299623
|
+
orderCode: varchar().notNull().unique(),
|
|
299624
|
+
customerId: varchar().notNull(),
|
|
299625
|
+
customerName: varchar().notNull(),
|
|
299626
|
+
deliveryAddress: varchar().notNull(),
|
|
299627
|
+
companySupplierId: uuid5(),
|
|
299628
|
+
companyClientId: uuid5().notNull(),
|
|
299629
|
+
state: btOrderStateEnum().notNull().default("DRAFT"),
|
|
299630
|
+
priceTotal: numeric({
|
|
299631
|
+
mode: "number"
|
|
299632
|
+
}).notNull(),
|
|
299633
|
+
currency: varchar(),
|
|
299634
|
+
extraData: jsonb(),
|
|
299635
|
+
orderDate: timestamp({
|
|
299636
|
+
withTimezone: true,
|
|
299637
|
+
mode: "string"
|
|
299638
|
+
}),
|
|
299639
|
+
requestedDeliveryDate: timestamp({
|
|
299640
|
+
withTimezone: true,
|
|
299641
|
+
mode: "string"
|
|
299642
|
+
}),
|
|
299643
|
+
timeConfirmed: timestamp({
|
|
299644
|
+
withTimezone: true,
|
|
299645
|
+
mode: "string"
|
|
299646
|
+
}),
|
|
299647
|
+
timeShipped: timestamp({
|
|
299648
|
+
withTimezone: true,
|
|
299649
|
+
mode: "string"
|
|
299650
|
+
}),
|
|
299651
|
+
timeDelivered: timestamp({
|
|
299652
|
+
withTimezone: true,
|
|
299653
|
+
mode: "string"
|
|
299654
|
+
}),
|
|
299655
|
+
timeCancelled: timestamp({
|
|
299656
|
+
withTimezone: true,
|
|
299657
|
+
mode: "string"
|
|
299658
|
+
})
|
|
299659
|
+
});
|
|
299660
|
+
var btOrderItemStateEnum = bulkTradeSchema.enum("order_item_state", [
|
|
299661
|
+
"PENDING",
|
|
299662
|
+
"RESERVED",
|
|
299663
|
+
"BACKORDERED",
|
|
299664
|
+
"SHIPPED",
|
|
299665
|
+
"DELIVERED",
|
|
299666
|
+
"CANCELLED"
|
|
299667
|
+
]);
|
|
299668
|
+
var btOrderItemTable = bulkTradeSchema.table("order_item", {
|
|
299669
|
+
...base_schema_helper_default,
|
|
299670
|
+
btOrderId: uuid5().notNull(),
|
|
299671
|
+
productId: uuid5().notNull(),
|
|
299672
|
+
skuId: varchar(),
|
|
299673
|
+
skuName: varchar(),
|
|
299674
|
+
partNumber: varchar(),
|
|
299675
|
+
quantity: integer2().notNull(),
|
|
299676
|
+
currency: varchar(),
|
|
299677
|
+
priceUnit: numeric({
|
|
299678
|
+
mode: "number"
|
|
299679
|
+
}).notNull(),
|
|
299680
|
+
priceTotal: numeric({
|
|
299681
|
+
mode: "number"
|
|
299682
|
+
}).notNull(),
|
|
299683
|
+
state: btOrderItemStateEnum().notNull().default("PENDING")
|
|
299684
|
+
});
|
|
299685
|
+
var btOrderReqStateEnum = bulkTradeSchema.enum("order_req_state", [
|
|
299686
|
+
"DRAFT",
|
|
299687
|
+
"SUBMITTED",
|
|
299688
|
+
"UNDER_REVIEW",
|
|
299689
|
+
"APPROVED",
|
|
299690
|
+
"REJECTED",
|
|
299691
|
+
"CANCELLED",
|
|
299692
|
+
"EXPIRED"
|
|
299693
|
+
]);
|
|
299694
|
+
var btOrderReqTable = bulkTradeSchema.table("order_req", {
|
|
299695
|
+
...base_schema_helper_default,
|
|
299696
|
+
btOrderId: uuid5().notNull(),
|
|
299697
|
+
companyClientId: uuid5().notNull(),
|
|
299698
|
+
priceTotal: numeric({
|
|
299699
|
+
mode: "number"
|
|
299700
|
+
}).notNull(),
|
|
299701
|
+
currency: varchar(),
|
|
299702
|
+
state: btOrderReqStateEnum().notNull().default("DRAFT"),
|
|
299703
|
+
timeSubmitted: timestamp({
|
|
299704
|
+
withTimezone: true,
|
|
299705
|
+
mode: "string"
|
|
299706
|
+
}),
|
|
299707
|
+
timeUnderReview: timestamp({
|
|
299708
|
+
withTimezone: true,
|
|
299709
|
+
mode: "string"
|
|
299710
|
+
}),
|
|
299711
|
+
timeApproved: timestamp({
|
|
299712
|
+
withTimezone: true,
|
|
299713
|
+
mode: "string"
|
|
299714
|
+
})
|
|
299715
|
+
});
|
|
299716
|
+
var btOrderReqItemTable = bulkTradeSchema.table("order_req_item", {
|
|
299717
|
+
...base_schema_helper_default,
|
|
299718
|
+
btOrderReqId: uuid5().notNull(),
|
|
299719
|
+
productId: uuid5().notNull(),
|
|
299720
|
+
skuId: varchar(),
|
|
299721
|
+
skuName: varchar(),
|
|
299722
|
+
partNumber: varchar(),
|
|
299723
|
+
quantity: integer2().notNull(),
|
|
299724
|
+
currency: varchar(),
|
|
299725
|
+
priceUnit: numeric({
|
|
299726
|
+
mode: "number"
|
|
299727
|
+
}).notNull(),
|
|
299728
|
+
priceTotal: numeric({
|
|
299729
|
+
mode: "number"
|
|
299730
|
+
}).notNull()
|
|
299731
|
+
});
|
|
299732
|
+
var btInvoiceStateEnum = bulkTradeSchema.enum("invoice_state", [
|
|
299733
|
+
"DRAFT",
|
|
299734
|
+
"ISSUED",
|
|
299735
|
+
"PARTIALLY_PAID",
|
|
299736
|
+
"PAID",
|
|
299737
|
+
"OVERDUE",
|
|
299738
|
+
"CANCELLED",
|
|
299739
|
+
"VOID"
|
|
299740
|
+
]);
|
|
299741
|
+
var btInvoiceTable = bulkTradeSchema.table("invoice", {
|
|
299742
|
+
...base_schema_helper_default,
|
|
299743
|
+
btOrderId: uuid5().notNull(),
|
|
299744
|
+
amountTotal: numeric({
|
|
299745
|
+
mode: "number"
|
|
299746
|
+
}).notNull(),
|
|
299747
|
+
dateStart: timestamp({
|
|
299748
|
+
withTimezone: true,
|
|
299749
|
+
mode: "string"
|
|
299750
|
+
}),
|
|
299751
|
+
dateEnd: timestamp({
|
|
299752
|
+
withTimezone: true,
|
|
299753
|
+
mode: "string"
|
|
299754
|
+
}),
|
|
299755
|
+
state: btInvoiceStateEnum().notNull().default("DRAFT"),
|
|
299756
|
+
paymentDate: timestamp({
|
|
299757
|
+
withTimezone: true,
|
|
299758
|
+
mode: "string"
|
|
299759
|
+
})
|
|
299760
|
+
});
|
|
299761
|
+
var btPaymentStateEnum = bulkTradeSchema.enum("payment_state", [
|
|
299762
|
+
"PENDING",
|
|
299763
|
+
"COMPLETED",
|
|
299764
|
+
"FAILED",
|
|
299765
|
+
"REFUNDED",
|
|
299766
|
+
"REVERSED"
|
|
299767
|
+
]);
|
|
299768
|
+
var btPaymentTable = bulkTradeSchema.table("payment", {
|
|
299769
|
+
...base_schema_helper_default,
|
|
299770
|
+
btInvoiceId: uuid5().notNull(),
|
|
299771
|
+
amount: numeric({
|
|
299772
|
+
mode: "number"
|
|
299773
|
+
}).notNull(),
|
|
299774
|
+
paymentMethod: varchar().notNull(),
|
|
299775
|
+
paymentChannel: varchar().notNull(),
|
|
299776
|
+
currency: varchar(),
|
|
299777
|
+
state: btPaymentStateEnum().notNull().default("PENDING"),
|
|
299778
|
+
note: text()
|
|
299779
|
+
});
|
|
299596
299780
|
// src/lib/db/schema/common.schema.ts
|
|
299597
299781
|
var logTable = pgTable("log", {
|
|
299598
299782
|
...base_schema_helper_default,
|
|
@@ -299863,7 +300047,7 @@ var companyMachineTable = companySchema.table("machine", {
|
|
|
299863
300047
|
});
|
|
299864
300048
|
var companyBillingPeriodEnum = companySchema.enum("billing_period", [
|
|
299865
300049
|
"MONTHLY",
|
|
299866
|
-
"
|
|
300050
|
+
"SEASONAL",
|
|
299867
300051
|
"YEARLY"
|
|
299868
300052
|
]);
|
|
299869
300053
|
var companyInvoiceStatusEnum = companySchema.enum("invoice_status", [
|
|
@@ -300495,190 +300679,6 @@ var warehouseTransferTable = warehouseSchema.table("transfer", {
|
|
|
300495
300679
|
}),
|
|
300496
300680
|
note: text()
|
|
300497
300681
|
});
|
|
300498
|
-
// src/lib/db/schema/casstime.schema.ts
|
|
300499
|
-
var bulkTradeSchema = pgSchema("bulk_trade");
|
|
300500
|
-
var btProductTable = bulkTradeSchema.table("product", {
|
|
300501
|
-
...base_schema_helper_default,
|
|
300502
|
-
companyId: uuid5().notNull(),
|
|
300503
|
-
warehouseItemId: uuid5().notNull(),
|
|
300504
|
-
productId: uuid5(),
|
|
300505
|
-
baseQuantity: integer2().notNull().default(0),
|
|
300506
|
-
uomId: uuid5(),
|
|
300507
|
-
price: numeric({
|
|
300508
|
-
mode: "number"
|
|
300509
|
-
}).notNull().default(0),
|
|
300510
|
-
currency: varchar({ length: 3 }).notNull().default("MNT")
|
|
300511
|
-
});
|
|
300512
|
-
var btOrderStateEnum = bulkTradeSchema.enum("order_state", [
|
|
300513
|
-
"DRAFT",
|
|
300514
|
-
"CONFIRMED",
|
|
300515
|
-
"PROCESSING",
|
|
300516
|
-
"SHIPPED",
|
|
300517
|
-
"DELIVERED",
|
|
300518
|
-
"CANCELLED",
|
|
300519
|
-
"ON_HOLD",
|
|
300520
|
-
"PARTIALLY_SHIPPED",
|
|
300521
|
-
"PARTIALLY_DELIVERED"
|
|
300522
|
-
]);
|
|
300523
|
-
var btOrderTable = bulkTradeSchema.table("order", {
|
|
300524
|
-
...base_schema_helper_default,
|
|
300525
|
-
orderCode: varchar().notNull().unique(),
|
|
300526
|
-
customerId: varchar().notNull(),
|
|
300527
|
-
customerName: varchar().notNull(),
|
|
300528
|
-
deliveryAddress: varchar().notNull(),
|
|
300529
|
-
companySupplierId: uuid5(),
|
|
300530
|
-
companyClientId: uuid5().notNull(),
|
|
300531
|
-
state: btOrderStateEnum().notNull().default("DRAFT"),
|
|
300532
|
-
priceTotal: numeric({
|
|
300533
|
-
mode: "number"
|
|
300534
|
-
}).notNull(),
|
|
300535
|
-
currency: varchar(),
|
|
300536
|
-
extraData: jsonb(),
|
|
300537
|
-
orderDate: timestamp({
|
|
300538
|
-
withTimezone: true,
|
|
300539
|
-
mode: "string"
|
|
300540
|
-
}),
|
|
300541
|
-
requestedDeliveryDate: timestamp({
|
|
300542
|
-
withTimezone: true,
|
|
300543
|
-
mode: "string"
|
|
300544
|
-
}),
|
|
300545
|
-
timeConfirmed: timestamp({
|
|
300546
|
-
withTimezone: true,
|
|
300547
|
-
mode: "string"
|
|
300548
|
-
}),
|
|
300549
|
-
timeShipped: timestamp({
|
|
300550
|
-
withTimezone: true,
|
|
300551
|
-
mode: "string"
|
|
300552
|
-
}),
|
|
300553
|
-
timeDelivered: timestamp({
|
|
300554
|
-
withTimezone: true,
|
|
300555
|
-
mode: "string"
|
|
300556
|
-
}),
|
|
300557
|
-
timeCancelled: timestamp({
|
|
300558
|
-
withTimezone: true,
|
|
300559
|
-
mode: "string"
|
|
300560
|
-
})
|
|
300561
|
-
});
|
|
300562
|
-
var btOrderItemStateEnum = bulkTradeSchema.enum("order_item_state", [
|
|
300563
|
-
"PENDING",
|
|
300564
|
-
"RESERVED",
|
|
300565
|
-
"BACKORDERED",
|
|
300566
|
-
"SHIPPED",
|
|
300567
|
-
"DELIVERED",
|
|
300568
|
-
"CANCELLED"
|
|
300569
|
-
]);
|
|
300570
|
-
var btOrderItemTable = bulkTradeSchema.table("order_item", {
|
|
300571
|
-
...base_schema_helper_default,
|
|
300572
|
-
btOrderId: uuid5().notNull(),
|
|
300573
|
-
productId: uuid5().notNull(),
|
|
300574
|
-
skuId: varchar(),
|
|
300575
|
-
skuName: varchar(),
|
|
300576
|
-
partNumber: varchar(),
|
|
300577
|
-
quantity: integer2().notNull(),
|
|
300578
|
-
currency: varchar(),
|
|
300579
|
-
priceUnit: numeric({
|
|
300580
|
-
mode: "number"
|
|
300581
|
-
}).notNull(),
|
|
300582
|
-
priceTotal: numeric({
|
|
300583
|
-
mode: "number"
|
|
300584
|
-
}).notNull(),
|
|
300585
|
-
state: btOrderItemStateEnum().notNull().default("PENDING")
|
|
300586
|
-
});
|
|
300587
|
-
var btOrderReqStateEnum = bulkTradeSchema.enum("order_req_state", [
|
|
300588
|
-
"DRAFT",
|
|
300589
|
-
"SUBMITTED",
|
|
300590
|
-
"UNDER_REVIEW",
|
|
300591
|
-
"APPROVED",
|
|
300592
|
-
"REJECTED",
|
|
300593
|
-
"CANCELLED",
|
|
300594
|
-
"EXPIRED"
|
|
300595
|
-
]);
|
|
300596
|
-
var btOrderReqTable = bulkTradeSchema.table("order_req", {
|
|
300597
|
-
...base_schema_helper_default,
|
|
300598
|
-
btOrderId: uuid5().notNull(),
|
|
300599
|
-
companyClientId: uuid5().notNull(),
|
|
300600
|
-
priceTotal: numeric({
|
|
300601
|
-
mode: "number"
|
|
300602
|
-
}).notNull(),
|
|
300603
|
-
currency: varchar(),
|
|
300604
|
-
state: btOrderReqStateEnum().notNull().default("DRAFT"),
|
|
300605
|
-
timeSubmitted: timestamp({
|
|
300606
|
-
withTimezone: true,
|
|
300607
|
-
mode: "string"
|
|
300608
|
-
}),
|
|
300609
|
-
timeUnderReview: timestamp({
|
|
300610
|
-
withTimezone: true,
|
|
300611
|
-
mode: "string"
|
|
300612
|
-
}),
|
|
300613
|
-
timeApproved: timestamp({
|
|
300614
|
-
withTimezone: true,
|
|
300615
|
-
mode: "string"
|
|
300616
|
-
})
|
|
300617
|
-
});
|
|
300618
|
-
var btOrderReqItemTable = bulkTradeSchema.table("order_req_item", {
|
|
300619
|
-
...base_schema_helper_default,
|
|
300620
|
-
btOrderReqId: uuid5().notNull(),
|
|
300621
|
-
productId: uuid5().notNull(),
|
|
300622
|
-
skuId: varchar(),
|
|
300623
|
-
skuName: varchar(),
|
|
300624
|
-
partNumber: varchar(),
|
|
300625
|
-
quantity: integer2().notNull(),
|
|
300626
|
-
currency: varchar(),
|
|
300627
|
-
priceUnit: numeric({
|
|
300628
|
-
mode: "number"
|
|
300629
|
-
}).notNull(),
|
|
300630
|
-
priceTotal: numeric({
|
|
300631
|
-
mode: "number"
|
|
300632
|
-
}).notNull()
|
|
300633
|
-
});
|
|
300634
|
-
var btInvoiceStateEnum = bulkTradeSchema.enum("invoice_state", [
|
|
300635
|
-
"DRAFT",
|
|
300636
|
-
"ISSUED",
|
|
300637
|
-
"PARTIALLY_PAID",
|
|
300638
|
-
"PAID",
|
|
300639
|
-
"OVERDUE",
|
|
300640
|
-
"CANCELLED",
|
|
300641
|
-
"VOID"
|
|
300642
|
-
]);
|
|
300643
|
-
var btInvoiceTable = bulkTradeSchema.table("invoice", {
|
|
300644
|
-
...base_schema_helper_default,
|
|
300645
|
-
btOrderId: uuid5().notNull(),
|
|
300646
|
-
amountTotal: numeric({
|
|
300647
|
-
mode: "number"
|
|
300648
|
-
}).notNull(),
|
|
300649
|
-
dateStart: timestamp({
|
|
300650
|
-
withTimezone: true,
|
|
300651
|
-
mode: "string"
|
|
300652
|
-
}),
|
|
300653
|
-
dateEnd: timestamp({
|
|
300654
|
-
withTimezone: true,
|
|
300655
|
-
mode: "string"
|
|
300656
|
-
}),
|
|
300657
|
-
state: btInvoiceStateEnum().notNull().default("DRAFT"),
|
|
300658
|
-
paymentDate: timestamp({
|
|
300659
|
-
withTimezone: true,
|
|
300660
|
-
mode: "string"
|
|
300661
|
-
})
|
|
300662
|
-
});
|
|
300663
|
-
var btPaymentStateEnum = bulkTradeSchema.enum("payment_state", [
|
|
300664
|
-
"PENDING",
|
|
300665
|
-
"COMPLETED",
|
|
300666
|
-
"FAILED",
|
|
300667
|
-
"REFUNDED",
|
|
300668
|
-
"REVERSED"
|
|
300669
|
-
]);
|
|
300670
|
-
var btPaymentTable = bulkTradeSchema.table("payment", {
|
|
300671
|
-
...base_schema_helper_default,
|
|
300672
|
-
btInvoiceId: uuid5().notNull(),
|
|
300673
|
-
amount: numeric({
|
|
300674
|
-
mode: "number"
|
|
300675
|
-
}).notNull(),
|
|
300676
|
-
paymentMethod: varchar().notNull(),
|
|
300677
|
-
paymentChannel: varchar().notNull(),
|
|
300678
|
-
currency: varchar(),
|
|
300679
|
-
state: btPaymentStateEnum().notNull().default("PENDING"),
|
|
300680
|
-
note: text()
|
|
300681
|
-
});
|
|
300682
300682
|
// src/lib/db/index.ts
|
|
300683
300683
|
var db = drizzle(env_default.DATABASE_URL, {
|
|
300684
300684
|
schema: exports_schema,
|
|
@@ -321985,7 +321985,11 @@ var CompanyInvoiceLogic;
|
|
|
321985
321985
|
periodEnd.setDate(periodEnd.getDate() - 1);
|
|
321986
321986
|
break;
|
|
321987
321987
|
}
|
|
321988
|
-
case "
|
|
321988
|
+
case "SEASONAL": {
|
|
321989
|
+
periodEnd.setMonth(periodEnd.getMonth() + 3);
|
|
321990
|
+
periodEnd.setDate(periodEnd.getDate() - 1);
|
|
321991
|
+
break;
|
|
321992
|
+
}
|
|
321989
321993
|
case "YEARLY": {
|
|
321990
321994
|
periodEnd.setFullYear(periodEnd.getFullYear() + 1);
|
|
321991
321995
|
periodEnd.setDate(periodEnd.getDate() - 1);
|