diff --git a/models/inbox.ts b/models/inbox.ts new file mode 100644 index 0000000..2335844 --- /dev/null +++ b/models/inbox.ts @@ -0,0 +1,46 @@ +import mongoose, { + Schema, + connect, + PopulatedDoc, + Document, + Model, +} from "mongoose"; +import SequenceFactory from "mongoose-sequence"; + +import { IPrivMsg } from "./privMsg"; +export interface IInbox { + _id: number; + saved: PopulatedDoc[]; + received: PopulatedDoc[]; + sent: PopulatedDoc[]; +} + +const InboxSchema = new Schema({ + _id: { + type: Number, + }, + saved: [ + { + type: Number, + ref: "PrivMsg", + }, + ], + received: [ + { + type: Number, + ref: "PrivMsg", + }, + ], + sent: [ + { + type: Number, + ref: "PrivMsg", + }, + ], +}); + +export const Inbox: Model = mongoose.model( + "Inbox", + InboxSchema, + "inboxes", +);