mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-11 13:14:06 +01:00
✨ BanSchema
This commit is contained in:
parent
1357796da3
commit
e3f5d7060b
@ -1,5 +1,6 @@
|
||||
import { Schema, model, Types, Document } from "mongoose";
|
||||
import db from "../util/Database";
|
||||
import { PublicUserProjection, UserModel } from "./User";
|
||||
|
||||
export interface Ban extends Document {
|
||||
user_id: string;
|
||||
@ -17,5 +18,13 @@ export const BanSchema = new Schema({
|
||||
ip: String, // ? Should we store this in here, or in the UserModel?
|
||||
});
|
||||
|
||||
BanSchema.virtual("user", {
|
||||
ref: UserModel,
|
||||
localField: "id",
|
||||
foreignField: "user_id",
|
||||
justOne: true,
|
||||
autopopulate: { select: PublicUserProjection },
|
||||
});
|
||||
|
||||
// @ts-ignore
|
||||
export const BanModel = db.model<Ban>("Ban", BanSchema, "bans");
|
||||
|
Loading…
Reference in New Issue
Block a user