From 3226ebf3d4806b70bd14864e7a6ba1e48a217a12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Alonso=20L=C3=B3pez?= Date: Tue, 10 Dec 2024 13:14:09 +0100 Subject: [PATCH] Rework of file naming and enpoint --- app.js | 4 ++-- .../{pregnancy-controller.js => codes-controller.js} | 2 +- controllers/db/{pregnancy.csv => codes.csv} | 0 kubernetes/base/001_terminology-deployment.yaml | 2 +- kubernetes/dev/001_terminology-deployment.yaml | 2 +- routes/codes.js | 8 ++++++++ routes/pregnancy.js | 8 -------- 7 files changed, 13 insertions(+), 13 deletions(-) rename controllers/{pregnancy-controller.js => codes-controller.js} (95%) rename controllers/db/{pregnancy.csv => codes.csv} (100%) create mode 100644 routes/codes.js delete mode 100644 routes/pregnancy.js diff --git a/app.js b/app.js index d4fe1aa..75e5597 100644 --- a/app.js +++ b/app.js @@ -1,6 +1,6 @@ const express = require('express'); -const pregnancyRoutes = require('./routes/pregnancy'); +const codesRoutes = require('./routes/codes'); @@ -15,7 +15,7 @@ app.use(express.urlencoded({ -app.use('/snomed/pregnancy',pregnancyRoutes); +app.use('/codes',codesRoutes); app.get('/', (req, res) => { diff --git a/controllers/pregnancy-controller.js b/controllers/codes-controller.js similarity index 95% rename from controllers/pregnancy-controller.js rename to controllers/codes-controller.js index a7381d6..dde3701 100644 --- a/controllers/pregnancy-controller.js +++ b/controllers/codes-controller.js @@ -3,7 +3,7 @@ const csv = require('csvtojson'); async function getAll(req,res) { let pregnancyList; - let csvPregFile = await fetch("https://raw.githubusercontent.com/Gravitate-Health/terminology-service/main/controllers/db/pregnancy.csv") + let csvPregFile = await fetch("https://raw.githubusercontent.com/Gravitate-Health/terminology-service/main/controllers/db/codes.csv") .then(response => response.text()) .then(text => text); diff --git a/controllers/db/pregnancy.csv b/controllers/db/codes.csv similarity index 100% rename from controllers/db/pregnancy.csv rename to controllers/db/codes.csv diff --git a/kubernetes/base/001_terminology-deployment.yaml b/kubernetes/base/001_terminology-deployment.yaml index e9ea386..e4be50a 100644 --- a/kubernetes/base/001_terminology-deployment.yaml +++ b/kubernetes/base/001_terminology-deployment.yaml @@ -14,7 +14,7 @@ spec: spec: containers: - name: terminology-service - image: gravitate-registry.cr.de-fra.ionos.com/terminology-service:v0.4.0 + image: gravitate-registry.cr.de-fra.ionos.com/terminology-service:v0.5.0 imagePullPolicy: Always ports: - containerPort: 3000 diff --git a/kubernetes/dev/001_terminology-deployment.yaml b/kubernetes/dev/001_terminology-deployment.yaml index 9f72ee5..99e87d2 100644 --- a/kubernetes/dev/001_terminology-deployment.yaml +++ b/kubernetes/dev/001_terminology-deployment.yaml @@ -1,7 +1,7 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: terminology-svc + name: terminology-service spec: replicas: 1 selector: diff --git a/routes/codes.js b/routes/codes.js new file mode 100644 index 0000000..452f2de --- /dev/null +++ b/routes/codes.js @@ -0,0 +1,8 @@ +const { Router } = require('express'); +const codesController = require('../controllers/codes-controller'); + +const router = Router(); + +router.get('/all',codesController.getAll ); //get every problem- + +module.exports = router; \ No newline at end of file diff --git a/routes/pregnancy.js b/routes/pregnancy.js deleted file mode 100644 index 56040ef..0000000 --- a/routes/pregnancy.js +++ /dev/null @@ -1,8 +0,0 @@ -const { Router } = require('express'); -const pregnancyController = require('../controllers/pregnancy-controller'); - -const router = Router(); - -router.get('/all',pregnancyController.getAll ); //get every problem- - -module.exports = router; \ No newline at end of file