import mongoose, {Schema, PopulatedDoc, Document, Model, model} from "mongoose"; import { IBand } from "../../models/band"; import { IUser } from "../../models/user"; import SequenceFactory from "mongoose-sequence"; import { hasMigrated } from "../../lib/dbconfig"; const AutoIncrement = SequenceFactory(mongoose); export interface IFicmas { _id: number; kink: string; year: string; bands: PopulatedDoc[]; relationship: string; wisher: PopulatedDoc; anniversary: boolean; } export const FicmasSchema = new mongoose.Schema({ _id: { type: Number }, kink: { type: String }, year: { type: String }, bands: [{ type: Number, ref: "Band" }], relationship: { type: String }, wisher: { type: Number, ref: "User" }, anniversary: { type: Boolean, default: false } }) hasMigrated && FicmasSchema.plugin(AutoIncrement, {id: "ficmas_wishes"}) export const Ficmas: Model = /* mongoose.models.Ficmas || */ model("Ficmas", FicmasSchema, "ficmas_wishes")