@fesmex/models 0.1.50 → 0.1.51
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 +121 -86
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +246 -16
- package/dist/index.d.ts +246 -16
- package/dist/index.js +127 -94
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -35,6 +35,7 @@ __export(index_exports, {
|
|
|
35
35
|
ArticleGroup: () => ArticleGroups_default,
|
|
36
36
|
ArticlePrice: () => ArticlePrices_default,
|
|
37
37
|
Cart: () => Carts_default,
|
|
38
|
+
Category: () => Category_default,
|
|
38
39
|
Client: () => Clients_default,
|
|
39
40
|
ClientAddress: () => ClientsAddress_default,
|
|
40
41
|
ClientContact: () => ClientsContact_default,
|
|
@@ -67,6 +68,7 @@ __export(index_exports, {
|
|
|
67
68
|
SyncLogAction: () => SyncLogAction,
|
|
68
69
|
SyncLogStatus: () => SyncLogStatus,
|
|
69
70
|
SyncLogType: () => SyncLogType,
|
|
71
|
+
Tag: () => Tag_default,
|
|
70
72
|
UserRole: () => UserRole,
|
|
71
73
|
UserStatus: () => UserStatus,
|
|
72
74
|
Users: () => Users_default,
|
|
@@ -345,8 +347,39 @@ var priceListSchema = new import_mongoose15.Schema({
|
|
|
345
347
|
});
|
|
346
348
|
var PriceLists_default = import_mongoose15.default.models.PriceList || (0, import_mongoose15.model)("PriceList", priceListSchema, "price_lists");
|
|
347
349
|
|
|
348
|
-
// src/
|
|
350
|
+
// src/inventory/models/Category.ts
|
|
349
351
|
var import_mongoose16 = __toESM(require("mongoose"), 1);
|
|
352
|
+
var categorySchema = new import_mongoose16.Schema({
|
|
353
|
+
name: { type: String, required: true, trim: true },
|
|
354
|
+
slug: { type: String, required: true, trim: true, lowercase: true },
|
|
355
|
+
parent_id: { type: import_mongoose16.Types.ObjectId, ref: "Category", default: null, index: true },
|
|
356
|
+
order: { type: Number, default: 0 },
|
|
357
|
+
is_active: { type: Boolean, default: true, index: true },
|
|
358
|
+
created_at: { type: Date, default: Date.now },
|
|
359
|
+
updated_at: { type: Date, default: Date.now }
|
|
360
|
+
});
|
|
361
|
+
categorySchema.index({ slug: 1 }, { unique: true, name: "categories_slug_unique" });
|
|
362
|
+
categorySchema.index({ parent_id: 1 }, { name: "categories_parent" });
|
|
363
|
+
categorySchema.index({ is_active: 1 }, { name: "categories_active" });
|
|
364
|
+
var Category_default = import_mongoose16.default.models.Category || (0, import_mongoose16.model)("Category", categorySchema, "categories");
|
|
365
|
+
|
|
366
|
+
// src/inventory/models/Tag.ts
|
|
367
|
+
var import_mongoose17 = __toESM(require("mongoose"), 1);
|
|
368
|
+
var tagSchema = new import_mongoose17.Schema({
|
|
369
|
+
name: { type: String, required: true, trim: true },
|
|
370
|
+
slug: { type: String, required: true, trim: true, lowercase: true },
|
|
371
|
+
type: { type: String, enum: ["filter", "sidebar"], default: "filter", index: true },
|
|
372
|
+
is_active: { type: Boolean, default: true, index: true },
|
|
373
|
+
created_at: { type: Date, default: Date.now },
|
|
374
|
+
updated_at: { type: Date, default: Date.now }
|
|
375
|
+
});
|
|
376
|
+
tagSchema.index({ slug: 1 }, { unique: true, name: "tags_slug_unique" });
|
|
377
|
+
tagSchema.index({ is_active: 1 }, { name: "tags_active" });
|
|
378
|
+
tagSchema.index({ type: 1 }, { name: "tags_type" });
|
|
379
|
+
var Tag_default = import_mongoose17.default.models.Tag || (0, import_mongoose17.model)("Tag", tagSchema, "tags");
|
|
380
|
+
|
|
381
|
+
// src/quotes/models/Quote.ts
|
|
382
|
+
var import_mongoose18 = __toESM(require("mongoose"), 1);
|
|
350
383
|
var QuoteStatus = /* @__PURE__ */ ((QuoteStatus2) => {
|
|
351
384
|
QuoteStatus2["OPPORTUNITY"] = "OPPORTUNITY";
|
|
352
385
|
QuoteStatus2["QUOTE"] = "QUOTE";
|
|
@@ -366,21 +399,21 @@ var CreatedMethod = /* @__PURE__ */ ((CreatedMethod2) => {
|
|
|
366
399
|
CreatedMethod2["CSV"] = "CSV";
|
|
367
400
|
return CreatedMethod2;
|
|
368
401
|
})(CreatedMethod || {});
|
|
369
|
-
var quoteSchema = new
|
|
402
|
+
var quoteSchema = new import_mongoose18.Schema(
|
|
370
403
|
{
|
|
371
404
|
quote_number: { type: Number, required: true },
|
|
372
405
|
quote_revision: { type: Number, default: 0 },
|
|
373
406
|
quote_ref: { type: String },
|
|
374
407
|
company: { type: String },
|
|
375
|
-
company_id: { type:
|
|
408
|
+
company_id: { type: import_mongoose18.Schema.Types.ObjectId, ref: "Client", required: true },
|
|
376
409
|
company_pipedrive_id: { type: String },
|
|
377
|
-
contact_id: { type:
|
|
410
|
+
contact_id: { type: import_mongoose18.Schema.Types.ObjectId, ref: "ClientContact" },
|
|
378
411
|
project_name: { type: String },
|
|
379
412
|
project_lab: { type: String },
|
|
380
413
|
payment_condition: { type: String },
|
|
381
414
|
payment_exp: { type: String },
|
|
382
|
-
terms_ids: [{ type:
|
|
383
|
-
currency_id: { type:
|
|
415
|
+
terms_ids: [{ type: import_mongoose18.Schema.Types.ObjectId, ref: "QuoteTerm" }],
|
|
416
|
+
currency_id: { type: import_mongoose18.Schema.Types.ObjectId, ref: "Currency" },
|
|
384
417
|
iva: { type: String },
|
|
385
418
|
date: { type: Date },
|
|
386
419
|
status: { type: String, enum: Object.values(Status), default: "OPEN" /* OPEN */ },
|
|
@@ -401,21 +434,21 @@ var quoteSchema = new import_mongoose16.Schema(
|
|
|
401
434
|
enum: Object.values(CreatedMethod),
|
|
402
435
|
default: "MANUAL" /* MANUAL */
|
|
403
436
|
},
|
|
404
|
-
created_by: { type:
|
|
405
|
-
updated_by: { type:
|
|
406
|
-
deleted_by: { type:
|
|
437
|
+
created_by: { type: import_mongoose18.Schema.Types.ObjectId, ref: "User" },
|
|
438
|
+
updated_by: { type: import_mongoose18.Schema.Types.ObjectId, ref: "User" },
|
|
439
|
+
deleted_by: { type: import_mongoose18.Schema.Types.ObjectId, ref: "User" },
|
|
407
440
|
deleted_at: { type: Date }
|
|
408
441
|
},
|
|
409
442
|
{ timestamps: { createdAt: "created_at", updatedAt: "updated_at" } }
|
|
410
443
|
);
|
|
411
|
-
var Quote_default =
|
|
444
|
+
var Quote_default = import_mongoose18.default.models.Quote || (0, import_mongoose18.model)("Quote", quoteSchema, "quotes");
|
|
412
445
|
|
|
413
446
|
// src/quotes/models/QuoteArticle.ts
|
|
414
|
-
var
|
|
415
|
-
var quoteArticleSchema = new
|
|
447
|
+
var import_mongoose19 = __toESM(require("mongoose"), 1);
|
|
448
|
+
var quoteArticleSchema = new import_mongoose19.Schema(
|
|
416
449
|
{
|
|
417
|
-
quote_id: { type:
|
|
418
|
-
article_id: { type:
|
|
450
|
+
quote_id: { type: import_mongoose19.Schema.Types.ObjectId, ref: "Quote", required: true },
|
|
451
|
+
article_id: { type: import_mongoose19.Schema.Types.ObjectId, ref: "Article" },
|
|
419
452
|
article_number: { type: String },
|
|
420
453
|
description: { type: String },
|
|
421
454
|
delivery: { type: String },
|
|
@@ -426,18 +459,18 @@ var quoteArticleSchema = new import_mongoose17.Schema(
|
|
|
426
459
|
total: { type: Number },
|
|
427
460
|
utility: { type: Number },
|
|
428
461
|
type: { type: String },
|
|
429
|
-
extra_id: { type:
|
|
462
|
+
extra_id: { type: import_mongoose19.Schema.Types.ObjectId, ref: "QuoteArticleExtra" }
|
|
430
463
|
},
|
|
431
464
|
{ timestamps: { createdAt: "created_at", updatedAt: "updated_at" } }
|
|
432
465
|
);
|
|
433
|
-
var QuoteArticle_default =
|
|
466
|
+
var QuoteArticle_default = import_mongoose19.default.models.QuoteArticle || (0, import_mongoose19.model)("QuoteArticle", quoteArticleSchema, "quote_articles");
|
|
434
467
|
|
|
435
468
|
// src/quotes/models/QuoteArticleExtra.ts
|
|
436
|
-
var
|
|
437
|
-
var quoteArticleExtraSchema = new
|
|
469
|
+
var import_mongoose20 = __toESM(require("mongoose"), 1);
|
|
470
|
+
var quoteArticleExtraSchema = new import_mongoose20.Schema(
|
|
438
471
|
{
|
|
439
472
|
quote_article_id: {
|
|
440
|
-
type:
|
|
473
|
+
type: import_mongoose20.Schema.Types.ObjectId,
|
|
441
474
|
ref: "QuoteArticle",
|
|
442
475
|
required: true
|
|
443
476
|
},
|
|
@@ -449,23 +482,23 @@ var quoteArticleExtraSchema = new import_mongoose18.Schema(
|
|
|
449
482
|
},
|
|
450
483
|
{ timestamps: { createdAt: "created_at", updatedAt: "updated_at" } }
|
|
451
484
|
);
|
|
452
|
-
var QuoteArticleExtra_default =
|
|
485
|
+
var QuoteArticleExtra_default = import_mongoose20.default.models.QuoteArticleExtra || (0, import_mongoose20.model)("QuoteArticleExtra", quoteArticleExtraSchema, "quote_article_extras");
|
|
453
486
|
|
|
454
487
|
// src/quotes/models/QuoteContact.ts
|
|
455
|
-
var
|
|
456
|
-
var quoteContactSchema = new
|
|
457
|
-
quote_id: { type:
|
|
488
|
+
var import_mongoose21 = __toESM(require("mongoose"), 1);
|
|
489
|
+
var quoteContactSchema = new import_mongoose21.Schema({
|
|
490
|
+
quote_id: { type: import_mongoose21.Schema.Types.ObjectId, ref: "Quote", required: true },
|
|
458
491
|
name: String,
|
|
459
492
|
email: String,
|
|
460
493
|
mobile: String,
|
|
461
494
|
pipedrive_id: String,
|
|
462
495
|
created_at: { type: Date, default: Date.now }
|
|
463
496
|
});
|
|
464
|
-
var QuoteContact_default =
|
|
497
|
+
var QuoteContact_default = import_mongoose21.default.models.QuoteContact || (0, import_mongoose21.model)("QuoteContact", quoteContactSchema, "quote_contacts");
|
|
465
498
|
|
|
466
499
|
// src/quotes/models/QuoteTerm.ts
|
|
467
|
-
var
|
|
468
|
-
var quoteTermSchema = new
|
|
500
|
+
var import_mongoose22 = __toESM(require("mongoose"), 1);
|
|
501
|
+
var quoteTermSchema = new import_mongoose22.Schema(
|
|
469
502
|
{
|
|
470
503
|
title: String,
|
|
471
504
|
content: { type: String, required: true },
|
|
@@ -476,10 +509,10 @@ var quoteTermSchema = new import_mongoose20.Schema(
|
|
|
476
509
|
},
|
|
477
510
|
{ timestamps: { createdAt: "created_at", updatedAt: "updated_at" } }
|
|
478
511
|
);
|
|
479
|
-
var QuoteTerm_default =
|
|
512
|
+
var QuoteTerm_default = import_mongoose22.default.models.QuoteTerm || (0, import_mongoose22.model)("QuoteTerm", quoteTermSchema, "quote_terms");
|
|
480
513
|
|
|
481
514
|
// src/customers/models/Customers.ts
|
|
482
|
-
var
|
|
515
|
+
var import_mongoose23 = __toESM(require("mongoose"), 1);
|
|
483
516
|
var import_bcryptjs = __toESM(require("bcryptjs"), 1);
|
|
484
517
|
var CustomerStatus = /* @__PURE__ */ ((CustomerStatus2) => {
|
|
485
518
|
CustomerStatus2["ACTIVE"] = "active";
|
|
@@ -487,7 +520,7 @@ var CustomerStatus = /* @__PURE__ */ ((CustomerStatus2) => {
|
|
|
487
520
|
CustomerStatus2["BANNED"] = "banned";
|
|
488
521
|
return CustomerStatus2;
|
|
489
522
|
})(CustomerStatus || {});
|
|
490
|
-
var customerSchema = new
|
|
523
|
+
var customerSchema = new import_mongoose23.Schema({
|
|
491
524
|
first_name: { type: String, required: true },
|
|
492
525
|
last_name: { type: String, required: true },
|
|
493
526
|
email: { type: String, required: true, unique: true },
|
|
@@ -498,7 +531,7 @@ var customerSchema = new import_mongoose21.Schema({
|
|
|
498
531
|
enum: Object.values(CustomerStatus),
|
|
499
532
|
default: "inactive" /* INACTIVE */
|
|
500
533
|
},
|
|
501
|
-
fiscal_profile_id: { type:
|
|
534
|
+
fiscal_profile_id: { type: import_mongoose23.Schema.Types.ObjectId, ref: "FiscalProfile" },
|
|
502
535
|
created_at: { type: Date, default: Date.now },
|
|
503
536
|
updated_at: { type: Date },
|
|
504
537
|
deleted_at: { type: Date }
|
|
@@ -508,13 +541,13 @@ customerSchema.pre("save", async function() {
|
|
|
508
541
|
this.password = await import_bcryptjs.default.hash(this.password, 12);
|
|
509
542
|
}
|
|
510
543
|
});
|
|
511
|
-
var Customer =
|
|
544
|
+
var Customer = import_mongoose23.default.models.Customer || (0, import_mongoose23.model)("Customer", customerSchema, "customers");
|
|
512
545
|
var Customers_default = Customer;
|
|
513
546
|
|
|
514
547
|
// src/customers/models/FiscalProfileType.ts
|
|
515
|
-
var
|
|
516
|
-
var fiscalProfileSchema = new
|
|
517
|
-
customer_id: { type:
|
|
548
|
+
var import_mongoose24 = __toESM(require("mongoose"), 1);
|
|
549
|
+
var fiscalProfileSchema = new import_mongoose24.Schema({
|
|
550
|
+
customer_id: { type: import_mongoose24.Schema.Types.ObjectId, ref: "Customer", required: true },
|
|
518
551
|
rfc: { type: String, required: true },
|
|
519
552
|
razon_social: { type: String, required: true },
|
|
520
553
|
uso_cfdi: { type: String, required: true },
|
|
@@ -523,11 +556,11 @@ var fiscalProfileSchema = new import_mongoose22.Schema({
|
|
|
523
556
|
created_at: { type: Date, default: Date.now },
|
|
524
557
|
updated_at: { type: Date }
|
|
525
558
|
});
|
|
526
|
-
var FiscalProfile =
|
|
559
|
+
var FiscalProfile = import_mongoose24.default.models.FiscalProfile || (0, import_mongoose24.model)("FiscalProfile", fiscalProfileSchema, "fiscal_profiles");
|
|
527
560
|
var FiscalProfileType_default = FiscalProfile;
|
|
528
561
|
|
|
529
562
|
// src/orders/models/Orders.ts
|
|
530
|
-
var
|
|
563
|
+
var import_mongoose25 = __toESM(require("mongoose"), 1);
|
|
531
564
|
var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
|
|
532
565
|
OrderStatus2["PENDING"] = "pending";
|
|
533
566
|
OrderStatus2["CONFIRMED"] = "confirmed";
|
|
@@ -548,7 +581,7 @@ var PaymentStatus = /* @__PURE__ */ ((PaymentStatus2) => {
|
|
|
548
581
|
PaymentStatus2["REFUNDED"] = "REFUNDED";
|
|
549
582
|
return PaymentStatus2;
|
|
550
583
|
})(PaymentStatus || {});
|
|
551
|
-
var shippingAddressSchema = new
|
|
584
|
+
var shippingAddressSchema = new import_mongoose25.Schema(
|
|
552
585
|
{
|
|
553
586
|
full_name: { type: String, required: true, trim: true },
|
|
554
587
|
phone: { type: String, required: true, trim: true },
|
|
@@ -561,18 +594,18 @@ var shippingAddressSchema = new import_mongoose23.Schema(
|
|
|
561
594
|
},
|
|
562
595
|
{ _id: false }
|
|
563
596
|
);
|
|
564
|
-
var orderItemSchema = new
|
|
597
|
+
var orderItemSchema = new import_mongoose25.Schema(
|
|
565
598
|
{
|
|
566
|
-
article_id: { type:
|
|
599
|
+
article_id: { type: import_mongoose25.Schema.Types.ObjectId, ref: "Article", required: true },
|
|
567
600
|
quantity: { type: Number, required: true, min: 1 },
|
|
568
601
|
unit_price: { type: Number, required: true, min: 0 },
|
|
569
602
|
total: { type: Number, required: true, min: 0 }
|
|
570
603
|
},
|
|
571
604
|
{ _id: false }
|
|
572
605
|
);
|
|
573
|
-
var orderSchema = new
|
|
606
|
+
var orderSchema = new import_mongoose25.Schema(
|
|
574
607
|
{
|
|
575
|
-
customer_id: { type:
|
|
608
|
+
customer_id: { type: import_mongoose25.Schema.Types.ObjectId, ref: "Customer", required: true },
|
|
576
609
|
items: { type: [orderItemSchema], required: true, default: [] },
|
|
577
610
|
status: {
|
|
578
611
|
type: String,
|
|
@@ -615,14 +648,14 @@ orderSchema.index(
|
|
|
615
648
|
{ "shipping_address.postal_code": 1, created_at: -1 },
|
|
616
649
|
{ name: "orders_postal_created" }
|
|
617
650
|
);
|
|
618
|
-
var Orders_default =
|
|
651
|
+
var Orders_default = import_mongoose25.default.models.Order || (0, import_mongoose25.model)("Order", orderSchema, "orders");
|
|
619
652
|
|
|
620
653
|
// src/orders/models/OrderStatusLogs.ts
|
|
621
|
-
var
|
|
622
|
-
var orderStatusLogSchema = new
|
|
654
|
+
var import_mongoose26 = __toESM(require("mongoose"), 1);
|
|
655
|
+
var orderStatusLogSchema = new import_mongoose26.Schema(
|
|
623
656
|
{
|
|
624
657
|
order_id: {
|
|
625
|
-
type:
|
|
658
|
+
type: import_mongoose26.Schema.Types.ObjectId,
|
|
626
659
|
ref: "Order",
|
|
627
660
|
required: true
|
|
628
661
|
},
|
|
@@ -632,7 +665,7 @@ var orderStatusLogSchema = new import_mongoose24.Schema(
|
|
|
632
665
|
required: true
|
|
633
666
|
},
|
|
634
667
|
changed_by: {
|
|
635
|
-
type:
|
|
668
|
+
type: import_mongoose26.Schema.Types.ObjectId,
|
|
636
669
|
ref: "User",
|
|
637
670
|
required: true
|
|
638
671
|
},
|
|
@@ -655,10 +688,10 @@ orderStatusLogSchema.index(
|
|
|
655
688
|
{ changed_by: 1, changed_at: -1 },
|
|
656
689
|
{ name: "order_status_logs_changed_by_changed_at" }
|
|
657
690
|
);
|
|
658
|
-
var OrderStatusLogs_default =
|
|
691
|
+
var OrderStatusLogs_default = import_mongoose26.default.models.OrderStatusLog || (0, import_mongoose26.model)("OrderStatusLog", orderStatusLogSchema);
|
|
659
692
|
|
|
660
693
|
// src/sap/models/SyncLog.ts
|
|
661
|
-
var
|
|
694
|
+
var import_mongoose27 = __toESM(require("mongoose"), 1);
|
|
662
695
|
var SyncLogType = /* @__PURE__ */ ((SyncLogType2) => {
|
|
663
696
|
SyncLogType2["SAP_QUOTATION"] = "SAP_QUOTATION";
|
|
664
697
|
SyncLogType2["SAP_SALES_ORDER"] = "SAP_SALES_ORDER";
|
|
@@ -678,7 +711,7 @@ var SyncLogAction = /* @__PURE__ */ ((SyncLogAction2) => {
|
|
|
678
711
|
SyncLogAction2["DELETE"] = "DELETE";
|
|
679
712
|
return SyncLogAction2;
|
|
680
713
|
})(SyncLogAction || {});
|
|
681
|
-
var syncLogSchema = new
|
|
714
|
+
var syncLogSchema = new import_mongoose27.Schema(
|
|
682
715
|
{
|
|
683
716
|
entity_type: {
|
|
684
717
|
type: String,
|
|
@@ -686,7 +719,7 @@ var syncLogSchema = new import_mongoose25.Schema(
|
|
|
686
719
|
index: true
|
|
687
720
|
},
|
|
688
721
|
entity_id: {
|
|
689
|
-
type:
|
|
722
|
+
type: import_mongoose27.Schema.Types.ObjectId,
|
|
690
723
|
required: true,
|
|
691
724
|
index: true
|
|
692
725
|
},
|
|
@@ -709,14 +742,14 @@ var syncLogSchema = new import_mongoose25.Schema(
|
|
|
709
742
|
},
|
|
710
743
|
error_message: { type: String },
|
|
711
744
|
error_code: { type: String },
|
|
712
|
-
error_details: { type:
|
|
713
|
-
request_payload: { type:
|
|
714
|
-
response_payload: { type:
|
|
745
|
+
error_details: { type: import_mongoose27.Schema.Types.Mixed },
|
|
746
|
+
request_payload: { type: import_mongoose27.Schema.Types.Mixed },
|
|
747
|
+
response_payload: { type: import_mongoose27.Schema.Types.Mixed },
|
|
715
748
|
retry_count: { type: Number, default: 0 },
|
|
716
749
|
max_retries: { type: Number, default: 3 },
|
|
717
750
|
next_retry_at: { type: Date },
|
|
718
751
|
resolved_at: { type: Date },
|
|
719
|
-
resolved_by: { type:
|
|
752
|
+
resolved_by: { type: import_mongoose27.Schema.Types.ObjectId, ref: "User" }
|
|
720
753
|
},
|
|
721
754
|
{
|
|
722
755
|
timestamps: { createdAt: "created_at", updatedAt: "updated_at" }
|
|
@@ -724,13 +757,13 @@ var syncLogSchema = new import_mongoose25.Schema(
|
|
|
724
757
|
);
|
|
725
758
|
syncLogSchema.index({ entity_type: 1, entity_id: 1, status: 1 });
|
|
726
759
|
syncLogSchema.index({ status: 1, next_retry_at: 1 });
|
|
727
|
-
var SyncLog =
|
|
760
|
+
var SyncLog = import_mongoose27.default.models.SyncLog || (0, import_mongoose27.model)("SyncLog", syncLogSchema, "sync_logs");
|
|
728
761
|
|
|
729
762
|
// src/announcements/models/Announcements.ts
|
|
730
|
-
var
|
|
763
|
+
var import_mongoose29 = __toESM(require("mongoose"), 1);
|
|
731
764
|
|
|
732
765
|
// src/users/models/Users.ts
|
|
733
|
-
var
|
|
766
|
+
var import_mongoose28 = __toESM(require("mongoose"), 1);
|
|
734
767
|
var import_bcryptjs2 = __toESM(require("bcryptjs"), 1);
|
|
735
768
|
var UserRole = /* @__PURE__ */ ((UserRole2) => {
|
|
736
769
|
UserRole2["ADMIN"] = "admin";
|
|
@@ -745,7 +778,7 @@ var UserStatus = /* @__PURE__ */ ((UserStatus2) => {
|
|
|
745
778
|
UserStatus2["SUSPENDED"] = "suspended";
|
|
746
779
|
return UserStatus2;
|
|
747
780
|
})(UserStatus || {});
|
|
748
|
-
var usersSchema = new
|
|
781
|
+
var usersSchema = new import_mongoose28.Schema({
|
|
749
782
|
first_name: { type: String, required: true },
|
|
750
783
|
middle_name: { type: String },
|
|
751
784
|
last_name: { type: String, required: true },
|
|
@@ -767,32 +800,32 @@ var usersSchema = new import_mongoose26.Schema({
|
|
|
767
800
|
sap_id: { type: String },
|
|
768
801
|
sap_employee_id: { type: String },
|
|
769
802
|
created_at: { type: Date, default: Date.now },
|
|
770
|
-
created_by: { type:
|
|
803
|
+
created_by: { type: import_mongoose28.Schema.Types.Mixed, ref: "User" },
|
|
771
804
|
updated_at: { type: Date },
|
|
772
|
-
updated_by: { type:
|
|
805
|
+
updated_by: { type: import_mongoose28.Schema.Types.ObjectId, ref: "User" },
|
|
773
806
|
deleted_at: { type: Date },
|
|
774
|
-
deleted_by: { type:
|
|
807
|
+
deleted_by: { type: import_mongoose28.Schema.Types.ObjectId, ref: "User" }
|
|
775
808
|
});
|
|
776
809
|
usersSchema.pre("save", async function() {
|
|
777
810
|
if (this.isModified("password")) {
|
|
778
811
|
this.password = await import_bcryptjs2.default.hash(this.password, 12);
|
|
779
812
|
}
|
|
780
813
|
});
|
|
781
|
-
var Users_default =
|
|
814
|
+
var Users_default = import_mongoose28.default.models.User || (0, import_mongoose28.model)("User", usersSchema, "users");
|
|
782
815
|
|
|
783
816
|
// src/announcements/models/Announcements.ts
|
|
784
|
-
var announcementSchema = new
|
|
817
|
+
var announcementSchema = new import_mongoose29.Schema({
|
|
785
818
|
created_by: {
|
|
786
|
-
type:
|
|
819
|
+
type: import_mongoose29.Schema.Types.ObjectId,
|
|
787
820
|
ref: "User",
|
|
788
821
|
required: true
|
|
789
822
|
},
|
|
790
823
|
updated_by: {
|
|
791
|
-
type:
|
|
824
|
+
type: import_mongoose29.Schema.Types.ObjectId,
|
|
792
825
|
ref: "User"
|
|
793
826
|
},
|
|
794
827
|
deleted_by: {
|
|
795
|
-
type:
|
|
828
|
+
type: import_mongoose29.Schema.Types.ObjectId,
|
|
796
829
|
ref: "User"
|
|
797
830
|
},
|
|
798
831
|
created_at: {
|
|
@@ -821,13 +854,13 @@ var announcementSchema = new import_mongoose27.Schema({
|
|
|
821
854
|
}
|
|
822
855
|
}
|
|
823
856
|
});
|
|
824
|
-
var Announcements_default =
|
|
857
|
+
var Announcements_default = import_mongoose29.default.models.Announcement || (0, import_mongoose29.model)("Announcement", announcementSchema, "announcements");
|
|
825
858
|
|
|
826
859
|
// src/carts/models/Carts.ts
|
|
827
|
-
var
|
|
828
|
-
var cartItemSchema = new
|
|
860
|
+
var import_mongoose30 = __toESM(require("mongoose"), 1);
|
|
861
|
+
var cartItemSchema = new import_mongoose30.Schema(
|
|
829
862
|
{
|
|
830
|
-
article_id: { type:
|
|
863
|
+
article_id: { type: import_mongoose30.Types.ObjectId, ref: "Article", required: true },
|
|
831
864
|
quantity: { type: Number, required: true, min: 1 },
|
|
832
865
|
unit_price: { type: Number },
|
|
833
866
|
line_subtotal: { type: Number },
|
|
@@ -835,10 +868,10 @@ var cartItemSchema = new import_mongoose28.Schema(
|
|
|
835
868
|
},
|
|
836
869
|
{ _id: false }
|
|
837
870
|
);
|
|
838
|
-
var cartSchema = new
|
|
871
|
+
var cartSchema = new import_mongoose30.Schema(
|
|
839
872
|
{
|
|
840
873
|
customer_id: {
|
|
841
|
-
type:
|
|
874
|
+
type: import_mongoose30.Types.ObjectId,
|
|
842
875
|
ref: "Customer",
|
|
843
876
|
required: true
|
|
844
877
|
},
|
|
@@ -848,7 +881,7 @@ var cartSchema = new import_mongoose28.Schema(
|
|
|
848
881
|
default: "ACTIVE"
|
|
849
882
|
},
|
|
850
883
|
currency: { type: String, default: "MXN" },
|
|
851
|
-
price_list_id: { type:
|
|
884
|
+
price_list_id: { type: import_mongoose30.Types.ObjectId, ref: "PriceList" },
|
|
852
885
|
expires_at: { type: Date },
|
|
853
886
|
subtotal: { type: Number, default: 0 },
|
|
854
887
|
items: { type: [cartItemSchema], default: [] }
|
|
@@ -859,12 +892,12 @@ var cartSchema = new import_mongoose28.Schema(
|
|
|
859
892
|
);
|
|
860
893
|
cartSchema.index({ customer_id: 1 }, { unique: true, name: "carts_customer_unique" });
|
|
861
894
|
cartSchema.index({ updated_at: -1 }, { name: "carts_updated_at" });
|
|
862
|
-
var Carts_default =
|
|
895
|
+
var Carts_default = import_mongoose30.default.models.Cart || (0, import_mongoose30.model)("Cart", cartSchema, "carts");
|
|
863
896
|
|
|
864
897
|
// src/auth/models/RefreshTokens.ts
|
|
865
|
-
var
|
|
866
|
-
var refreshTokenSchema = new
|
|
867
|
-
customer_id: { type:
|
|
898
|
+
var import_mongoose31 = __toESM(require("mongoose"), 1);
|
|
899
|
+
var refreshTokenSchema = new import_mongoose31.Schema({
|
|
900
|
+
customer_id: { type: import_mongoose31.Schema.Types.ObjectId, ref: "Customer", required: true },
|
|
868
901
|
// Store only SHA-256 hash of the opaque refresh token (base64url). Never store the raw token.
|
|
869
902
|
token_hash: { type: String, required: true },
|
|
870
903
|
expires_at: { type: Date, required: true },
|
|
@@ -879,13 +912,13 @@ refreshTokenSchema.index({ customer_id: 1, expires_at: 1 });
|
|
|
879
912
|
refreshTokenSchema.pre("save", function() {
|
|
880
913
|
this.updated_at = /* @__PURE__ */ new Date();
|
|
881
914
|
});
|
|
882
|
-
var RefreshToken =
|
|
915
|
+
var RefreshToken = import_mongoose31.default.models.RefreshToken || (0, import_mongoose31.model)("RefreshToken", refreshTokenSchema, "refresh_tokens");
|
|
883
916
|
var RefreshTokens_default = RefreshToken;
|
|
884
917
|
|
|
885
918
|
// src/auth/models/PasswordResetTokens.ts
|
|
886
|
-
var
|
|
887
|
-
var passwordResetTokenSchema = new
|
|
888
|
-
customer_id: { type:
|
|
919
|
+
var import_mongoose32 = __toESM(require("mongoose"), 1);
|
|
920
|
+
var passwordResetTokenSchema = new import_mongoose32.Schema({
|
|
921
|
+
customer_id: { type: import_mongoose32.Schema.Types.ObjectId, ref: "Customer", required: true },
|
|
889
922
|
// Store only SHA-256 hash of the opaque reset token (base64url). Never store the raw token.
|
|
890
923
|
token_hash: { type: String, required: true },
|
|
891
924
|
expires_at: { type: Date, required: true },
|
|
@@ -899,13 +932,13 @@ passwordResetTokenSchema.index({ customer_id: 1, expires_at: 1 });
|
|
|
899
932
|
passwordResetTokenSchema.pre("save", function(next) {
|
|
900
933
|
this.updated_at = /* @__PURE__ */ new Date();
|
|
901
934
|
});
|
|
902
|
-
var PasswordResetToken =
|
|
935
|
+
var PasswordResetToken = import_mongoose32.default.models.PasswordResetToken || (0, import_mongoose32.model)("PasswordResetToken", passwordResetTokenSchema, "password_reset_tokens");
|
|
903
936
|
var PasswordResetTokens_default = PasswordResetToken;
|
|
904
937
|
|
|
905
938
|
// src/auth/models/EmailVerificationTokens.ts
|
|
906
|
-
var
|
|
907
|
-
var emailVerificationTokenSchema = new
|
|
908
|
-
customer_id: { type:
|
|
939
|
+
var import_mongoose33 = __toESM(require("mongoose"), 1);
|
|
940
|
+
var emailVerificationTokenSchema = new import_mongoose33.Schema({
|
|
941
|
+
customer_id: { type: import_mongoose33.Schema.Types.ObjectId, ref: "Customer", required: true },
|
|
909
942
|
// Store only SHA-256 hash of the opaque email verification token. Never store the raw token.
|
|
910
943
|
token_hash: { type: String, required: true },
|
|
911
944
|
expires_at: { type: Date, required: true },
|
|
@@ -916,7 +949,7 @@ var emailVerificationTokenSchema = new import_mongoose31.Schema({
|
|
|
916
949
|
emailVerificationTokenSchema.index({ token_hash: 1 }, { unique: true });
|
|
917
950
|
emailVerificationTokenSchema.index({ expires_at: 1 }, { expireAfterSeconds: 0 });
|
|
918
951
|
emailVerificationTokenSchema.index({ customer_id: 1, expires_at: 1 });
|
|
919
|
-
var EmailVerificationToken =
|
|
952
|
+
var EmailVerificationToken = import_mongoose33.default.models.EmailVerificationToken || (0, import_mongoose33.model)(
|
|
920
953
|
"EmailVerificationToken",
|
|
921
954
|
emailVerificationTokenSchema,
|
|
922
955
|
"email_verification_tokens"
|
|
@@ -930,6 +963,7 @@ var EmailVerificationTokens_default = EmailVerificationToken;
|
|
|
930
963
|
ArticleGroup,
|
|
931
964
|
ArticlePrice,
|
|
932
965
|
Cart,
|
|
966
|
+
Category,
|
|
933
967
|
Client,
|
|
934
968
|
ClientAddress,
|
|
935
969
|
ClientContact,
|
|
@@ -962,6 +996,7 @@ var EmailVerificationTokens_default = EmailVerificationToken;
|
|
|
962
996
|
SyncLogAction,
|
|
963
997
|
SyncLogStatus,
|
|
964
998
|
SyncLogType,
|
|
999
|
+
Tag,
|
|
965
1000
|
UserRole,
|
|
966
1001
|
UserStatus,
|
|
967
1002
|
Users,
|