From a16e58b2b46b8337e04a79a7039ed87a9795acc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=98=99=E2=97=A6=20The=20Tablet=20=E2=9D=80=20GamerGirla?= =?UTF-8?q?ndCo=20=E2=97=A6=E2=9D=A7?= Date: Mon, 2 Oct 2023 16:06:01 -0400 Subject: [PATCH] refactor(db/models): change _id field in inbox schema to a reference field that points to the owning user --- models/inbox.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/models/inbox.ts b/models/inbox.ts index 2335844..ed46ea6 100644 --- a/models/inbox.ts +++ b/models/inbox.ts @@ -8,16 +8,18 @@ import mongoose, { import SequenceFactory from "mongoose-sequence"; import { IPrivMsg } from "./privMsg"; +import { IUser } from "./user"; export interface IInbox { - _id: number; + owningUser: PopulatedDoc; saved: PopulatedDoc[]; received: PopulatedDoc[]; sent: PopulatedDoc[]; } const InboxSchema = new Schema({ - _id: { + owningUser: { type: Number, + ref: "User", }, saved: [ {