This commit is contained in:
mahyargdz
2025-09-14 15:15:03 +03:30
commit be82059172
534 changed files with 51310 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
import { Schema, model } from "mongoose";
import { ICoupon } from "./Abstraction/ICoupon";
const CouponSchema = new Schema<ICoupon>(
{
shopId: { type: Schema.Types.ObjectId, ref: "Shop", required: true },
discountPercentage: { type: Number, default: 0 },
discountAmount: { type: Number, default: 0 },
usageLimit: { type: Number, default: null },
usageCount: { type: Number, default: 0 },
userUsageLimit: { type: Number, default: null },
code: { type: String, required: true, unique: true },
minPurchaseAmount: { type: Number, default: null },
category: { type: [Schema.Types.ObjectId], ref: "Category", default: [] },
includedProducts: { type: [Number], ref: "Product", default: [] },
excludedProducts: { type: [Number], ref: "Product", default: [] },
description: { type: String, default: null },
isActive: { type: Boolean, default: true },
includeSpecialSale: { type: Boolean, default: true },
expirationDate: { type: String, required: true },
deleted: { type: Boolean, default: false },
},
{ timestamps: true, toJSON: { versionKey: false }, id: false },
);
const CouponModel = model<ICoupon>("Coupon", CouponSchema);
export { CouponModel };