@@ -2,10 +2,12 @@ import express from 'express';
22
33import { toISODateWithoutMilliseconds } from '../../archivist/utils/date.js' ;
44
5- import versionsRepository from './versionsRepository.js' ;
65import { findServiceCaseInsensitive } from './utils.js' ;
6+ import versionsRepository from './versionsRepository.js' ;
77
88/**
9+ * @param {object } services The services to be exposed by the API
10+ * @returns {express.Router } The router instance
911 * @private
1012 * @swagger
1113 * tags:
@@ -32,62 +34,62 @@ export default function versionsRouter(services) {
3234 const router = express . Router ( ) ;
3335
3436 /**
35- * @private
36- * @swagger
37- * /version/{serviceId}/{termsType}/{date}:
38- * get:
39- * summary: Get a specific version of some terms at a given date.
40- * tags: [Versions]
41- * produces:
42- * - application/json
43- * parameters:
44- * - in: path
45- * name: serviceId
46- * description: The ID of the service whose version will be returned.
47- * schema:
48- * type: string
49- * required: true
50- * - in: path
51- * name: termsType
52- * description: The type of terms whose version will be returned.
53- * schema:
54- * type: string
55- * required: true
56- * - in: path
57- * name: date
58- * description: The date and time for which the version is requested, in ISO 8601 format.
59- * schema:
60- * type: string
61- * format: date-time
62- * required: true
63- * responses:
64- * 200:
65- * description: A JSON object containing the version content and metadata.
66- * content:
67- * application/json:
68- * schema:
69- * $ref: '#/components/schemas/Version'
70- * 404:
71- * description: No version found for the specified combination of service ID, terms type and date.
72- * content:
73- * application/json:
74- * schema:
75- * type: object
76- * properties:
77- * error:
78- * type: string
79- * description: Error message indicating that no version is found.
80- * 416:
81- * description: The requested date is in the future.
82- * content:
83- * application/json:
84- * schema:
85- * type: object
86- * properties:
87- * error:
88- * type: string
89- * description: Error message indicating that the requested date is in the future.
90- */
37+ * @private
38+ * @swagger
39+ * /version/{serviceId}/{termsType}/{date}:
40+ * get:
41+ * summary: Get a specific version of some terms at a given date.
42+ * tags: [Versions]
43+ * produces:
44+ * - application/json
45+ * parameters:
46+ * - in: path
47+ * name: serviceId
48+ * description: The ID of the service whose version will be returned.
49+ * schema:
50+ * type: string
51+ * required: true
52+ * - in: path
53+ * name: termsType
54+ * description: The type of terms whose version will be returned.
55+ * schema:
56+ * type: string
57+ * required: true
58+ * - in: path
59+ * name: date
60+ * description: The date and time for which the version is requested, in ISO 8601 format.
61+ * schema:
62+ * type: string
63+ * format: date-time
64+ * required: true
65+ * responses:
66+ * 200:
67+ * description: A JSON object containing the version content and metadata.
68+ * content:
69+ * application/json:
70+ * schema:
71+ * $ref: '#/components/schemas/Version'
72+ * 404:
73+ * description: No version found for the specified combination of service ID, terms type and date.
74+ * content:
75+ * application/json:
76+ * schema:
77+ * type: object
78+ * properties:
79+ * error:
80+ * type: string
81+ * description: Error message indicating that no version is found.
82+ * 416:
83+ * description: The requested date is in the future.
84+ * content:
85+ * application/json:
86+ * schema:
87+ * type: object
88+ * properties:
89+ * error:
90+ * type: string
91+ * description: Error message indicating that the requested date is in the future.
92+ */
9193 router . get ( '/version/:serviceId/:termsType/:date' , async ( req , res ) => {
9294 const { termsType, date } = req . params ;
9395 const requestedDate = new Date ( date ) ;
0 commit comments