Skip to content

Commit

Permalink
mongoose 7 upgrade (#174)
Browse files Browse the repository at this point in the history
* mongoose 7 upgrade

---------

Co-authored-by: Aaron Shiel <[email protected]>
  • Loading branch information
aaronshiel and Aaron Shiel authored Nov 7, 2024
1 parent 4e2164d commit 179721b
Show file tree
Hide file tree
Showing 7 changed files with 459 additions and 566 deletions.
25 changes: 6 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Development

Required Software
=================
- node 13.2+
- node 18.13+
- npm
- make

Expand All @@ -42,21 +42,8 @@ To fix formatting issues:
make format
```

Releases
--------

Currently, this image is semantically versioned. When making changes that you want to test in another project, create a branch and PR and then you can release a test tag one of two ways:

To build/push a pre-release semver tag of `mentor-graphql` for the current commit in your branch

- create a [github release](https://github.com/ICTLearningSciences/mentor-graphql/releases/new) **from your development branch** with tag format `/^\d+\.\d+\.\d+(-[a-z\d\-.]+)?$/` (e.g. `1.0.0-alpha.1`)
- find the `docker_tag_release` workflow for your git tag in [github actions](https://github.com/ICTLearningSciences/mentor-graphql/actions?query=workflow%3A%22build%2Fpub+candidate%22)
- this will create a tag like `mentorpal/mentor-graphql:1.0.0-alpha.1`



Once your changes are approved and merged to main, you should create a release tag in semver format as follows:

- create a [github release](https://github.com/ICTLearningSciences/mentor-graphql/releases/new) **from main** with tag format `/^\d+\.\d+\.\d$/` (e.g. `1.0.0`)
- find the `docker_tag_release` workflow for your git tag in [github actions](https://github.com/ICTLearningSciences/mentor-graphql/actions?query=workflow%3A%22build%2Fpub+release%22)
- this will create a tag like `mentorpal/mentor-graphql:1.0.0`
Technical Debt
-------------
- mongoose
- delete mongo-cursor-pagination bson override once mongoose 8 upgrade is complete
- track ip package fix here https://github.com/indutny/node-ip/issues/150, delete override once fixed
655 changes: 274 additions & 381 deletions node/package-lock.json

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"node": ">=16.14",
"npm": ">=6.13.1"
},
"overrides": {
"mongo-cursor-pagination": {
"bson": "5.5.0"
},
"ip": "https://registry.npmjs.org/neoip/-/neoip-2.1.0.tgz"
},
"scripts": {
"build": "tsc",
"deps:update": "npx ncu -u",
Expand Down Expand Up @@ -35,6 +41,7 @@
"@types/object-path": "^0.11.1",
"axios": "^1.7.7",
"base64url": "^3.0.1",
"bson": "^5.5.0",
"cookie-parser": "^1.4.6",
"cors": "^2.8.5",
"debug": "^4.3.4",
Expand All @@ -47,9 +54,10 @@
"jsonwebtoken": "^9.0.1",
"longjohn": "^0.2.12",
"mongo-cursor-pagination": "^8.1.3",
"mongoose": "^6.9.0",
"mongoose": "^7.8.0",
"mongoose-findorcreate": "^4.0.0",
"morgan": "^1.10.0",
"neoip": "^3.0.1",
"nodemailer": "^6.9.9",
"object-path": "^0.11.8",
"passport": "^0.6.0",
Expand Down
3 changes: 2 additions & 1 deletion node/src/models/Keyword.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import {
PaginateQuery,
pluginPagination,
} from './Paginatation';
import { Types } from 'mongoose';

export interface Keyword extends Document {
export interface Keyword extends Document<Types.ObjectId> {
type: string;
keywords: string[];
}
Expand Down
5 changes: 4 additions & 1 deletion node/src/models/Subject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,10 @@ SubjectSchema.statics.addOrUpdateQuestions = async function (
};

SubjectSchema.pre(/find.*/, function (next) {
this.where({ deleted: { $ne: true } });
this.$where = {
...this.$where,
deleted: { $ne: true },
};
next();
});

Expand Down
Loading

0 comments on commit 179721b

Please sign in to comment.