first
This commit is contained in:
@@ -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 };
|
||||
Reference in New Issue
Block a user