api/resources/Supports/supportModel.js
2024-03-20 10:32:02 +05:30

68 lines
1.3 KiB
JavaScript

import mongoose from "mongoose";
const { Schema, model } = mongoose;
const supportSchema = new Schema(
{
ticketId: {
type: String,
required: true,
unique: true,
},
addedBy: {
type: Schema.Types.ObjectId,
ref: "User",
required: true,
},
subject: {
type: String,
required: true,
},
description: {
type: String,
maxLength: [100, "description cannot exceed 100 characters"],
required: [true, "Please Enter product Description"],
},
createdOn: {
type: String,
},
lastreply: {
type: String,
},
status: {
type: String,
enum: ["Open", "Close"],
default: "Open",
},
image: [
{
public_id: {
type: String,
// required: true,
},
url: {
type: String,
// required: true,
},
},
],
message: [
{
message: {
type: String,
default: "",
},
user: {
type: String,
enum: ["admin", "user"],
default: "user",
},
replyDate: {
type: String,
},
},
],
},
{ timestamps: true, versionKey: false }
);
export const Support = model("Support", supportSchema);