Skip to content

Commit

Permalink
dep: upgrade mongoose to v8
Browse files Browse the repository at this point in the history
  • Loading branch information
jrassa committed Jun 28, 2024
1 parent 32a7ada commit f6deae9
Show file tree
Hide file tree
Showing 26 changed files with 277 additions and 208 deletions.
229 changes: 99 additions & 130 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
"luxon": "^1.28.1",
"method-override": "3.0",
"migrate-mongo": "^11.0.0",
"mongoose": "^6.12.6",
"mongoose-unique-validator": "3.1.0",
"mongoose": "^8.4.4",
"mongoose-unique-validator": "^5.0.1",
"morgan": "1.9",
"multipipe": "^4.0.0",
"nodemailer": "6.9.9",
Expand Down
8 changes: 6 additions & 2 deletions src/app/common/mongoose/contains-search.plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ export interface ContainsSearchable {
containsSearch(search: string, fields?: string[]): this;
}

export function containsSearchPlugin(
schema: Schema,
export function containsSearchPlugin<
EnforcedDocType,
TModelType,
TInstanceMethods
>(
schema: Schema<EnforcedDocType, TModelType, TInstanceMethods>,
pluginOptions: { fields?: string[] } = {}
) {
schema.query['containsSearch'] = function (
Expand Down
4 changes: 3 additions & 1 deletion src/app/common/mongoose/getter.plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import { Schema } from 'mongoose';
* configures schema to include getters in `toObject` and `toJSON`
*
*/
export = function getterPlugin(schema: Schema) {
export = function getterPlugin<EnforcedDocType, TModelType, TInstanceMethods>(
schema: Schema<EnforcedDocType, TModelType, TInstanceMethods>
) {
schema.set('toObject', { getters: true });
schema.set('toJSON', { getters: true });
};
4 changes: 3 additions & 1 deletion src/app/common/mongoose/paginate.plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export interface Paginateable<DocType> {
): Promise<PagingResults<DocType>>;
}

export function paginatePlugin(schema: Schema) {
export function paginatePlugin<EnforcedDocType, TModelType, TInstanceMethods>(
schema: Schema<EnforcedDocType, TModelType, TInstanceMethods>
) {
schema.query['paginate'] = async function <DocType>(
this: Query<HydratedDocument<DocType>[], DocType>,
pageSize: number,
Expand Down
Loading

0 comments on commit f6deae9

Please sign in to comment.