@fesmex/models 0.1.8 → 0.1.9
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/carts/index.d.ts +1 -0
- package/dist/carts/index.js +8 -0
- package/dist/carts/models/Carts.d.ts +14 -0
- package/dist/carts/models/Carts.js +18 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Cart } from "./models/Carts";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
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.Cart = void 0;
|
|
7
|
+
var Carts_1 = require("./models/Carts");
|
|
8
|
+
Object.defineProperty(exports, "Cart", { enumerable: true, get: function () { return __importDefault(Carts_1).default; } });
|
|
@@ -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,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mongoose_1 = require("mongoose");
|
|
4
|
+
const cartItemSchema = new mongoose_1.Schema({
|
|
5
|
+
article_id: { type: mongoose_1.Types.ObjectId, ref: "Article", required: true },
|
|
6
|
+
quantity: { type: Number, required: true },
|
|
7
|
+
}, { _id: false });
|
|
8
|
+
const cartSchema = new mongoose_1.Schema({
|
|
9
|
+
customer_id: {
|
|
10
|
+
type: mongoose_1.Types.ObjectId,
|
|
11
|
+
ref: "Customer",
|
|
12
|
+
required: true,
|
|
13
|
+
unique: true,
|
|
14
|
+
},
|
|
15
|
+
items: [cartItemSchema],
|
|
16
|
+
updated_at: { type: Date, default: Date.now },
|
|
17
|
+
});
|
|
18
|
+
exports.default = (0, mongoose_1.model)("Cart", cartSchema, "carts");
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED