constatic
Version:
Constatic cli
19 lines (18 loc) • 427 B
text/typescript
import { Schema } from "mongoose";
import { t } from "../utils.js";
export const guildSchema = new Schema(
{
id: t.string,
channels: {
logs: t.channelInfo,
general: t.channelInfo,
}
},
{
statics: {
async get(id: string) {
return await this.findOne({ id }) ?? this.create({ id });
}
}
}
);