diff --git a/apps/server/src/models/event.ts b/apps/server/src/models/event.ts index 35517dc..dc12822 100644 --- a/apps/server/src/models/event.ts +++ b/apps/server/src/models/event.ts @@ -1,9 +1,10 @@ import { getModelForClass, plugin, prop, ReturnModelType } from '@typegoose/typegoose' import mongoose from 'mongoose' import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses' -import { User } from '@/models/user' import mongoosePaginate from 'mongoose-paginate-v2' +import { User } from '@/models/user' + @plugin(mongoosePaginate) export class Events extends TimeStamps { static paginate: mongoose.PaginateModel['paginate'] @@ -57,6 +58,7 @@ export class Events extends TimeStamps { return { _id: this._id, name: this.name, + address: this.address, location: this.location, startDate: this.startDate, endDate: this.endDate, @@ -71,7 +73,11 @@ export class Events extends TimeStamps { } } - public static async findByCategory(this: ReturnModelType, category: string, options: object) { + public static async findByCategory( + this: ReturnModelType, + category: string, + options: mongoose.PaginateOptions, + ): Promise>> { return await this.paginate({ category: category }, options) } }