refactor(db/models): change _id field in inbox schema to a reference field that points to the owning user
This commit is contained in:
parent
38516dc80d
commit
a16e58b2b4
@ -8,16 +8,18 @@ import mongoose, {
|
|||||||
import SequenceFactory from "mongoose-sequence";
|
import SequenceFactory from "mongoose-sequence";
|
||||||
|
|
||||||
import { IPrivMsg } from "./privMsg";
|
import { IPrivMsg } from "./privMsg";
|
||||||
|
import { IUser } from "./user";
|
||||||
export interface IInbox {
|
export interface IInbox {
|
||||||
_id: number;
|
owningUser: PopulatedDoc<IUser & Document>;
|
||||||
saved: PopulatedDoc<IPrivMsg & Document>[];
|
saved: PopulatedDoc<IPrivMsg & Document>[];
|
||||||
received: PopulatedDoc<IPrivMsg & Document>[];
|
received: PopulatedDoc<IPrivMsg & Document>[];
|
||||||
sent: PopulatedDoc<IPrivMsg & Document>[];
|
sent: PopulatedDoc<IPrivMsg & Document>[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const InboxSchema = new Schema<IInbox>({
|
const InboxSchema = new Schema<IInbox>({
|
||||||
_id: {
|
owningUser: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
ref: "User",
|
||||||
},
|
},
|
||||||
saved: [
|
saved: [
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user