fix: superfluous fields after converting guild to client representation
This commit is contained in:
parent
c5666dc387
commit
e066f0f23f
@ -2,14 +2,18 @@ import { IGuild } from "@/src/types/guildTypes";
|
||||
import { model, Schema } from "mongoose";
|
||||
import { toOid } from "@/src/helpers/inventoryHelpers";
|
||||
|
||||
const guildSchema = new Schema<IGuild>({
|
||||
Name: { type: String, required: true }
|
||||
});
|
||||
const guildSchema = new Schema<IGuild>(
|
||||
{
|
||||
Name: { type: String, required: true }
|
||||
},
|
||||
{ id: false }
|
||||
);
|
||||
|
||||
guildSchema.set("toJSON", {
|
||||
virtuals: true,
|
||||
transform(_document, guild) {
|
||||
guild._id = toOid(guild._id);
|
||||
delete guild.__v;
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user