21 lines
1.0 KiB
TypeScript
21 lines
1.0 KiB
TypeScript
import { Schema, model } from "mongoose";
|
|
|
|
import { ICancelOrderItem } from "./Abstraction/ICancelItem";
|
|
import { OrderItemsStatus } from "../../../common/enums/order.enum";
|
|
//TODO:add a refund model to refund user after complete return
|
|
const CancelOrderItemSchema = new Schema<ICancelOrderItem>(
|
|
{
|
|
cancelOrderId: { type: Schema.Types.ObjectId, ref: "CancelOrder", required: true },
|
|
orderItem: { type: Schema.Types.ObjectId, ref: "OrderItem", required: true },
|
|
shipmentItem: { type: Schema.Types.ObjectId, required: true },
|
|
quantity: { type: Number, required: true },
|
|
comment: { type: String, required: true },
|
|
reason: { type: Schema.Types.ObjectId, ref: "CancelReason", required: true },
|
|
status: { type: String, enum: OrderItemsStatus, default: OrderItemsStatus.cancelled_system },
|
|
},
|
|
{ timestamps: true, toJSON: { versionKey: false, virtuals: true }, id: false },
|
|
);
|
|
|
|
const CancelOrderItemModel = model<ICancelOrderItem>("CancelOrderItem", CancelOrderItemSchema);
|
|
export { CancelOrderItemModel };
|