Skip to content

Commit

Permalink
Merge pull request #1380 from myrotvorets/renovate/myrotvorets-expres…
Browse files Browse the repository at this point in the history
…s-microservice-middlewares-3.x

chore(deps): update dependency @myrotvorets/express-microservice-middlewares to v3
  • Loading branch information
myrotvorets-team authored Feb 19, 2024
2 parents 862d7a8 + f57c135 commit 784a10d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"dependencies": {
"@cloudnative/health-connect": "^2.1.0",
"@myrotvorets/express-async-middleware-wrapper": "^2.2.0",
"@myrotvorets/express-microservice-middlewares": "^2.2.0",
"@myrotvorets/express-microservice-middlewares": "^3.0.0",
"@myrotvorets/express-request-logger": "^1.2.1",
"@myrotvorets/oav-installer": "^5.0.0",
"@myrotvorets/opentelemetry-configurator": "^7.5.0",
Expand Down
8 changes: 2 additions & 6 deletions src/controllers/search.mts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { type NextFunction, type Request, type Response, Router } from 'express';
import { asyncWrapperMiddleware } from '@myrotvorets/express-async-middleware-wrapper';
import { ApiError } from '@myrotvorets/express-microservice-middlewares';
import type { SearchItem } from '../services/searchservice.mjs';
import { LocalsWithContainer } from '../lib/container.mjs';

Expand All @@ -22,12 +23,7 @@ async function searchHandler(
const service = res.locals.container.resolve('searchService');
const result = await service.search(req.query.s);
if (result === null) {
next({
success: false,
status: 400,
code: 'BAD_SEARCH_TERM',
message: 'Both surname and name are required',
});
next(new ApiError(400, 'BAD_SEARCH_TERM', 'Both surname and name are required'));
} else {
res.json({
success: true,
Expand Down
2 changes: 1 addition & 1 deletion src/server.mts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function configureApp(app: Express): ReturnType<typeof initializeContaine
installOpenApiValidator(join(base, 'specs', 'dzhura-private.yaml'), env.NODE_ENV),
searchController(),
notFoundMiddleware,
errorMiddleware,
errorMiddleware(),
);
return container;
} /* c8 ignore start */ catch (e) {
Expand Down

0 comments on commit 784a10d

Please sign in to comment.