@fesmex/models 0.1.55 → 0.1.57
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.cjs +91 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -24
- package/dist/index.d.ts +41 -24
- package/dist/index.js +93 -54
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ interface ClientType {
|
|
|
15
15
|
created_at?: Date;
|
|
16
16
|
updated_at?: Date;
|
|
17
17
|
}
|
|
18
|
-
declare const _default$
|
|
18
|
+
declare const _default$t: mongoose.Model<any, {}, {}, {}, any, any, any> | mongoose.Model<ClientType, {}, {}, {}, mongoose.Document<unknown, {}, ClientType, {}, mongoose.DefaultSchemaOptions> & ClientType & {
|
|
19
19
|
_id: mongoose.Types.ObjectId;
|
|
20
20
|
} & {
|
|
21
21
|
__v: number;
|
|
@@ -34,7 +34,7 @@ interface ClientContactType {
|
|
|
34
34
|
created_at?: Date;
|
|
35
35
|
updated_at?: Date;
|
|
36
36
|
}
|
|
37
|
-
declare const _default$
|
|
37
|
+
declare const _default$s: mongoose.Model<any, {}, {}, {}, any, any, any> | mongoose.Model<ClientContactType, {}, {}, {}, mongoose.Document<unknown, {}, ClientContactType, {}, mongoose.DefaultSchemaOptions> & ClientContactType & {
|
|
38
38
|
_id: Types.ObjectId;
|
|
39
39
|
} & {
|
|
40
40
|
__v: number;
|
|
@@ -54,7 +54,7 @@ interface ClientAddressType {
|
|
|
54
54
|
created_at?: Date;
|
|
55
55
|
updated_at?: Date;
|
|
56
56
|
}
|
|
57
|
-
declare const _default$
|
|
57
|
+
declare const _default$r: mongoose.Model<any, {}, {}, {}, any, any, any> | mongoose.Model<ClientAddressType, {}, {}, {}, mongoose.Document<unknown, {}, ClientAddressType, {}, mongoose.DefaultSchemaOptions> & ClientAddressType & {
|
|
58
58
|
_id: Types.ObjectId;
|
|
59
59
|
} & {
|
|
60
60
|
__v: number;
|
|
@@ -69,7 +69,7 @@ interface ClientPaymentMethodType {
|
|
|
69
69
|
created_at?: Date;
|
|
70
70
|
updated_at?: Date;
|
|
71
71
|
}
|
|
72
|
-
declare const _default$
|
|
72
|
+
declare const _default$q: mongoose.Model<any, {}, {}, {}, any, any, any> | mongoose.Model<ClientPaymentMethodType, {}, {}, {}, mongoose.Document<unknown, {}, ClientPaymentMethodType, {}, mongoose.DefaultSchemaOptions> & ClientPaymentMethodType & {
|
|
73
73
|
_id: Types.ObjectId;
|
|
74
74
|
} & {
|
|
75
75
|
__v: number;
|
|
@@ -84,7 +84,7 @@ interface ClientPaymentTermType {
|
|
|
84
84
|
created_at?: Date;
|
|
85
85
|
updated_at?: Date;
|
|
86
86
|
}
|
|
87
|
-
declare const _default$
|
|
87
|
+
declare const _default$p: mongoose.Model<any, {}, {}, {}, any, any, any> | mongoose.Model<ClientPaymentTermType, {}, {}, {}, mongoose.Document<unknown, {}, ClientPaymentTermType, {}, mongoose.DefaultSchemaOptions> & ClientPaymentTermType & {
|
|
88
88
|
_id: Types.ObjectId;
|
|
89
89
|
} & {
|
|
90
90
|
__v: number;
|
|
@@ -99,7 +99,7 @@ interface ClientPriceListType {
|
|
|
99
99
|
created_at?: Date;
|
|
100
100
|
updated_at?: Date;
|
|
101
101
|
}
|
|
102
|
-
declare const _default$
|
|
102
|
+
declare const _default$o: mongoose.Model<any, {}, {}, {}, any, any, any> | mongoose.Model<ClientPriceListType, {}, {}, {}, mongoose.Document<unknown, {}, ClientPriceListType, {}, mongoose.DefaultSchemaOptions> & ClientPriceListType & {
|
|
103
103
|
_id: Types.ObjectId;
|
|
104
104
|
} & {
|
|
105
105
|
__v: number;
|
|
@@ -114,7 +114,7 @@ interface ClientSalesEmployeeType {
|
|
|
114
114
|
created_at?: Date;
|
|
115
115
|
updated_at?: Date;
|
|
116
116
|
}
|
|
117
|
-
declare const _default$
|
|
117
|
+
declare const _default$n: mongoose.Model<any, {}, {}, {}, any, any, any> | mongoose.Model<ClientSalesEmployeeType, {}, {}, {}, mongoose.Document<unknown, {}, ClientSalesEmployeeType, {}, mongoose.DefaultSchemaOptions> & ClientSalesEmployeeType & {
|
|
118
118
|
_id: Types.ObjectId;
|
|
119
119
|
} & {
|
|
120
120
|
__v: number;
|
|
@@ -122,7 +122,7 @@ declare const _default$m: mongoose.Model<any, {}, {}, {}, any, any, any> | mongo
|
|
|
122
122
|
id: string;
|
|
123
123
|
}, any, ClientSalesEmployeeType>;
|
|
124
124
|
|
|
125
|
-
declare const _default$
|
|
125
|
+
declare const _default$m: mongoose.Model<any, {}, {}, {}, any, any, any> | mongoose.Model<{
|
|
126
126
|
created_at: NativeDate;
|
|
127
127
|
description: string;
|
|
128
128
|
article_number: string;
|
|
@@ -1062,7 +1062,7 @@ declare const _default$l: mongoose.Model<any, {}, {}, {}, any, any, any> | mongo
|
|
|
1062
1062
|
__v: number;
|
|
1063
1063
|
}>;
|
|
1064
1064
|
|
|
1065
|
-
declare const _default$
|
|
1065
|
+
declare const _default$l: mongoose.Model<any, {}, {}, {}, any, any, any> | mongoose.Model<{
|
|
1066
1066
|
name: string;
|
|
1067
1067
|
description?: string;
|
|
1068
1068
|
}, {}, {}, {
|
|
@@ -1132,7 +1132,7 @@ declare const _default$k: mongoose.Model<any, {}, {}, {}, any, any, any> | mongo
|
|
|
1132
1132
|
__v: number;
|
|
1133
1133
|
}>;
|
|
1134
1134
|
|
|
1135
|
-
declare const _default$
|
|
1135
|
+
declare const _default$k: mongoose.Model<any, {}, {}, {}, any, any, any> | mongoose.Model<{
|
|
1136
1136
|
name: string;
|
|
1137
1137
|
description?: string;
|
|
1138
1138
|
}, {}, {}, {
|
|
@@ -1202,7 +1202,7 @@ declare const _default$j: mongoose.Model<any, {}, {}, {}, any, any, any> | mongo
|
|
|
1202
1202
|
__v: number;
|
|
1203
1203
|
}>;
|
|
1204
1204
|
|
|
1205
|
-
declare const _default$
|
|
1205
|
+
declare const _default$j: mongoose.Model<any, {}, {}, {}, any, any, any> | mongoose.Model<{
|
|
1206
1206
|
created_at: NativeDate;
|
|
1207
1207
|
article_id: Types.ObjectId;
|
|
1208
1208
|
price_list_id: Types.ObjectId;
|
|
@@ -1332,7 +1332,7 @@ declare const _default$i: mongoose.Model<any, {}, {}, {}, any, any, any> | mongo
|
|
|
1332
1332
|
__v: number;
|
|
1333
1333
|
}>;
|
|
1334
1334
|
|
|
1335
|
-
declare const _default$
|
|
1335
|
+
declare const _default$i: mongoose.Model<any, {}, {}, {}, any, any, any> | mongoose.Model<{
|
|
1336
1336
|
symbol: string;
|
|
1337
1337
|
name: string;
|
|
1338
1338
|
code: string;
|
|
@@ -1412,7 +1412,7 @@ declare const _default$h: mongoose.Model<any, {}, {}, {}, any, any, any> | mongo
|
|
|
1412
1412
|
__v: number;
|
|
1413
1413
|
}>;
|
|
1414
1414
|
|
|
1415
|
-
declare const _default$
|
|
1415
|
+
declare const _default$h: mongoose.Model<any, {}, {}, {}, any, any, any> | mongoose.Model<{
|
|
1416
1416
|
created_at: NativeDate;
|
|
1417
1417
|
name: string;
|
|
1418
1418
|
code: string;
|
|
@@ -1512,7 +1512,7 @@ declare const _default$g: mongoose.Model<any, {}, {}, {}, any, any, any> | mongo
|
|
|
1512
1512
|
__v: number;
|
|
1513
1513
|
}>;
|
|
1514
1514
|
|
|
1515
|
-
declare const _default$
|
|
1515
|
+
declare const _default$g: mongoose.Model<any, {}, {}, {}, any, any, any> | mongoose.Model<{
|
|
1516
1516
|
updated_at: NativeDate;
|
|
1517
1517
|
article_id: Types.ObjectId;
|
|
1518
1518
|
warehouse_id: Types.ObjectId;
|
|
@@ -1632,7 +1632,7 @@ declare const _default$f: mongoose.Model<any, {}, {}, {}, any, any, any> | mongo
|
|
|
1632
1632
|
__v: number;
|
|
1633
1633
|
}>;
|
|
1634
1634
|
|
|
1635
|
-
declare const _default$
|
|
1635
|
+
declare const _default$f: mongoose.Model<any, {}, {}, {}, any, any, any> | mongoose.Model<{
|
|
1636
1636
|
number: string;
|
|
1637
1637
|
created_at: NativeDate;
|
|
1638
1638
|
name: string;
|
|
@@ -1722,7 +1722,7 @@ declare const _default$e: mongoose.Model<any, {}, {}, {}, any, any, any> | mongo
|
|
|
1722
1722
|
__v: number;
|
|
1723
1723
|
}>;
|
|
1724
1724
|
|
|
1725
|
-
declare const _default$
|
|
1725
|
+
declare const _default$e: mongoose.Model<any, {}, {}, {}, any, any, any> | mongoose.Model<{
|
|
1726
1726
|
created_at: NativeDate;
|
|
1727
1727
|
updated_at: NativeDate;
|
|
1728
1728
|
name: string;
|
|
@@ -1842,7 +1842,7 @@ declare const _default$d: mongoose.Model<any, {}, {}, {}, any, any, any> | mongo
|
|
|
1842
1842
|
__v: number;
|
|
1843
1843
|
}>;
|
|
1844
1844
|
|
|
1845
|
-
declare const _default$
|
|
1845
|
+
declare const _default$d: mongoose.Model<any, {}, {}, {}, any, any, any> | mongoose.Model<{
|
|
1846
1846
|
created_at: NativeDate;
|
|
1847
1847
|
updated_at: NativeDate;
|
|
1848
1848
|
type: "filter" | "sidebar";
|
|
@@ -1975,13 +1975,13 @@ declare enum CreatedMethod {
|
|
|
1975
1975
|
MANUAL = "MANUAL",
|
|
1976
1976
|
CSV = "CSV"
|
|
1977
1977
|
}
|
|
1978
|
+
declare const _default$c: mongoose.Model<any, {}, {}, {}, any, any, any>;
|
|
1979
|
+
|
|
1978
1980
|
declare const _default$b: mongoose.Model<any, {}, {}, {}, any, any, any>;
|
|
1979
1981
|
|
|
1980
1982
|
declare const _default$a: mongoose.Model<any, {}, {}, {}, any, any, any>;
|
|
1981
1983
|
|
|
1982
|
-
declare const _default$9: mongoose.Model<any, {}, {}, {}, any, any, any
|
|
1983
|
-
|
|
1984
|
-
declare const _default$8: mongoose.Model<any, {}, {}, {}, any, any, any> | mongoose.Model<{
|
|
1984
|
+
declare const _default$9: mongoose.Model<any, {}, {}, {}, any, any, any> | mongoose.Model<{
|
|
1985
1985
|
created_at: NativeDate;
|
|
1986
1986
|
quote_id: mongoose.Types.ObjectId;
|
|
1987
1987
|
email?: string;
|
|
@@ -2091,7 +2091,7 @@ declare const _default$8: mongoose.Model<any, {}, {}, {}, any, any, any> | mongo
|
|
|
2091
2091
|
__v: number;
|
|
2092
2092
|
}>;
|
|
2093
2093
|
|
|
2094
|
-
declare const _default$
|
|
2094
|
+
declare const _default$8: mongoose.Model<any, {}, {}, {}, any, any, any>;
|
|
2095
2095
|
|
|
2096
2096
|
declare enum CustomerStatus {
|
|
2097
2097
|
ACTIVE = "active",
|
|
@@ -2145,7 +2145,7 @@ declare enum PaymentStatus {
|
|
|
2145
2145
|
PAID = "PAID",
|
|
2146
2146
|
REFUNDED = "REFUNDED"
|
|
2147
2147
|
}
|
|
2148
|
-
declare const _default$
|
|
2148
|
+
declare const _default$7: mongoose.Model<any, {}, {}, {}, any, any, any>;
|
|
2149
2149
|
|
|
2150
2150
|
interface OrderStatusLogType {
|
|
2151
2151
|
order_id: Types.ObjectId;
|
|
@@ -2154,7 +2154,7 @@ interface OrderStatusLogType {
|
|
|
2154
2154
|
changed_at?: Date;
|
|
2155
2155
|
note?: string;
|
|
2156
2156
|
}
|
|
2157
|
-
declare const _default$
|
|
2157
|
+
declare const _default$6: mongoose.Model<any, {}, {}, {}, any, any, any> | mongoose.Model<OrderStatusLogType, {}, {}, {}, mongoose.Document<unknown, {}, OrderStatusLogType, {}, mongoose.DefaultSchemaOptions> & OrderStatusLogType & {
|
|
2158
2158
|
_id: Types.ObjectId;
|
|
2159
2159
|
} & {
|
|
2160
2160
|
__v: number;
|
|
@@ -2162,6 +2162,23 @@ declare const _default$5: mongoose.Model<any, {}, {}, {}, any, any, any> | mongo
|
|
|
2162
2162
|
id: string;
|
|
2163
2163
|
}, any, OrderStatusLogType>;
|
|
2164
2164
|
|
|
2165
|
+
interface StateType {
|
|
2166
|
+
_id?: mongoose.Types.ObjectId;
|
|
2167
|
+
name: string;
|
|
2168
|
+
code?: string;
|
|
2169
|
+
percentage: number;
|
|
2170
|
+
is_active: boolean;
|
|
2171
|
+
created_at?: Date;
|
|
2172
|
+
updated_at?: Date;
|
|
2173
|
+
}
|
|
2174
|
+
declare const _default$5: mongoose.Model<any, {}, {}, {}, any, any, any> | mongoose.Model<StateType, {}, {}, {}, mongoose.Document<unknown, {}, StateType, {}, mongoose.DefaultSchemaOptions> & StateType & Required<{
|
|
2175
|
+
_id: mongoose.Types.ObjectId;
|
|
2176
|
+
}> & {
|
|
2177
|
+
__v: number;
|
|
2178
|
+
} & {
|
|
2179
|
+
id: string;
|
|
2180
|
+
}, any, StateType>;
|
|
2181
|
+
|
|
2165
2182
|
/**
|
|
2166
2183
|
* Sync Log Types
|
|
2167
2184
|
*/
|
|
@@ -2405,4 +2422,4 @@ declare const _default: mongoose.Model<any, {}, {}, {}, any, any, any> | mongoos
|
|
|
2405
2422
|
id: string;
|
|
2406
2423
|
}, any, OrderPaymentDocument>;
|
|
2407
2424
|
|
|
2408
|
-
export { _default$3 as Announcement, type AnnouncementType, _default$
|
|
2425
|
+
export { _default$3 as Announcement, type AnnouncementType, _default$m as Article, _default$k as ArticleClass, _default$l as ArticleGroup, _default$j as ArticlePrice, ArticleView, _default$2 as Cart, type CartItem, type CartType, _default$e as Category, _default$t as Client, _default$r as ClientAddress, type ClientAddressType, _default$s as ClientContact, type ClientContactType, _default$q as ClientPaymentMethod, type ClientPaymentMethodType, _default$p as ClientPaymentTerm, type ClientPaymentTermType, _default$o as ClientPriceList, type ClientPriceListType, _default$n as ClientSalesEmployee, type ClientSalesEmployeeType, type ClientType, CreatedMethod, _default$i as Currency, Customer, type CustomerDoc, type CustomerModel, _default$1 as CustomerPaymentMethod, CustomerStatus, type CustomerType, EmailVerificationToken, type EmailVerificationTokenDoc, type EmailVerificationTokenModel, type EmailVerificationTokenType, FiscalProfile, type FiscalProfileDoc, type FiscalProfileModel, type FiscalProfileType, type ISyncLog, _default$g as InventoryStock, _default$7 as Order, _default as OrderPayment, OrderStatus, _default$6 as OrderStatusLog, type OrderStatusLogType, PasswordResetToken, type PasswordResetTokenDoc, type PasswordResetTokenModel, type PasswordResetTokenType, PaymentMethod, PaymentMethodType, type PaymentMethodWallet, PaymentProvider$1 as PaymentProvider, PaymentStatus, _default$f as PriceList, _default$c as Quote, _default$b as QuoteArticle, _default$a as QuoteArticleExtra, _default$9 as QuoteContact, QuoteStatus, _default$8 as QuoteTerm, RefreshToken, type RefreshTokenDoc, type RefreshTokenModel, type RefreshTokenType, _default$5 as State, type StateType, Status, SyncLog, SyncLogAction, SyncLogStatus, SyncLogType, _default$d as Tag, TransactionMethod, TransactionStatus, UserRole, UserStatus, type UserType, _default$4 as Users, _default$h as Warehouse };
|
package/dist/index.js
CHANGED
|
@@ -570,6 +570,7 @@ var orderSchema = new Schema26(
|
|
|
570
570
|
delivery_type: { type: String, enum: ["shipping", "pickup"], required: true },
|
|
571
571
|
subtotal: { type: Number, required: true, min: 0 },
|
|
572
572
|
shipping_fee: { type: Number, min: 0, default: null },
|
|
573
|
+
shipping_state_id: { type: Schema26.Types.ObjectId, ref: "State", default: null },
|
|
573
574
|
total: { type: Number, required: true, min: 0 },
|
|
574
575
|
notes: { type: String, trim: true }
|
|
575
576
|
},
|
|
@@ -631,8 +632,45 @@ orderStatusLogSchema.index(
|
|
|
631
632
|
);
|
|
632
633
|
var OrderStatusLogs_default = mongoose27.models.OrderStatusLog || model27("OrderStatusLog", orderStatusLogSchema);
|
|
633
634
|
|
|
634
|
-
// src/
|
|
635
|
+
// src/orders/models/State.ts
|
|
635
636
|
import mongoose28, { Schema as Schema28, model as model28 } from "mongoose";
|
|
637
|
+
var stateSchema = new Schema28(
|
|
638
|
+
{
|
|
639
|
+
name: {
|
|
640
|
+
type: String,
|
|
641
|
+
required: true,
|
|
642
|
+
trim: true,
|
|
643
|
+
lowercase: true,
|
|
644
|
+
index: true
|
|
645
|
+
},
|
|
646
|
+
code: {
|
|
647
|
+
type: String,
|
|
648
|
+
trim: true,
|
|
649
|
+
uppercase: true,
|
|
650
|
+
sparse: true
|
|
651
|
+
},
|
|
652
|
+
percentage: {
|
|
653
|
+
type: Number,
|
|
654
|
+
required: true,
|
|
655
|
+
default: 0.1,
|
|
656
|
+
min: 0,
|
|
657
|
+
max: 1
|
|
658
|
+
},
|
|
659
|
+
is_active: {
|
|
660
|
+
type: Boolean,
|
|
661
|
+
default: true,
|
|
662
|
+
index: true
|
|
663
|
+
}
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
timestamps: { createdAt: "created_at", updatedAt: "updated_at" }
|
|
667
|
+
}
|
|
668
|
+
);
|
|
669
|
+
stateSchema.index({ name: 1, is_active: 1 }, { name: "states_name_active" });
|
|
670
|
+
var State_default = mongoose28.models.State || model28("State", stateSchema, "states");
|
|
671
|
+
|
|
672
|
+
// src/sap/models/SyncLog.ts
|
|
673
|
+
import mongoose29, { Schema as Schema29, model as model29 } from "mongoose";
|
|
636
674
|
var SyncLogType = /* @__PURE__ */ ((SyncLogType2) => {
|
|
637
675
|
SyncLogType2["SAP_QUOTATION"] = "SAP_QUOTATION";
|
|
638
676
|
SyncLogType2["SAP_SALES_ORDER"] = "SAP_SALES_ORDER";
|
|
@@ -652,7 +690,7 @@ var SyncLogAction = /* @__PURE__ */ ((SyncLogAction2) => {
|
|
|
652
690
|
SyncLogAction2["DELETE"] = "DELETE";
|
|
653
691
|
return SyncLogAction2;
|
|
654
692
|
})(SyncLogAction || {});
|
|
655
|
-
var syncLogSchema = new
|
|
693
|
+
var syncLogSchema = new Schema29(
|
|
656
694
|
{
|
|
657
695
|
entity_type: {
|
|
658
696
|
type: String,
|
|
@@ -660,7 +698,7 @@ var syncLogSchema = new Schema28(
|
|
|
660
698
|
index: true
|
|
661
699
|
},
|
|
662
700
|
entity_id: {
|
|
663
|
-
type:
|
|
701
|
+
type: Schema29.Types.ObjectId,
|
|
664
702
|
required: true,
|
|
665
703
|
index: true
|
|
666
704
|
},
|
|
@@ -683,14 +721,14 @@ var syncLogSchema = new Schema28(
|
|
|
683
721
|
},
|
|
684
722
|
error_message: { type: String },
|
|
685
723
|
error_code: { type: String },
|
|
686
|
-
error_details: { type:
|
|
687
|
-
request_payload: { type:
|
|
688
|
-
response_payload: { type:
|
|
724
|
+
error_details: { type: Schema29.Types.Mixed },
|
|
725
|
+
request_payload: { type: Schema29.Types.Mixed },
|
|
726
|
+
response_payload: { type: Schema29.Types.Mixed },
|
|
689
727
|
retry_count: { type: Number, default: 0 },
|
|
690
728
|
max_retries: { type: Number, default: 3 },
|
|
691
729
|
next_retry_at: { type: Date },
|
|
692
730
|
resolved_at: { type: Date },
|
|
693
|
-
resolved_by: { type:
|
|
731
|
+
resolved_by: { type: Schema29.Types.ObjectId, ref: "User" }
|
|
694
732
|
},
|
|
695
733
|
{
|
|
696
734
|
timestamps: { createdAt: "created_at", updatedAt: "updated_at" }
|
|
@@ -698,13 +736,13 @@ var syncLogSchema = new Schema28(
|
|
|
698
736
|
);
|
|
699
737
|
syncLogSchema.index({ entity_type: 1, entity_id: 1, status: 1 });
|
|
700
738
|
syncLogSchema.index({ status: 1, next_retry_at: 1 });
|
|
701
|
-
var SyncLog =
|
|
739
|
+
var SyncLog = mongoose29.models.SyncLog || model29("SyncLog", syncLogSchema, "sync_logs");
|
|
702
740
|
|
|
703
741
|
// src/announcements/models/Announcements.ts
|
|
704
|
-
import
|
|
742
|
+
import mongoose31, { Schema as Schema31, model as model31 } from "mongoose";
|
|
705
743
|
|
|
706
744
|
// src/users/models/Users.ts
|
|
707
|
-
import
|
|
745
|
+
import mongoose30, { Schema as Schema30, model as model30 } from "mongoose";
|
|
708
746
|
import bcrypt2 from "bcryptjs";
|
|
709
747
|
var UserRole = /* @__PURE__ */ ((UserRole2) => {
|
|
710
748
|
UserRole2["ADMIN"] = "admin";
|
|
@@ -719,7 +757,7 @@ var UserStatus = /* @__PURE__ */ ((UserStatus2) => {
|
|
|
719
757
|
UserStatus2["SUSPENDED"] = "suspended";
|
|
720
758
|
return UserStatus2;
|
|
721
759
|
})(UserStatus || {});
|
|
722
|
-
var usersSchema = new
|
|
760
|
+
var usersSchema = new Schema30({
|
|
723
761
|
first_name: { type: String, required: true },
|
|
724
762
|
middle_name: { type: String },
|
|
725
763
|
last_name: { type: String, required: true },
|
|
@@ -741,32 +779,32 @@ var usersSchema = new Schema29({
|
|
|
741
779
|
sap_id: { type: String },
|
|
742
780
|
sap_employee_id: { type: String },
|
|
743
781
|
created_at: { type: Date, default: Date.now },
|
|
744
|
-
created_by: { type:
|
|
782
|
+
created_by: { type: Schema30.Types.Mixed, ref: "User" },
|
|
745
783
|
updated_at: { type: Date },
|
|
746
|
-
updated_by: { type:
|
|
784
|
+
updated_by: { type: Schema30.Types.ObjectId, ref: "User" },
|
|
747
785
|
deleted_at: { type: Date },
|
|
748
|
-
deleted_by: { type:
|
|
786
|
+
deleted_by: { type: Schema30.Types.ObjectId, ref: "User" }
|
|
749
787
|
});
|
|
750
788
|
usersSchema.pre("save", async function() {
|
|
751
789
|
if (this.isModified("password")) {
|
|
752
790
|
this.password = await bcrypt2.hash(this.password, 12);
|
|
753
791
|
}
|
|
754
792
|
});
|
|
755
|
-
var Users_default =
|
|
793
|
+
var Users_default = mongoose30.models.User || model30("User", usersSchema, "users");
|
|
756
794
|
|
|
757
795
|
// src/announcements/models/Announcements.ts
|
|
758
|
-
var announcementSchema = new
|
|
796
|
+
var announcementSchema = new Schema31({
|
|
759
797
|
created_by: {
|
|
760
|
-
type:
|
|
798
|
+
type: Schema31.Types.ObjectId,
|
|
761
799
|
ref: "User",
|
|
762
800
|
required: true
|
|
763
801
|
},
|
|
764
802
|
updated_by: {
|
|
765
|
-
type:
|
|
803
|
+
type: Schema31.Types.ObjectId,
|
|
766
804
|
ref: "User"
|
|
767
805
|
},
|
|
768
806
|
deleted_by: {
|
|
769
|
-
type:
|
|
807
|
+
type: Schema31.Types.ObjectId,
|
|
770
808
|
ref: "User"
|
|
771
809
|
},
|
|
772
810
|
created_at: {
|
|
@@ -795,11 +833,11 @@ var announcementSchema = new Schema30({
|
|
|
795
833
|
}
|
|
796
834
|
}
|
|
797
835
|
});
|
|
798
|
-
var Announcements_default =
|
|
836
|
+
var Announcements_default = mongoose31.models.Announcement || model31("Announcement", announcementSchema, "announcements");
|
|
799
837
|
|
|
800
838
|
// src/carts/models/Carts.ts
|
|
801
|
-
import
|
|
802
|
-
var cartItemSchema = new
|
|
839
|
+
import mongoose32, { Schema as Schema32, model as model32, Types as Types13 } from "mongoose";
|
|
840
|
+
var cartItemSchema = new Schema32(
|
|
803
841
|
{
|
|
804
842
|
article_id: { type: Types13.ObjectId, ref: "Article", required: true },
|
|
805
843
|
quantity: { type: Number, required: true, min: 1 },
|
|
@@ -809,7 +847,7 @@ var cartItemSchema = new Schema31(
|
|
|
809
847
|
},
|
|
810
848
|
{ _id: false }
|
|
811
849
|
);
|
|
812
|
-
var cartSchema = new
|
|
850
|
+
var cartSchema = new Schema32(
|
|
813
851
|
{
|
|
814
852
|
customer_id: {
|
|
815
853
|
type: Types13.ObjectId,
|
|
@@ -833,15 +871,15 @@ var cartSchema = new Schema31(
|
|
|
833
871
|
);
|
|
834
872
|
cartSchema.index({ customer_id: 1 }, { unique: true, name: "carts_customer_unique" });
|
|
835
873
|
cartSchema.index({ updated_at: -1 }, { name: "carts_updated_at" });
|
|
836
|
-
var Carts_default =
|
|
874
|
+
var Carts_default = mongoose32.models.Cart || model32("Cart", cartSchema, "carts");
|
|
837
875
|
|
|
838
876
|
// src/auth/models/RefreshTokens.ts
|
|
839
|
-
import
|
|
840
|
-
Schema as
|
|
841
|
-
model as
|
|
877
|
+
import mongoose33, {
|
|
878
|
+
Schema as Schema33,
|
|
879
|
+
model as model33
|
|
842
880
|
} from "mongoose";
|
|
843
|
-
var refreshTokenSchema = new
|
|
844
|
-
customer_id: { type:
|
|
881
|
+
var refreshTokenSchema = new Schema33({
|
|
882
|
+
customer_id: { type: Schema33.Types.ObjectId, ref: "Customer", required: true },
|
|
845
883
|
// Store only SHA-256 hash of the opaque refresh token (base64url). Never store the raw token.
|
|
846
884
|
token_hash: { type: String, required: true },
|
|
847
885
|
expires_at: { type: Date, required: true },
|
|
@@ -856,16 +894,16 @@ refreshTokenSchema.index({ customer_id: 1, expires_at: 1 });
|
|
|
856
894
|
refreshTokenSchema.pre("save", function() {
|
|
857
895
|
this.updated_at = /* @__PURE__ */ new Date();
|
|
858
896
|
});
|
|
859
|
-
var RefreshToken =
|
|
897
|
+
var RefreshToken = mongoose33.models.RefreshToken || model33("RefreshToken", refreshTokenSchema, "refresh_tokens");
|
|
860
898
|
var RefreshTokens_default = RefreshToken;
|
|
861
899
|
|
|
862
900
|
// src/auth/models/PasswordResetTokens.ts
|
|
863
|
-
import
|
|
864
|
-
Schema as
|
|
865
|
-
model as
|
|
901
|
+
import mongoose34, {
|
|
902
|
+
Schema as Schema34,
|
|
903
|
+
model as model34
|
|
866
904
|
} from "mongoose";
|
|
867
|
-
var passwordResetTokenSchema = new
|
|
868
|
-
customer_id: { type:
|
|
905
|
+
var passwordResetTokenSchema = new Schema34({
|
|
906
|
+
customer_id: { type: Schema34.Types.ObjectId, ref: "Customer", required: true },
|
|
869
907
|
// Store only SHA-256 hash of the opaque reset token (base64url). Never store the raw token.
|
|
870
908
|
token_hash: { type: String, required: true },
|
|
871
909
|
expires_at: { type: Date, required: true },
|
|
@@ -879,16 +917,16 @@ passwordResetTokenSchema.index({ customer_id: 1, expires_at: 1 });
|
|
|
879
917
|
passwordResetTokenSchema.pre("save", function(next) {
|
|
880
918
|
this.updated_at = /* @__PURE__ */ new Date();
|
|
881
919
|
});
|
|
882
|
-
var PasswordResetToken =
|
|
920
|
+
var PasswordResetToken = mongoose34.models.PasswordResetToken || model34("PasswordResetToken", passwordResetTokenSchema, "password_reset_tokens");
|
|
883
921
|
var PasswordResetTokens_default = PasswordResetToken;
|
|
884
922
|
|
|
885
923
|
// src/auth/models/EmailVerificationTokens.ts
|
|
886
|
-
import
|
|
887
|
-
Schema as
|
|
888
|
-
model as
|
|
924
|
+
import mongoose35, {
|
|
925
|
+
Schema as Schema35,
|
|
926
|
+
model as model35
|
|
889
927
|
} from "mongoose";
|
|
890
|
-
var emailVerificationTokenSchema = new
|
|
891
|
-
customer_id: { type:
|
|
928
|
+
var emailVerificationTokenSchema = new Schema35({
|
|
929
|
+
customer_id: { type: Schema35.Types.ObjectId, ref: "Customer", required: true },
|
|
892
930
|
// Store only SHA-256 hash of the opaque email verification token. Never store the raw token.
|
|
893
931
|
token_hash: { type: String, required: true },
|
|
894
932
|
expires_at: { type: Date, required: true },
|
|
@@ -899,7 +937,7 @@ var emailVerificationTokenSchema = new Schema34({
|
|
|
899
937
|
emailVerificationTokenSchema.index({ token_hash: 1 }, { unique: true });
|
|
900
938
|
emailVerificationTokenSchema.index({ expires_at: 1 }, { expireAfterSeconds: 0 });
|
|
901
939
|
emailVerificationTokenSchema.index({ customer_id: 1, expires_at: 1 });
|
|
902
|
-
var EmailVerificationToken =
|
|
940
|
+
var EmailVerificationToken = mongoose35.models.EmailVerificationToken || model35(
|
|
903
941
|
"EmailVerificationToken",
|
|
904
942
|
emailVerificationTokenSchema,
|
|
905
943
|
"email_verification_tokens"
|
|
@@ -907,7 +945,7 @@ var EmailVerificationToken = mongoose34.models.EmailVerificationToken || model34
|
|
|
907
945
|
var EmailVerificationTokens_default = EmailVerificationToken;
|
|
908
946
|
|
|
909
947
|
// src/payments/models/PaymentMethods.ts
|
|
910
|
-
import
|
|
948
|
+
import mongoose36, { Schema as Schema36, model as model36 } from "mongoose";
|
|
911
949
|
var PaymentProvider = /* @__PURE__ */ ((PaymentProvider3) => {
|
|
912
950
|
PaymentProvider3["STRIPE"] = "stripe";
|
|
913
951
|
return PaymentProvider3;
|
|
@@ -919,9 +957,9 @@ var PaymentMethodType = /* @__PURE__ */ ((PaymentMethodType2) => {
|
|
|
919
957
|
PaymentMethodType2["BANK_TRANSFER"] = "bank_transfer";
|
|
920
958
|
return PaymentMethodType2;
|
|
921
959
|
})(PaymentMethodType || {});
|
|
922
|
-
var paymentMethodSchema = new
|
|
960
|
+
var paymentMethodSchema = new Schema36(
|
|
923
961
|
{
|
|
924
|
-
customer_id: { type:
|
|
962
|
+
customer_id: { type: Schema36.Types.ObjectId, ref: "Customer", required: true },
|
|
925
963
|
provider: {
|
|
926
964
|
type: String,
|
|
927
965
|
enum: Object.values(PaymentProvider),
|
|
@@ -947,7 +985,7 @@ var paymentMethodSchema = new Schema35(
|
|
|
947
985
|
},
|
|
948
986
|
is_default: { type: Boolean, default: false },
|
|
949
987
|
deleted_at: { type: Date },
|
|
950
|
-
deleted_by: { type:
|
|
988
|
+
deleted_by: { type: Schema36.Types.ObjectId, ref: "User" }
|
|
951
989
|
},
|
|
952
990
|
{ timestamps: { createdAt: "created_at", updatedAt: "updated_at" } }
|
|
953
991
|
);
|
|
@@ -963,10 +1001,10 @@ paymentMethodSchema.index(
|
|
|
963
1001
|
{ customer_id: 1, is_default: 1 },
|
|
964
1002
|
{ name: "payment_methods_default_lookup" }
|
|
965
1003
|
);
|
|
966
|
-
var PaymentMethods_default =
|
|
1004
|
+
var PaymentMethods_default = mongoose36.models.CustomerPaymentMethod || model36("CustomerPaymentMethod", paymentMethodSchema, "customer_payment_methods");
|
|
967
1005
|
|
|
968
1006
|
// src/payments/models/Payments.ts
|
|
969
|
-
import
|
|
1007
|
+
import mongoose37, { Schema as Schema37, model as model37 } from "mongoose";
|
|
970
1008
|
var PaymentProvider2 = /* @__PURE__ */ ((PaymentProvider3) => {
|
|
971
1009
|
PaymentProvider3["STRIPE"] = "stripe";
|
|
972
1010
|
return PaymentProvider3;
|
|
@@ -986,11 +1024,11 @@ var TransactionMethod = /* @__PURE__ */ ((TransactionMethod2) => {
|
|
|
986
1024
|
TransactionMethod2["BANK_TRANSFER"] = "bank_transfer";
|
|
987
1025
|
return TransactionMethod2;
|
|
988
1026
|
})(TransactionMethod || {});
|
|
989
|
-
var orderPaymentSchema = new
|
|
1027
|
+
var orderPaymentSchema = new Schema37(
|
|
990
1028
|
{
|
|
991
|
-
order_id: { type:
|
|
992
|
-
customer_id: { type:
|
|
993
|
-
payment_method_id: { type:
|
|
1029
|
+
order_id: { type: Schema37.Types.ObjectId, ref: "Order", required: true },
|
|
1030
|
+
customer_id: { type: Schema37.Types.ObjectId, ref: "Customer", required: true },
|
|
1031
|
+
payment_method_id: { type: Schema37.Types.ObjectId, ref: "ClientPaymentMethod" },
|
|
994
1032
|
provider: {
|
|
995
1033
|
type: String,
|
|
996
1034
|
enum: Object.values(PaymentProvider2),
|
|
@@ -1013,7 +1051,7 @@ var orderPaymentSchema = new Schema36(
|
|
|
1013
1051
|
amount: { type: Number, required: true, min: 0 },
|
|
1014
1052
|
currency: { type: String, required: true, default: "MXN" },
|
|
1015
1053
|
deleted_at: { type: Date },
|
|
1016
|
-
deleted_by: { type:
|
|
1054
|
+
deleted_by: { type: Schema37.Types.ObjectId, ref: "User" }
|
|
1017
1055
|
},
|
|
1018
1056
|
{ timestamps: { createdAt: "created_at", updatedAt: "updated_at" } }
|
|
1019
1057
|
);
|
|
@@ -1037,7 +1075,7 @@ orderPaymentSchema.index(
|
|
|
1037
1075
|
{ provider_payment_id: 1 },
|
|
1038
1076
|
{ name: "order_payments_provider_payment_id" }
|
|
1039
1077
|
);
|
|
1040
|
-
var Payments_default =
|
|
1078
|
+
var Payments_default = mongoose37.models.OrderPayment || model37("OrderPayment", orderPaymentSchema, "order_payments");
|
|
1041
1079
|
export {
|
|
1042
1080
|
Announcements_default as Announcement,
|
|
1043
1081
|
Article_default as Article,
|
|
@@ -1078,6 +1116,7 @@ export {
|
|
|
1078
1116
|
QuoteStatus,
|
|
1079
1117
|
QuoteTerm_default as QuoteTerm,
|
|
1080
1118
|
RefreshTokens_default as RefreshToken,
|
|
1119
|
+
State_default as State,
|
|
1081
1120
|
Status,
|
|
1082
1121
|
SyncLog,
|
|
1083
1122
|
SyncLogAction,
|