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-29 19:06:55 -05:00
|
|
|
owningUser: PopulatedDoc<IUser>;
|
|
|
|
saved: PopulatedDoc<IPrivMsg>[];
|
|
|
|
received: PopulatedDoc<IPrivMsg>[];
|
|
|
|
sent: PopulatedDoc<IPrivMsg>[];
|
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");
|