Skip to content

Commit

Permalink
Fix backend tests, remove ts-node
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideViolante committed Nov 11, 2023
1 parent fd8aef9 commit dd4237c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 60 deletions.
88 changes: 32 additions & 56 deletions package-lock.json

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

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@
"nodemon": "^3.0.1",
"sass-lint": "^1.13.1",
"supertest": "^6.3.3",
"ts-jest": "^29.0.5",
"ts-node": "~8.3.0",
"ts-jest": "^29.1.1",
"typescript": "~5.2.2"
}
}
4 changes: 2 additions & 2 deletions server/controllers/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ abstract class BaseCtrl {
// Count all
count = async (req: Request, res: Response) => {
try {
const count = await this.model.count();
const count = await this.model.countDocuments();
return res.status(200).json(count);
} catch (err: any) {
return res.status(400).json({ error: err.message });
Expand Down Expand Up @@ -57,7 +57,7 @@ abstract class BaseCtrl {
// Delete by id
delete = async (req: Request, res: Response) => {
try {
await this.model.findOneAndRemove({ _id: req.params.id });
await this.model.findOneAndDelete({ _id: req.params.id });
return res.sendStatus(200);
} catch (err: any) {
return res.status(400).json({ error: err.message });
Expand Down

0 comments on commit dd4237c

Please sign in to comment.