@fesmex/models 0.1.8 → 0.1.10
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/announcements/index.js +1 -8
- package/dist/announcements/models/Announcements.js +8 -10
- package/dist/carts/index.d.ts +1 -0
- package/dist/carts/index.js +1 -0
- package/dist/carts/models/Carts.d.ts +14 -0
- package/dist/carts/models/Carts.js +16 -0
- package/dist/clients/index.js +7 -20
- package/dist/clients/models/Clients.js +3 -5
- package/dist/clients/models/ClientsAddress.js +4 -6
- package/dist/clients/models/ClientsContact.js +4 -6
- package/dist/clients/models/ClientsPaymentMethod.js +4 -6
- package/dist/clients/models/ClientsPaymentTerm.js +4 -6
- package/dist/clients/models/ClientsPriceList.js +4 -6
- package/dist/clients/models/ClientsSalesEmployee.js +4 -6
- package/dist/customers/index.js +2 -10
- package/dist/customers/models/Customers.js +8 -14
- package/dist/customers/models/FiscalProfileType.js +4 -6
- package/dist/index.d.ts +1 -0
- package/dist/index.js +9 -24
- package/dist/inventory/index.js +8 -22
- package/dist/inventory/models/Article.js +4 -6
- package/dist/inventory/models/ArticleClasses.js +3 -5
- package/dist/inventory/models/ArticleGroups.js +3 -5
- package/dist/inventory/models/ArticlePrices.js +6 -8
- package/dist/inventory/models/Currencies.js +3 -5
- package/dist/inventory/models/InventoryStocks.js +5 -7
- package/dist/inventory/models/PriceLists.js +3 -5
- package/dist/inventory/models/Warehouses.js +3 -5
- package/dist/orders/index.js +3 -12
- package/dist/orders/models/OrderStatusLogs.js +7 -9
- package/dist/orders/models/Orders.js +8 -11
- package/dist/quotes/index.js +5 -19
- package/dist/quotes/models/Quote.js +16 -19
- package/dist/quotes/models/QuoteArticle.js +6 -8
- package/dist/quotes/models/QuoteArticleExtra.js +4 -6
- package/dist/quotes/models/QuoteContact.js +4 -6
- package/dist/quotes/models/QuoteTerm.js +3 -5
- package/dist/sap/index.js +1 -8
- package/dist/sap/models/SyncLog.js +14 -17
- package/dist/users/index.js +1 -10
- package/dist/users/models/Users.js +12 -18
- package/package.json +9 -1
|
@@ -1,8 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Announcement = void 0;
|
|
7
|
-
var Announcements_1 = require("./models/Announcements");
|
|
8
|
-
Object.defineProperty(exports, "Announcement", { enumerable: true, get: function () { return __importDefault(Announcements_1).default; } });
|
|
1
|
+
export { default as Announcement } from "./models/Announcements";
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const Users_1 = require("../../users/models/Users");
|
|
5
|
-
const announcementSchema = new mongoose_1.Schema({
|
|
1
|
+
import { Schema, model } from "mongoose";
|
|
2
|
+
import { UserRole } from "../../users/models/Users";
|
|
3
|
+
const announcementSchema = new Schema({
|
|
6
4
|
created_by: {
|
|
7
|
-
type:
|
|
5
|
+
type: Schema.Types.ObjectId,
|
|
8
6
|
ref: "User",
|
|
9
7
|
required: true,
|
|
10
8
|
},
|
|
11
9
|
updated_by: {
|
|
12
|
-
type:
|
|
10
|
+
type: Schema.Types.ObjectId,
|
|
13
11
|
ref: "User",
|
|
14
12
|
},
|
|
15
13
|
deleted_by: {
|
|
16
|
-
type:
|
|
14
|
+
type: Schema.Types.ObjectId,
|
|
17
15
|
ref: "User",
|
|
18
16
|
},
|
|
19
17
|
created_at: {
|
|
@@ -34,7 +32,7 @@ const announcementSchema = new mongoose_1.Schema({
|
|
|
34
32
|
},
|
|
35
33
|
roles: {
|
|
36
34
|
type: [String],
|
|
37
|
-
enum: Object.values(
|
|
35
|
+
enum: Object.values(UserRole),
|
|
38
36
|
required: true,
|
|
39
37
|
validate: {
|
|
40
38
|
validator: (roles) => roles.length > 0,
|
|
@@ -42,4 +40,4 @@ const announcementSchema = new mongoose_1.Schema({
|
|
|
42
40
|
},
|
|
43
41
|
},
|
|
44
42
|
});
|
|
45
|
-
|
|
43
|
+
export default model("Announcement", announcementSchema, "announcements");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Cart } from "./models/Carts";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Cart } from "./models/Carts";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Schema, Types } from "mongoose";
|
|
2
|
+
export interface CartItem {
|
|
3
|
+
article_id: Schema.Types.ObjectId;
|
|
4
|
+
quantity: number;
|
|
5
|
+
}
|
|
6
|
+
export interface CartType {
|
|
7
|
+
customer_id: Schema.Types.ObjectId;
|
|
8
|
+
items: CartItem[];
|
|
9
|
+
updated_at?: Date;
|
|
10
|
+
}
|
|
11
|
+
declare const _default: import("mongoose").Model<CartType, {}, {}, {}, import("mongoose").Document<unknown, {}, CartType> & CartType & {
|
|
12
|
+
_id: Types.ObjectId;
|
|
13
|
+
}, any>;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Schema, model, Types } from "mongoose";
|
|
2
|
+
const cartItemSchema = new Schema({
|
|
3
|
+
article_id: { type: Types.ObjectId, ref: "Article", required: true },
|
|
4
|
+
quantity: { type: Number, required: true },
|
|
5
|
+
}, { _id: false });
|
|
6
|
+
const cartSchema = new Schema({
|
|
7
|
+
customer_id: {
|
|
8
|
+
type: Types.ObjectId,
|
|
9
|
+
ref: "Customer",
|
|
10
|
+
required: true,
|
|
11
|
+
unique: true,
|
|
12
|
+
},
|
|
13
|
+
items: [cartItemSchema],
|
|
14
|
+
updated_at: { type: Date, default: Date.now },
|
|
15
|
+
});
|
|
16
|
+
export default model("Cart", cartSchema, "carts");
|
package/dist/clients/index.js
CHANGED
|
@@ -1,20 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return __importDefault(Clients_1).default; } });
|
|
9
|
-
var ClientsContact_1 = require("./models/ClientsContact");
|
|
10
|
-
Object.defineProperty(exports, "ClientContact", { enumerable: true, get: function () { return __importDefault(ClientsContact_1).default; } });
|
|
11
|
-
var ClientsAddress_1 = require("./models/ClientsAddress");
|
|
12
|
-
Object.defineProperty(exports, "ClientAddress", { enumerable: true, get: function () { return __importDefault(ClientsAddress_1).default; } });
|
|
13
|
-
var ClientsPaymentMethod_1 = require("./models/ClientsPaymentMethod");
|
|
14
|
-
Object.defineProperty(exports, "ClientPaymentMethod", { enumerable: true, get: function () { return __importDefault(ClientsPaymentMethod_1).default; } });
|
|
15
|
-
var ClientsPaymentTerm_1 = require("./models/ClientsPaymentTerm");
|
|
16
|
-
Object.defineProperty(exports, "ClientPaymentTerm", { enumerable: true, get: function () { return __importDefault(ClientsPaymentTerm_1).default; } });
|
|
17
|
-
var ClientsPriceList_1 = require("./models/ClientsPriceList");
|
|
18
|
-
Object.defineProperty(exports, "ClientPriceList", { enumerable: true, get: function () { return __importDefault(ClientsPriceList_1).default; } });
|
|
19
|
-
var ClientsSalesEmployee_1 = require("./models/ClientsSalesEmployee");
|
|
20
|
-
Object.defineProperty(exports, "ClientSalesEmployee", { enumerable: true, get: function () { return __importDefault(ClientsSalesEmployee_1).default; } });
|
|
1
|
+
export { default as Client } from "./models/Clients";
|
|
2
|
+
export { default as ClientContact } from "./models/ClientsContact";
|
|
3
|
+
export { default as ClientAddress } from "./models/ClientsAddress";
|
|
4
|
+
export { default as ClientPaymentMethod } from "./models/ClientsPaymentMethod";
|
|
5
|
+
export { default as ClientPaymentTerm } from "./models/ClientsPaymentTerm";
|
|
6
|
+
export { default as ClientPriceList } from "./models/ClientsPriceList";
|
|
7
|
+
export { default as ClientSalesEmployee } from "./models/ClientsSalesEmployee";
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const mongoose_1 = require("mongoose");
|
|
4
|
-
const clientSchema = new mongoose_1.Schema({
|
|
1
|
+
import { Schema, model } from "mongoose";
|
|
2
|
+
const clientSchema = new Schema({
|
|
5
3
|
sn_code: { type: String, index: true },
|
|
6
4
|
sn_name: { type: String, required: true },
|
|
7
5
|
tax_id: { type: String },
|
|
@@ -14,4 +12,4 @@ const clientSchema = new mongoose_1.Schema({
|
|
|
14
12
|
deleted_at: { type: Date, default: null },
|
|
15
13
|
deleted_by: { type: String, default: null },
|
|
16
14
|
}, { timestamps: { createdAt: "created_at", updatedAt: "updated_at" } });
|
|
17
|
-
|
|
15
|
+
export default model("Client", clientSchema, "clients");
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const mongoose_1 = require("mongoose");
|
|
4
|
-
const clientAddressSchema = new mongoose_1.Schema({
|
|
1
|
+
import { Schema, model } from "mongoose";
|
|
2
|
+
const clientAddressSchema = new Schema({
|
|
5
3
|
client_id: {
|
|
6
|
-
type:
|
|
4
|
+
type: Schema.Types.ObjectId,
|
|
7
5
|
ref: "Client",
|
|
8
6
|
required: true,
|
|
9
7
|
index: true,
|
|
@@ -16,4 +14,4 @@ const clientAddressSchema = new mongoose_1.Schema({
|
|
|
16
14
|
state: { type: String },
|
|
17
15
|
country: { type: String },
|
|
18
16
|
}, { timestamps: { createdAt: "created_at", updatedAt: "updated_at" } });
|
|
19
|
-
|
|
17
|
+
export default model("ClientAddress", clientAddressSchema, "client_addresses");
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const mongoose_1 = require("mongoose");
|
|
4
|
-
const clientContactSchema = new mongoose_1.Schema({
|
|
1
|
+
import { Schema, model } from "mongoose";
|
|
2
|
+
const clientContactSchema = new Schema({
|
|
5
3
|
client_id: {
|
|
6
|
-
type:
|
|
4
|
+
type: Schema.Types.ObjectId,
|
|
7
5
|
ref: "Client",
|
|
8
6
|
required: true,
|
|
9
7
|
index: true,
|
|
@@ -15,4 +13,4 @@ const clientContactSchema = new mongoose_1.Schema({
|
|
|
15
13
|
contact_email: { type: String },
|
|
16
14
|
pipedrive_id: { type: String },
|
|
17
15
|
}, { timestamps: { createdAt: "created_at", updatedAt: "updated_at" } });
|
|
18
|
-
|
|
16
|
+
export default model("ClientContact", clientContactSchema, "client_contacts");
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const mongoose_1 = require("mongoose");
|
|
4
|
-
const clientPaymentMethodSchema = new mongoose_1.Schema({
|
|
1
|
+
import { Schema, model } from "mongoose";
|
|
2
|
+
const clientPaymentMethodSchema = new Schema({
|
|
5
3
|
client_id: {
|
|
6
|
-
type:
|
|
4
|
+
type: Schema.Types.ObjectId,
|
|
7
5
|
ref: "Client",
|
|
8
6
|
required: true,
|
|
9
7
|
unique: true,
|
|
@@ -11,4 +9,4 @@ const clientPaymentMethodSchema = new mongoose_1.Schema({
|
|
|
11
9
|
code: { type: String },
|
|
12
10
|
description: { type: String },
|
|
13
11
|
}, { timestamps: { createdAt: "created_at", updatedAt: "updated_at" } });
|
|
14
|
-
|
|
12
|
+
export default model("ClientPaymentMethod", clientPaymentMethodSchema, "client_payment_methods");
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const mongoose_1 = require("mongoose");
|
|
4
|
-
const clientPaymentTermSchema = new mongoose_1.Schema({
|
|
1
|
+
import { Schema, model } from "mongoose";
|
|
2
|
+
const clientPaymentTermSchema = new Schema({
|
|
5
3
|
client_id: {
|
|
6
|
-
type:
|
|
4
|
+
type: Schema.Types.ObjectId,
|
|
7
5
|
ref: "Client",
|
|
8
6
|
required: true,
|
|
9
7
|
unique: true,
|
|
@@ -11,4 +9,4 @@ const clientPaymentTermSchema = new mongoose_1.Schema({
|
|
|
11
9
|
code: { type: String },
|
|
12
10
|
name: { type: String },
|
|
13
11
|
}, { timestamps: { createdAt: "created_at", updatedAt: "updated_at" } });
|
|
14
|
-
|
|
12
|
+
export default model("ClientPaymentTerm", clientPaymentTermSchema, "client_payment_terms");
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const mongoose_1 = require("mongoose");
|
|
4
|
-
const clientPriceListSchema = new mongoose_1.Schema({
|
|
1
|
+
import { Schema, model } from "mongoose";
|
|
2
|
+
const clientPriceListSchema = new Schema({
|
|
5
3
|
client_id: {
|
|
6
|
-
type:
|
|
4
|
+
type: Schema.Types.ObjectId,
|
|
7
5
|
ref: "Client",
|
|
8
6
|
required: true,
|
|
9
7
|
unique: true,
|
|
@@ -11,4 +9,4 @@ const clientPriceListSchema = new mongoose_1.Schema({
|
|
|
11
9
|
number: { type: String },
|
|
12
10
|
name: { type: String },
|
|
13
11
|
}, { timestamps: { createdAt: "created_at", updatedAt: "updated_at" } });
|
|
14
|
-
|
|
12
|
+
export default model("ClientPriceList", clientPriceListSchema, "client_price_lists");
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const mongoose_1 = require("mongoose");
|
|
4
|
-
const clientSalesEmployeeSchema = new mongoose_1.Schema({
|
|
1
|
+
import { Schema, model } from "mongoose";
|
|
2
|
+
const clientSalesEmployeeSchema = new Schema({
|
|
5
3
|
client_id: {
|
|
6
|
-
type:
|
|
4
|
+
type: Schema.Types.ObjectId,
|
|
7
5
|
ref: "Client",
|
|
8
6
|
required: true,
|
|
9
7
|
unique: true,
|
|
@@ -11,4 +9,4 @@ const clientSalesEmployeeSchema = new mongoose_1.Schema({
|
|
|
11
9
|
employee_code: { type: String },
|
|
12
10
|
employee_name: { type: String },
|
|
13
11
|
}, { timestamps: { createdAt: "created_at", updatedAt: "updated_at" } });
|
|
14
|
-
|
|
12
|
+
export default model("ClientSalesEmployee", clientSalesEmployeeSchema, "client_sales_employees");
|
package/dist/customers/index.js
CHANGED
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.FiscalProfile = exports.Customer = void 0;
|
|
7
|
-
var Customers_1 = require("./models/Customers");
|
|
8
|
-
Object.defineProperty(exports, "Customer", { enumerable: true, get: function () { return __importDefault(Customers_1).default; } });
|
|
9
|
-
var FiscalProfileType_1 = require("./models/FiscalProfileType");
|
|
10
|
-
Object.defineProperty(exports, "FiscalProfile", { enumerable: true, get: function () { return __importDefault(FiscalProfileType_1).default; } });
|
|
1
|
+
export { default as Customer } from "./models/Customers";
|
|
2
|
+
export { default as FiscalProfile } from "./models/FiscalProfileType";
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.CustomerStatus = void 0;
|
|
7
|
-
const mongoose_1 = require("mongoose");
|
|
8
|
-
const bcryptjs_1 = __importDefault(require("bcryptjs"));
|
|
9
|
-
var CustomerStatus;
|
|
1
|
+
import { Schema, model } from "mongoose";
|
|
2
|
+
import bcrypt from "bcryptjs";
|
|
3
|
+
export var CustomerStatus;
|
|
10
4
|
(function (CustomerStatus) {
|
|
11
5
|
CustomerStatus["ACTIVE"] = "active";
|
|
12
6
|
CustomerStatus["INACTIVE"] = "inactive";
|
|
13
7
|
CustomerStatus["BANNED"] = "banned";
|
|
14
|
-
})(CustomerStatus || (
|
|
15
|
-
const customerSchema = new
|
|
8
|
+
})(CustomerStatus || (CustomerStatus = {}));
|
|
9
|
+
const customerSchema = new Schema({
|
|
16
10
|
first_name: { type: String, required: true },
|
|
17
11
|
last_name: { type: String, required: true },
|
|
18
12
|
email: { type: String, required: true, unique: true },
|
|
@@ -23,7 +17,7 @@ const customerSchema = new mongoose_1.Schema({
|
|
|
23
17
|
enum: Object.values(CustomerStatus),
|
|
24
18
|
default: CustomerStatus.ACTIVE,
|
|
25
19
|
},
|
|
26
|
-
fiscal_profile_id: { type:
|
|
20
|
+
fiscal_profile_id: { type: Schema.Types.ObjectId, ref: "FiscalProfile" },
|
|
27
21
|
created_at: { type: Date, default: Date.now },
|
|
28
22
|
updated_at: { type: Date },
|
|
29
23
|
deleted_at: { type: Date },
|
|
@@ -31,8 +25,8 @@ const customerSchema = new mongoose_1.Schema({
|
|
|
31
25
|
// Hash password
|
|
32
26
|
customerSchema.pre("save", async function (next) {
|
|
33
27
|
if (this.isModified("password")) {
|
|
34
|
-
this.password = await
|
|
28
|
+
this.password = await bcrypt.hash(this.password, 12);
|
|
35
29
|
}
|
|
36
30
|
next();
|
|
37
31
|
});
|
|
38
|
-
|
|
32
|
+
export default model("Customer", customerSchema, "customers");
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const fiscalProfileSchema = new mongoose_1.Schema({
|
|
5
|
-
customer_id: { type: mongoose_1.Schema.Types.ObjectId, ref: "Customer", required: true },
|
|
1
|
+
import { Schema, model } from "mongoose";
|
|
2
|
+
const fiscalProfileSchema = new Schema({
|
|
3
|
+
customer_id: { type: Schema.Types.ObjectId, ref: "Customer", required: true },
|
|
6
4
|
rfc: { type: String, required: true },
|
|
7
5
|
razon_social: { type: String, required: true },
|
|
8
6
|
uso_cfdi: { type: String, required: true },
|
|
@@ -11,4 +9,4 @@ const fiscalProfileSchema = new mongoose_1.Schema({
|
|
|
11
9
|
created_at: { type: Date, default: Date.now },
|
|
12
10
|
updated_at: { type: Date },
|
|
13
11
|
});
|
|
14
|
-
|
|
12
|
+
export default model("FiscalProfile", fiscalProfileSchema, "fiscal_profiles");
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,24 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./clients"), exports);
|
|
18
|
-
__exportStar(require("./inventory"), exports);
|
|
19
|
-
__exportStar(require("./quotes"), exports);
|
|
20
|
-
__exportStar(require("./customers"), exports);
|
|
21
|
-
__exportStar(require("./orders"), exports);
|
|
22
|
-
__exportStar(require("./sap"), exports);
|
|
23
|
-
__exportStar(require("./announcements"), exports);
|
|
24
|
-
__exportStar(require("./users"), exports);
|
|
1
|
+
export * from "./clients";
|
|
2
|
+
export * from "./inventory";
|
|
3
|
+
export * from "./quotes";
|
|
4
|
+
export * from "./customers";
|
|
5
|
+
export * from "./orders";
|
|
6
|
+
export * from "./sap";
|
|
7
|
+
export * from "./announcements";
|
|
8
|
+
export * from "./users";
|
|
9
|
+
export * from "./carts";
|
package/dist/inventory/index.js
CHANGED
|
@@ -1,22 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var ArticleGroups_1 = require("./models/ArticleGroups");
|
|
10
|
-
Object.defineProperty(exports, "ArticleGroup", { enumerable: true, get: function () { return __importDefault(ArticleGroups_1).default; } });
|
|
11
|
-
var ArticleClasses_1 = require("./models/ArticleClasses");
|
|
12
|
-
Object.defineProperty(exports, "ArticleClass", { enumerable: true, get: function () { return __importDefault(ArticleClasses_1).default; } });
|
|
13
|
-
var ArticlePrices_1 = require("./models/ArticlePrices");
|
|
14
|
-
Object.defineProperty(exports, "ArticlePrice", { enumerable: true, get: function () { return __importDefault(ArticlePrices_1).default; } });
|
|
15
|
-
var Currencies_1 = require("./models/Currencies");
|
|
16
|
-
Object.defineProperty(exports, "Currency", { enumerable: true, get: function () { return __importDefault(Currencies_1).default; } });
|
|
17
|
-
var Warehouses_1 = require("./models/Warehouses");
|
|
18
|
-
Object.defineProperty(exports, "Warehouse", { enumerable: true, get: function () { return __importDefault(Warehouses_1).default; } });
|
|
19
|
-
var InventoryStocks_1 = require("./models/InventoryStocks");
|
|
20
|
-
Object.defineProperty(exports, "InventoryStock", { enumerable: true, get: function () { return __importDefault(InventoryStocks_1).default; } });
|
|
21
|
-
var PriceLists_1 = require("./models/PriceLists");
|
|
22
|
-
Object.defineProperty(exports, "PriceList", { enumerable: true, get: function () { return __importDefault(PriceLists_1).default; } });
|
|
1
|
+
export { default as Article } from "./models/Article";
|
|
2
|
+
export { default as ArticleGroup } from "./models/ArticleGroups";
|
|
3
|
+
export { default as ArticleClass } from "./models/ArticleClasses";
|
|
4
|
+
export { default as ArticlePrice } from "./models/ArticlePrices";
|
|
5
|
+
export { default as Currency } from "./models/Currencies";
|
|
6
|
+
export { default as Warehouse } from "./models/Warehouses";
|
|
7
|
+
export { default as InventoryStock } from "./models/InventoryStocks";
|
|
8
|
+
export { default as PriceList } from "./models/PriceLists";
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const mongoose_1 = require("mongoose");
|
|
4
|
-
const articleSchema = new mongoose_1.Schema({
|
|
1
|
+
import { Schema, model, Types } from "mongoose";
|
|
2
|
+
const articleSchema = new Schema({
|
|
5
3
|
article_number: { type: String, required: true, unique: true }, // SAP ItemCode
|
|
6
4
|
description: { type: String, required: true },
|
|
7
5
|
unit: { type: String, required: true },
|
|
8
6
|
brand: { type: String },
|
|
9
7
|
model: { type: String },
|
|
10
|
-
group_id: { type:
|
|
8
|
+
group_id: { type: Types.ObjectId, ref: "ArticleGroup", required: true },
|
|
11
9
|
created_at: { type: Date, default: Date.now },
|
|
12
10
|
updated_at: { type: Date },
|
|
13
11
|
});
|
|
14
|
-
|
|
12
|
+
export default model("Article", articleSchema, "articles");
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const mongoose_1 = require("mongoose");
|
|
4
|
-
const articleClassSchema = new mongoose_1.Schema({
|
|
1
|
+
import { Schema, model } from "mongoose";
|
|
2
|
+
const articleClassSchema = new Schema({
|
|
5
3
|
name: { type: String, required: true },
|
|
6
4
|
description: { type: String },
|
|
7
5
|
});
|
|
8
|
-
|
|
6
|
+
export default model("ArticleClass", articleClassSchema, "article_classes");
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const mongoose_1 = require("mongoose");
|
|
4
|
-
const articleGroupSchema = new mongoose_1.Schema({
|
|
1
|
+
import { Schema, model } from "mongoose";
|
|
2
|
+
const articleGroupSchema = new Schema({
|
|
5
3
|
name: { type: String, required: true },
|
|
6
4
|
description: { type: String },
|
|
7
5
|
});
|
|
8
|
-
|
|
6
|
+
export default model("ArticleGroup", articleGroupSchema, "article_groups");
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
price_list_id: { type: mongoose_1.Types.ObjectId, ref: "PriceList", required: true },
|
|
7
|
-
currency_id: { type: mongoose_1.Types.ObjectId, ref: "Currency", required: true },
|
|
1
|
+
import { Schema, model, Types } from "mongoose";
|
|
2
|
+
const articlePriceSchema = new Schema({
|
|
3
|
+
article_id: { type: Types.ObjectId, ref: "Article", required: true },
|
|
4
|
+
price_list_id: { type: Types.ObjectId, ref: "PriceList", required: true },
|
|
5
|
+
currency_id: { type: Types.ObjectId, ref: "Currency", required: true },
|
|
8
6
|
price: { type: Number, required: true },
|
|
9
7
|
valid_from: { type: Date },
|
|
10
8
|
valid_to: { type: Date },
|
|
11
9
|
created_at: { type: Date, default: Date.now },
|
|
12
10
|
updated_at: { type: Date },
|
|
13
11
|
});
|
|
14
|
-
|
|
12
|
+
export default model("ArticlePrice", articlePriceSchema, "article_prices");
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const mongoose_1 = require("mongoose");
|
|
4
|
-
const currencySchema = new mongoose_1.Schema({
|
|
1
|
+
import { Schema, model } from "mongoose";
|
|
2
|
+
const currencySchema = new Schema({
|
|
5
3
|
code: { type: String, required: true, unique: true },
|
|
6
4
|
symbol: { type: String, required: true },
|
|
7
5
|
name: { type: String, required: true },
|
|
8
6
|
});
|
|
9
|
-
|
|
7
|
+
export default model("Currency", currencySchema, "currencies");
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
article_id: { type: mongoose_1.Types.ObjectId, ref: "Article", required: true },
|
|
6
|
-
warehouse_id: { type: mongoose_1.Types.ObjectId, ref: "Warehouse", required: true },
|
|
1
|
+
import { Schema, model, Types } from "mongoose";
|
|
2
|
+
const inventoryStockSchema = new Schema({
|
|
3
|
+
article_id: { type: Types.ObjectId, ref: "Article", required: true },
|
|
4
|
+
warehouse_id: { type: Types.ObjectId, ref: "Warehouse", required: true },
|
|
7
5
|
count: { type: Number, required: true },
|
|
8
6
|
min_stock: { type: Number },
|
|
9
7
|
max_stock: { type: Number },
|
|
10
8
|
updated_at: { type: Date, default: Date.now },
|
|
11
9
|
});
|
|
12
|
-
|
|
10
|
+
export default model("InventoryStock", inventoryStockSchema, "inventory_stocks");
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const mongoose_1 = require("mongoose");
|
|
4
|
-
const priceListSchema = new mongoose_1.Schema({
|
|
1
|
+
import { Schema, model } from "mongoose";
|
|
2
|
+
const priceListSchema = new Schema({
|
|
5
3
|
number: { type: String, required: true, unique: true },
|
|
6
4
|
name: { type: String, required: true },
|
|
7
5
|
created_at: { type: Date, default: Date.now },
|
|
8
6
|
updated_at: { type: Date },
|
|
9
7
|
});
|
|
10
|
-
|
|
8
|
+
export default model("PriceList", priceListSchema, "price_lists");
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const mongoose_1 = require("mongoose");
|
|
4
|
-
const warehouseSchema = new mongoose_1.Schema({
|
|
1
|
+
import { Schema, model } from "mongoose";
|
|
2
|
+
const warehouseSchema = new Schema({
|
|
5
3
|
code: { type: String, required: true, unique: true },
|
|
6
4
|
name: { type: String, required: true },
|
|
7
5
|
location: { type: String },
|
|
8
6
|
created_at: { type: Date, default: Date.now },
|
|
9
7
|
updated_at: { type: Date },
|
|
10
8
|
});
|
|
11
|
-
|
|
9
|
+
export default model("Warehouse", warehouseSchema, "warehouses");
|
package/dist/orders/index.js
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.OrderStatus = exports.OrderStatusLog = exports.Order = void 0;
|
|
7
|
-
var Orders_1 = require("./models/Orders");
|
|
8
|
-
Object.defineProperty(exports, "Order", { enumerable: true, get: function () { return __importDefault(Orders_1).default; } });
|
|
9
|
-
var OrderStatusLogs_1 = require("./models/OrderStatusLogs");
|
|
10
|
-
Object.defineProperty(exports, "OrderStatusLog", { enumerable: true, get: function () { return __importDefault(OrderStatusLogs_1).default; } });
|
|
11
|
-
var Orders_2 = require("./models/Orders");
|
|
12
|
-
Object.defineProperty(exports, "OrderStatus", { enumerable: true, get: function () { return Orders_2.OrderStatus; } });
|
|
1
|
+
export { default as Order } from "./models/Orders";
|
|
2
|
+
export { default as OrderStatusLog } from "./models/OrderStatusLogs";
|
|
3
|
+
export { OrderStatus } from "./models/Orders";
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const Orders_1 = require("./Orders");
|
|
5
|
-
const orderStatusLogSchema = new mongoose_1.Schema({
|
|
1
|
+
import { Schema, model } from "mongoose";
|
|
2
|
+
import { OrderStatus } from "./Orders";
|
|
3
|
+
const orderStatusLogSchema = new Schema({
|
|
6
4
|
order_id: {
|
|
7
|
-
type:
|
|
5
|
+
type: Schema.Types.ObjectId,
|
|
8
6
|
ref: "Order",
|
|
9
7
|
required: true,
|
|
10
8
|
},
|
|
11
9
|
status: {
|
|
12
10
|
type: String,
|
|
13
|
-
enum: Object.values(
|
|
11
|
+
enum: Object.values(OrderStatus),
|
|
14
12
|
required: true,
|
|
15
13
|
},
|
|
16
14
|
changed_by: {
|
|
17
|
-
type:
|
|
15
|
+
type: Schema.Types.ObjectId,
|
|
18
16
|
ref: "User",
|
|
19
17
|
required: true,
|
|
20
18
|
},
|
|
@@ -26,4 +24,4 @@ const orderStatusLogSchema = new mongoose_1.Schema({
|
|
|
26
24
|
type: String,
|
|
27
25
|
},
|
|
28
26
|
});
|
|
29
|
-
|
|
27
|
+
export default model("OrderStatusLog", orderStatusLogSchema, "order_status_logs");
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.OrderStatus = void 0;
|
|
4
|
-
const mongoose_1 = require("mongoose");
|
|
5
|
-
var OrderStatus;
|
|
1
|
+
import { Schema, model } from "mongoose";
|
|
2
|
+
export var OrderStatus;
|
|
6
3
|
(function (OrderStatus) {
|
|
7
4
|
OrderStatus["PENDING"] = "pending";
|
|
8
5
|
OrderStatus["CONFIRMED"] = "confirmed";
|
|
9
6
|
OrderStatus["SHIPPED"] = "shipped";
|
|
10
7
|
OrderStatus["CANCELLED"] = "cancelled";
|
|
11
8
|
OrderStatus["COMPLETED"] = "completed";
|
|
12
|
-
})(OrderStatus || (
|
|
13
|
-
const orderItemSchema = new
|
|
14
|
-
article_id: { type:
|
|
9
|
+
})(OrderStatus || (OrderStatus = {}));
|
|
10
|
+
const orderItemSchema = new Schema({
|
|
11
|
+
article_id: { type: Schema.Types.ObjectId, ref: "Article", required: true },
|
|
15
12
|
quantity: { type: Number, required: true },
|
|
16
13
|
unit_price: { type: Number, required: true },
|
|
17
14
|
total: { type: Number, required: true },
|
|
18
15
|
}, { _id: false });
|
|
19
|
-
const orderSchema = new
|
|
20
|
-
customer_id: { type:
|
|
16
|
+
const orderSchema = new Schema({
|
|
17
|
+
customer_id: { type: Schema.Types.ObjectId, ref: "Customer", required: true },
|
|
21
18
|
items: [orderItemSchema],
|
|
22
19
|
status: {
|
|
23
20
|
type: String,
|
|
@@ -30,4 +27,4 @@ const orderSchema = new mongoose_1.Schema({
|
|
|
30
27
|
created_at: { type: Date, default: Date.now },
|
|
31
28
|
updated_at: { type: Date },
|
|
32
29
|
});
|
|
33
|
-
|
|
30
|
+
export default model("Order", orderSchema, "orders");
|
package/dist/quotes/index.js
CHANGED
|
@@ -1,19 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
exports.QuoteTerm = exports.QuoteContact = exports.QuoteArticleExtra = exports.QuoteArticle = exports.CreatedMethod = exports.Status = exports.QuoteStatus = exports.Quote = void 0;
|
|
7
|
-
var Quote_1 = require("./models/Quote");
|
|
8
|
-
Object.defineProperty(exports, "Quote", { enumerable: true, get: function () { return __importDefault(Quote_1).default; } });
|
|
9
|
-
Object.defineProperty(exports, "QuoteStatus", { enumerable: true, get: function () { return Quote_1.QuoteStatus; } });
|
|
10
|
-
Object.defineProperty(exports, "Status", { enumerable: true, get: function () { return Quote_1.Status; } });
|
|
11
|
-
Object.defineProperty(exports, "CreatedMethod", { enumerable: true, get: function () { return Quote_1.CreatedMethod; } });
|
|
12
|
-
var QuoteArticle_1 = require("./models/QuoteArticle");
|
|
13
|
-
Object.defineProperty(exports, "QuoteArticle", { enumerable: true, get: function () { return __importDefault(QuoteArticle_1).default; } });
|
|
14
|
-
var QuoteArticleExtra_1 = require("./models/QuoteArticleExtra");
|
|
15
|
-
Object.defineProperty(exports, "QuoteArticleExtra", { enumerable: true, get: function () { return __importDefault(QuoteArticleExtra_1).default; } });
|
|
16
|
-
var QuoteContact_1 = require("./models/QuoteContact");
|
|
17
|
-
Object.defineProperty(exports, "QuoteContact", { enumerable: true, get: function () { return __importDefault(QuoteContact_1).default; } });
|
|
18
|
-
var QuoteTerm_1 = require("./models/QuoteTerm");
|
|
19
|
-
Object.defineProperty(exports, "QuoteTerm", { enumerable: true, get: function () { return __importDefault(QuoteTerm_1).default; } });
|
|
1
|
+
export { default as Quote, QuoteStatus, Status, CreatedMethod } from "./models/Quote";
|
|
2
|
+
export { default as QuoteArticle } from "./models/QuoteArticle";
|
|
3
|
+
export { default as QuoteArticleExtra } from "./models/QuoteArticleExtra";
|
|
4
|
+
export { default as QuoteContact } from "./models/QuoteContact";
|
|
5
|
+
export { default as QuoteTerm } from "./models/QuoteTerm";
|
|
@@ -1,40 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.CreatedMethod = exports.Status = exports.QuoteStatus = void 0;
|
|
4
|
-
const mongoose_1 = require("mongoose");
|
|
5
|
-
var QuoteStatus;
|
|
1
|
+
import { Schema, model } from "mongoose";
|
|
2
|
+
export var QuoteStatus;
|
|
6
3
|
(function (QuoteStatus) {
|
|
7
4
|
QuoteStatus["OPPORTUNITY"] = "OPPORTUNITY";
|
|
8
5
|
QuoteStatus["QUOTE"] = "QUOTE";
|
|
9
6
|
QuoteStatus["FOLLOWING"] = "FOLLOWING";
|
|
10
7
|
QuoteStatus["NEGOTIATION"] = "NEGOTIATION";
|
|
11
|
-
})(QuoteStatus || (
|
|
12
|
-
var Status;
|
|
8
|
+
})(QuoteStatus || (QuoteStatus = {}));
|
|
9
|
+
export var Status;
|
|
13
10
|
(function (Status) {
|
|
14
11
|
Status["OPEN"] = "OPEN";
|
|
15
12
|
Status["WIN"] = "WIN";
|
|
16
13
|
Status["LOST"] = "LOST";
|
|
17
14
|
Status["DELETE"] = "DELETE";
|
|
18
|
-
})(Status || (
|
|
19
|
-
var CreatedMethod;
|
|
15
|
+
})(Status || (Status = {}));
|
|
16
|
+
export var CreatedMethod;
|
|
20
17
|
(function (CreatedMethod) {
|
|
21
18
|
CreatedMethod["MANUAL"] = "MANUAL";
|
|
22
19
|
CreatedMethod["CSV"] = "CSV";
|
|
23
|
-
})(CreatedMethod || (
|
|
24
|
-
const quoteSchema = new
|
|
20
|
+
})(CreatedMethod || (CreatedMethod = {}));
|
|
21
|
+
const quoteSchema = new Schema({
|
|
25
22
|
quote_number: { type: Number, required: true },
|
|
26
23
|
quote_revision: { type: Number, default: 0 },
|
|
27
24
|
quote_ref: { type: String },
|
|
28
25
|
company: { type: String },
|
|
29
|
-
company_id: { type:
|
|
26
|
+
company_id: { type: Schema.Types.ObjectId, ref: "Client", required: true },
|
|
30
27
|
company_pipedrive_id: { type: String },
|
|
31
|
-
contact_id: { type:
|
|
28
|
+
contact_id: { type: Schema.Types.ObjectId, ref: "ClientContact" },
|
|
32
29
|
project_name: { type: String },
|
|
33
30
|
project_lab: { type: String },
|
|
34
31
|
payment_condition: { type: String },
|
|
35
32
|
payment_exp: { type: String },
|
|
36
|
-
terms_ids: [{ type:
|
|
37
|
-
currency_id: { type:
|
|
33
|
+
terms_ids: [{ type: Schema.Types.ObjectId, ref: "QuoteTerm" }],
|
|
34
|
+
currency_id: { type: Schema.Types.ObjectId, ref: "Currency" },
|
|
38
35
|
iva: { type: String },
|
|
39
36
|
date: { type: Date },
|
|
40
37
|
status: { type: String, enum: Object.values(Status), default: Status.OPEN },
|
|
@@ -55,9 +52,9 @@ const quoteSchema = new mongoose_1.Schema({
|
|
|
55
52
|
enum: Object.values(CreatedMethod),
|
|
56
53
|
default: CreatedMethod.MANUAL,
|
|
57
54
|
},
|
|
58
|
-
created_by: { type:
|
|
59
|
-
updated_by: { type:
|
|
60
|
-
deleted_by: { type:
|
|
55
|
+
created_by: { type: Schema.Types.ObjectId, ref: "User" },
|
|
56
|
+
updated_by: { type: Schema.Types.ObjectId, ref: "User" },
|
|
57
|
+
deleted_by: { type: Schema.Types.ObjectId, ref: "User" },
|
|
61
58
|
deleted_at: { type: Date },
|
|
62
59
|
}, { timestamps: { createdAt: "created_at", updatedAt: "updated_at" } });
|
|
63
|
-
|
|
60
|
+
export default model("Quote", quoteSchema, "quotes");
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
quote_id: { type: mongoose_1.Schema.Types.ObjectId, ref: "Quote", required: true },
|
|
6
|
-
article_id: { type: mongoose_1.Schema.Types.ObjectId, ref: "Article" },
|
|
1
|
+
import { Schema, model } from "mongoose";
|
|
2
|
+
const quoteArticleSchema = new Schema({
|
|
3
|
+
quote_id: { type: Schema.Types.ObjectId, ref: "Quote", required: true },
|
|
4
|
+
article_id: { type: Schema.Types.ObjectId, ref: "Article" },
|
|
7
5
|
article_number: { type: String },
|
|
8
6
|
description: { type: String },
|
|
9
7
|
delivery: { type: String },
|
|
@@ -14,6 +12,6 @@ const quoteArticleSchema = new mongoose_1.Schema({
|
|
|
14
12
|
total: { type: Number },
|
|
15
13
|
utility: { type: Number },
|
|
16
14
|
type: { type: String },
|
|
17
|
-
extra_id: { type:
|
|
15
|
+
extra_id: { type: Schema.Types.ObjectId, ref: "QuoteArticleExtra" },
|
|
18
16
|
}, { timestamps: { createdAt: "created_at", updatedAt: "updated_at" } });
|
|
19
|
-
|
|
17
|
+
export default model("QuoteArticle", quoteArticleSchema, "quote_articles");
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const mongoose_1 = require("mongoose");
|
|
4
|
-
const quoteArticleExtraSchema = new mongoose_1.Schema({
|
|
1
|
+
import { Schema, model } from "mongoose";
|
|
2
|
+
const quoteArticleExtraSchema = new Schema({
|
|
5
3
|
quote_article_id: {
|
|
6
|
-
type:
|
|
4
|
+
type: Schema.Types.ObjectId,
|
|
7
5
|
ref: "QuoteArticle",
|
|
8
6
|
required: true,
|
|
9
7
|
},
|
|
@@ -13,4 +11,4 @@ const quoteArticleExtraSchema = new mongoose_1.Schema({
|
|
|
13
11
|
duty: Number,
|
|
14
12
|
mex_freight: Number,
|
|
15
13
|
}, { timestamps: { createdAt: "created_at", updatedAt: "updated_at" } });
|
|
16
|
-
|
|
14
|
+
export default model("QuoteArticleExtra", quoteArticleExtraSchema, "quote_article_extras");
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const quoteContactSchema = new mongoose_1.Schema({
|
|
5
|
-
quote_id: { type: mongoose_1.Schema.Types.ObjectId, ref: "Quote", required: true },
|
|
1
|
+
import { Schema, model } from "mongoose";
|
|
2
|
+
const quoteContactSchema = new Schema({
|
|
3
|
+
quote_id: { type: Schema.Types.ObjectId, ref: "Quote", required: true },
|
|
6
4
|
name: String,
|
|
7
5
|
email: String,
|
|
8
6
|
mobile: String,
|
|
9
7
|
pipedrive_id: String,
|
|
10
8
|
created_at: { type: Date, default: Date.now },
|
|
11
9
|
});
|
|
12
|
-
|
|
10
|
+
export default model("QuoteContact", quoteContactSchema, "quote_contacts");
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const mongoose_1 = require("mongoose");
|
|
4
|
-
const quoteTermSchema = new mongoose_1.Schema({
|
|
1
|
+
import { Schema, model } from "mongoose";
|
|
2
|
+
const quoteTermSchema = new Schema({
|
|
5
3
|
title: String,
|
|
6
4
|
content: { type: String, required: true },
|
|
7
5
|
category: String,
|
|
@@ -9,4 +7,4 @@ const quoteTermSchema = new mongoose_1.Schema({
|
|
|
9
7
|
created_by: String,
|
|
10
8
|
updated_by: String,
|
|
11
9
|
}, { timestamps: { createdAt: "created_at", updatedAt: "updated_at" } });
|
|
12
|
-
|
|
10
|
+
export default model("QuoteTerm", quoteTermSchema, "quote_terms");
|
package/dist/sap/index.js
CHANGED
|
@@ -1,8 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SyncLogType = exports.SyncLogStatus = exports.SyncLogAction = exports.SyncLog = void 0;
|
|
4
|
-
var SyncLog_1 = require("./models/SyncLog");
|
|
5
|
-
Object.defineProperty(exports, "SyncLog", { enumerable: true, get: function () { return SyncLog_1.SyncLog; } });
|
|
6
|
-
Object.defineProperty(exports, "SyncLogAction", { enumerable: true, get: function () { return SyncLog_1.SyncLogAction; } });
|
|
7
|
-
Object.defineProperty(exports, "SyncLogStatus", { enumerable: true, get: function () { return SyncLog_1.SyncLogStatus; } });
|
|
8
|
-
Object.defineProperty(exports, "SyncLogType", { enumerable: true, get: function () { return SyncLog_1.SyncLogType; } });
|
|
1
|
+
export { SyncLog, SyncLogAction, SyncLogStatus, SyncLogType } from "./models/SyncLog";
|
|
@@ -1,37 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SyncLog = exports.SyncLogAction = exports.SyncLogStatus = exports.SyncLogType = void 0;
|
|
4
|
-
const mongoose_1 = require("mongoose");
|
|
1
|
+
import { Schema, model } from "mongoose";
|
|
5
2
|
/**
|
|
6
3
|
* Sync Log Types
|
|
7
4
|
*/
|
|
8
|
-
var SyncLogType;
|
|
5
|
+
export var SyncLogType;
|
|
9
6
|
(function (SyncLogType) {
|
|
10
7
|
SyncLogType["SAP_QUOTATION"] = "SAP_QUOTATION";
|
|
11
8
|
SyncLogType["SAP_SALES_ORDER"] = "SAP_SALES_ORDER";
|
|
12
9
|
SyncLogType["PIPEDRIVE"] = "PIPEDRIVE";
|
|
13
|
-
})(SyncLogType || (
|
|
14
|
-
var SyncLogStatus;
|
|
10
|
+
})(SyncLogType || (SyncLogType = {}));
|
|
11
|
+
export var SyncLogStatus;
|
|
15
12
|
(function (SyncLogStatus) {
|
|
16
13
|
SyncLogStatus["PENDING"] = "PENDING";
|
|
17
14
|
SyncLogStatus["SUCCESS"] = "SUCCESS";
|
|
18
15
|
SyncLogStatus["FAILED"] = "FAILED";
|
|
19
16
|
SyncLogStatus["RETRYING"] = "RETRYING";
|
|
20
|
-
})(SyncLogStatus || (
|
|
21
|
-
var SyncLogAction;
|
|
17
|
+
})(SyncLogStatus || (SyncLogStatus = {}));
|
|
18
|
+
export var SyncLogAction;
|
|
22
19
|
(function (SyncLogAction) {
|
|
23
20
|
SyncLogAction["CREATE"] = "CREATE";
|
|
24
21
|
SyncLogAction["UPDATE"] = "UPDATE";
|
|
25
22
|
SyncLogAction["DELETE"] = "DELETE";
|
|
26
|
-
})(SyncLogAction || (
|
|
27
|
-
const syncLogSchema = new
|
|
23
|
+
})(SyncLogAction || (SyncLogAction = {}));
|
|
24
|
+
const syncLogSchema = new Schema({
|
|
28
25
|
entity_type: {
|
|
29
26
|
type: String,
|
|
30
27
|
required: true,
|
|
31
28
|
index: true,
|
|
32
29
|
},
|
|
33
30
|
entity_id: {
|
|
34
|
-
type:
|
|
31
|
+
type: Schema.Types.ObjectId,
|
|
35
32
|
required: true,
|
|
36
33
|
index: true,
|
|
37
34
|
},
|
|
@@ -54,17 +51,17 @@ const syncLogSchema = new mongoose_1.Schema({
|
|
|
54
51
|
},
|
|
55
52
|
error_message: { type: String },
|
|
56
53
|
error_code: { type: String },
|
|
57
|
-
error_details: { type:
|
|
58
|
-
request_payload: { type:
|
|
59
|
-
response_payload: { type:
|
|
54
|
+
error_details: { type: Schema.Types.Mixed },
|
|
55
|
+
request_payload: { type: Schema.Types.Mixed },
|
|
56
|
+
response_payload: { type: Schema.Types.Mixed },
|
|
60
57
|
retry_count: { type: Number, default: 0 },
|
|
61
58
|
max_retries: { type: Number, default: 3 },
|
|
62
59
|
next_retry_at: { type: Date },
|
|
63
60
|
resolved_at: { type: Date },
|
|
64
|
-
resolved_by: { type:
|
|
61
|
+
resolved_by: { type: Schema.Types.ObjectId, ref: "User" },
|
|
65
62
|
}, {
|
|
66
63
|
timestamps: { createdAt: "created_at", updatedAt: "updated_at" },
|
|
67
64
|
});
|
|
68
65
|
syncLogSchema.index({ entity_type: 1, entity_id: 1, status: 1 });
|
|
69
66
|
syncLogSchema.index({ status: 1, next_retry_at: 1 });
|
|
70
|
-
|
|
67
|
+
export const SyncLog = model("SyncLog", syncLogSchema, "sync_logs");
|
package/dist/users/index.js
CHANGED
|
@@ -1,10 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.UserStatus = exports.UserRole = exports.Users = void 0;
|
|
7
|
-
var Users_1 = require("./models/Users");
|
|
8
|
-
Object.defineProperty(exports, "Users", { enumerable: true, get: function () { return __importDefault(Users_1).default; } });
|
|
9
|
-
Object.defineProperty(exports, "UserRole", { enumerable: true, get: function () { return Users_1.UserRole; } });
|
|
10
|
-
Object.defineProperty(exports, "UserStatus", { enumerable: true, get: function () { return Users_1.UserStatus; } });
|
|
1
|
+
export { default as Users, UserRole, UserStatus } from "./models/Users";
|
|
@@ -1,25 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.UserStatus = exports.UserRole = void 0;
|
|
7
|
-
const mongoose_1 = require("mongoose");
|
|
8
|
-
const bcryptjs_1 = __importDefault(require("bcryptjs"));
|
|
9
|
-
var UserRole;
|
|
1
|
+
import { Schema, model } from "mongoose";
|
|
2
|
+
import bcrypt from "bcryptjs";
|
|
3
|
+
export var UserRole;
|
|
10
4
|
(function (UserRole) {
|
|
11
5
|
UserRole["ADMIN"] = "admin";
|
|
12
6
|
UserRole["SALES"] = "sales";
|
|
13
7
|
UserRole["TECHNICIAN"] = "technician";
|
|
14
8
|
UserRole["WAREHOUSEMAN"] = "warehouseman";
|
|
15
|
-
})(UserRole || (
|
|
16
|
-
var UserStatus;
|
|
9
|
+
})(UserRole || (UserRole = {}));
|
|
10
|
+
export var UserStatus;
|
|
17
11
|
(function (UserStatus) {
|
|
18
12
|
UserStatus["ACTIVE"] = "active";
|
|
19
13
|
UserStatus["INACTIVE"] = "inactive";
|
|
20
14
|
UserStatus["SUSPENDED"] = "suspended";
|
|
21
|
-
})(UserStatus || (
|
|
22
|
-
const usersSchema = new
|
|
15
|
+
})(UserStatus || (UserStatus = {}));
|
|
16
|
+
const usersSchema = new Schema({
|
|
23
17
|
first_name: { type: String, required: true },
|
|
24
18
|
middle_name: { type: String },
|
|
25
19
|
last_name: { type: String, required: true },
|
|
@@ -41,16 +35,16 @@ const usersSchema = new mongoose_1.Schema({
|
|
|
41
35
|
sap_id: { type: String },
|
|
42
36
|
sap_employee_id: { type: String },
|
|
43
37
|
created_at: { type: Date, default: Date.now },
|
|
44
|
-
created_by: { type:
|
|
38
|
+
created_by: { type: Schema.Types.Mixed, ref: "User" },
|
|
45
39
|
updated_at: { type: Date },
|
|
46
|
-
updated_by: { type:
|
|
40
|
+
updated_by: { type: Schema.Types.ObjectId, ref: "User" },
|
|
47
41
|
deleted_at: { type: Date },
|
|
48
|
-
deleted_by: { type:
|
|
42
|
+
deleted_by: { type: Schema.Types.ObjectId, ref: "User" },
|
|
49
43
|
});
|
|
50
44
|
usersSchema.pre("save", async function (next) {
|
|
51
45
|
if (this.isModified("password")) {
|
|
52
|
-
this.password = await
|
|
46
|
+
this.password = await bcrypt.hash(this.password, 12);
|
|
53
47
|
}
|
|
54
48
|
next();
|
|
55
49
|
});
|
|
56
|
-
|
|
50
|
+
export default model("User", usersSchema, "users");
|
package/package.json
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fesmex/models",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"main": "dist/index.js",
|
|
5
6
|
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"require": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
6
14
|
"files": [
|
|
7
15
|
"dist"
|
|
8
16
|
],
|