2023-12-29 20:11:07 -05:00
|
|
|
import mongoose, { Schema, PopulatedDoc, Model } from "mongoose";
|
2023-10-02 16:02:31 -04:00
|
|
|
|
|
|
|
import { IPrivMsg } from "./privMsg";
|
2023-10-02 16:06:01 -04:00
|
|
|
import { IUser } from "./user";
|
2023-10-02 16:02:31 -04:00
|
|
|
export interface IInbox {
|
2023-12-30 00:46:11 -05:00
|
|
|
owningUser: PopulatedDoc<IUser & Document>;
|
|
|
|
saved: PopulatedDoc<IPrivMsg & Document>[];
|
|
|
|
received: PopulatedDoc<IPrivMsg & Document>[];
|
|
|
|
sent: PopulatedDoc<IPrivMsg & Document>[];
|
2023-10-02 16:02:31 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
const InboxSchema = new Schema<IInbox>({
|
2023-10-02 16:06:01 -04:00
|
|
|
owningUser: {
|
2023-10-02 16:02:31 -04:00
|
|
|
type: Number,
|
2023-10-02 16:06:01 -04:00
|
|
|
ref: "User",
|
2023-10-02 16:02:31 -04:00
|
|
|
},
|
|
|
|
saved: [
|
|
|
|
{
|
|
|
|
type: Number,
|
|
|
|
ref: "PrivMsg",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
received: [
|
|
|
|
{
|
|
|
|
type: Number,
|
|
|
|
ref: "PrivMsg",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
sent: [
|
|
|
|
{
|
|
|
|
type: Number,
|
|
|
|
ref: "PrivMsg",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
|
2023-12-29 20:11:07 -05:00
|
|
|
export const Inbox: Model<IInbox> = mongoose.model<IInbox>("Inbox", InboxSchema, "inboxes");
|