diff --git a/src/data-seeding/certificates/handler.ts b/src/data-seeding/certificates/handler.ts index 57ee2ed35..5c24517fa 100644 --- a/src/data-seeding/certificates/handler.ts +++ b/src/data-seeding/certificates/handler.ts @@ -13,36 +13,8 @@ import { Request, ResponseToolkit } from '@hapi/hapi' import { readFileSync } from 'fs' export async function certificateHandler(request: Request, h: ResponseToolkit) { - if (request.params.event) { - const res = readFileSync( - `./src/data-seeding/certificates/source/Farajaland-${request.params.event}-certificate-v2.svg` - ).toString() - return h.response(res).code(200) - } - - const Certificates = [ - { - event: 'birth', - fileName: 'Farajaland-birth-certificate-v2.svg', - svgCode: readFileSync( - './src/data-seeding/certificates/source/Farajaland-birth-certificate-v2.svg' - ).toString() - }, - { - event: 'death', - fileName: 'Farajaland-death-certificate-v2.svg', - svgCode: readFileSync( - './src/data-seeding/certificates/source/Farajaland-death-certificate-v2.svg' - ).toString() - }, - { - event: 'marriage', - fileName: 'Farajaland-marriage-certificate-v2.svg', - svgCode: readFileSync( - './src/data-seeding/certificates/source/Farajaland-marriage-certificate-v2.svg' - ).toString() - } - ] - const res = JSON.stringify(Certificates) - return h.response(res) + const res = readFileSync( + `./src/data-seeding/certificates/source/Farajaland-${request.params.event}-certificate-v2.svg` + ).toString() + return h.response(res).code(200) } diff --git a/src/index.ts b/src/index.ts index 7606e2f34..5656912d4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -238,18 +238,15 @@ export async function createServer() { server.auth.default('jwt') - if (process.env.NODE_ENV !== 'production') { - server.route({ - method: 'GET', - path: '/certificates/{event}.svg', - handler: certificateHandler, - options: { - auth: false, - tags: ['api', 'certificates'], - description: 'Returns only one certificate metadata' - } - }) - } + server.route({ + method: 'GET', + path: '/certificates/{event}.svg', + handler: certificateHandler, + options: { + tags: ['api', 'certificates'], + description: 'Returns only one certificate metadata' + } + }) // add ping route by default for health check server.route({ method: 'GET', @@ -501,16 +498,6 @@ export async function createServer() { } }) - server.route({ - method: 'GET', - path: '/certificates', - handler: certificateHandler, - options: { - tags: ['api', 'certificates'], - description: 'Returns certificate metadata' - } - }) - server.route({ method: 'GET', path: '/roles',