From fc91aa7f135ba6ea07c06548381ca6c03ca64a5e Mon Sep 17 00:00:00 2001 From: Mihoub Debache Date: Fri, 19 Jan 2024 14:21:47 +0100 Subject: [PATCH] fix(identifiers & weblinks): update route, avoid error 500 from server --- src/api/identifiers/identifier.routes.js | 3 ++- src/api/weblinks/weblinks.routes.js | 3 ++- src/openapi/schemas/weblinks/weblinks.yml | 15 +++++---------- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/api/identifiers/identifier.routes.js b/src/api/identifiers/identifier.routes.js index cc630b31..fbf9300a 100644 --- a/src/api/identifiers/identifier.routes.js +++ b/src/api/identifiers/identifier.routes.js @@ -2,10 +2,11 @@ import express from 'express'; import controllers from '../commons/middlewares/crud.middlewares'; import { identifiersRepository as repository } from '../commons/repositories'; import { identifiers as resource } from '../resources'; +import { readQuery } from '../commons/queries/identifiers.query'; const router = new express.Router(); router.route(`/${resource}`) - .get(controllers.list(repository)); + .get(controllers.list(repository, readQuery)); export default router; diff --git a/src/api/weblinks/weblinks.routes.js b/src/api/weblinks/weblinks.routes.js index 87d88ec6..267695d5 100644 --- a/src/api/weblinks/weblinks.routes.js +++ b/src/api/weblinks/weblinks.routes.js @@ -2,10 +2,11 @@ import express from 'express'; import controllers from '../commons/middlewares/crud.middlewares'; import { weblinksRepository as repository } from '../commons/repositories'; import { weblinks as resource } from '../resources'; +import { readQuery } from '../commons/queries/weblinks.query'; const router = new express.Router(); router.route(`/${resource}`) - .get(controllers.list(repository)); + .get(controllers.list(repository, readQuery)); export default router; diff --git a/src/openapi/schemas/weblinks/weblinks.yml b/src/openapi/schemas/weblinks/weblinks.yml index 20926faf..7aa7e5df 100644 --- a/src/openapi/schemas/weblinks/weblinks.yml +++ b/src/openapi/schemas/weblinks/weblinks.yml @@ -11,20 +11,15 @@ allOf: resourceId: type: string readOnly: true - description: Unique resource identifier + description: Unique parent resource identifier pattern: '^[a-zA-Z0-9]{5}$' type: $ref: ../../api.yml#/components/schemas/WeblinksEnum - value: + url: type: string - active: - type: boolean - startDate: + language: type: string + description: Language of the web link on 2 letters + pattern: '^[a-zA-Z]{2}$' nullable: true - pattern: '((^$)|(^\d{4}$)|(^\d{4}-(0[1-9]|1[0-2]))|(^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$))' - endDate: - type: string - nullable: true - pattern: '((^$)|(^\d{4}$)|(^\d{4}-(0[1-9]|1[0-2]))|(^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$))' - $ref: '../../api.yml#/components/schemas/Metas' \ No newline at end of file