import mongoose, { Schema, PopulatedDoc, Model } from "mongoose"; import { IPrivMsg } from "./privMsg"; import { IUser } from "./user"; export interface IInbox { owningUser: PopulatedDoc; saved: PopulatedDoc[]; received: PopulatedDoc[]; sent: PopulatedDoc[]; } const InboxSchema = new Schema({ owningUser: { type: Number, ref: "User", }, saved: [ { type: Number, ref: "PrivMsg", }, ], received: [ { type: Number, ref: "PrivMsg", }, ], sent: [ { type: Number, ref: "PrivMsg", }, ], }); export const Inbox: Model = mongoose.model("Inbox", InboxSchema, "inboxes");