summary refs log tree commit diff
path: root/src/models/index.ts
blob: 876e5984d13b1c4d24a0afe827cec1358bb7bb3d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import mongoose from "mongoose";
import { Schema } from "mongoose";
import mongooseAutoPopulate from "mongoose-autopopulate";

mongoose.plugin(mongooseAutoPopulate);

mongoose.plugin((schema: Schema, opts: any) => {
	schema.set("toObject", {
		virtuals: true,
		versionKey: false,
		transform(doc: any, ret: any) {
			delete ret._id;
			delete ret.__v;
			const props = schema.get("removeResponse") || [];
			props.forEach((prop: string) => {
				delete ret[prop];
			});
		},
	});
});

export * from "./Ban";
export * from "./Channel";
export * from "./Emoji";
export * from "./Guild";
export * from "./Invite";
export * from "./Member";
export * from "./Role";
export * from "./User";
export * from "./Activity";
export * from "./Application";
export * from "./Interaction";
export * from "./Message";
export * from "./Status";
export * from "./VoiceState";
export * from "./Event";