From 4aad51308264fffc7215b064b450644d13cd9464 Mon Sep 17 00:00:00 2001 From: wvl94 Date: Tue, 5 Nov 2024 16:44:40 +0100 Subject: [PATCH 1/3] Demo: add log of user data and public API route. --- src/routes/exampleRouter.js | 2 ++ src/services/exampleService.js | 6 ++++++ src/services/newService.js | 18 ++++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 src/services/newService.js diff --git a/src/routes/exampleRouter.js b/src/routes/exampleRouter.js index 3243254..c3fa7a8 100644 --- a/src/routes/exampleRouter.js +++ b/src/routes/exampleRouter.js @@ -9,4 +9,6 @@ const router = express.Router(); router.route("/:id") .get(grantAccessByPermissionMiddleware([API_PERMISSIONS.PUBLIC_ENDPOINT]), exampleController.getById) +router.route("/user-data/:id").get( exampleController.getById) + export default router; \ No newline at end of file diff --git a/src/services/exampleService.js b/src/services/exampleService.js index 165f813..fc43642 100644 --- a/src/services/exampleService.js +++ b/src/services/exampleService.js @@ -1,4 +1,5 @@ import exampleRepo from "../repos/exampleRepo.js" +import logger from "./utils/logger.js"; export class ExampleService { @@ -6,6 +7,11 @@ export class ExampleService { return await exampleRepo.getById(id) } + async getUserData(id) { + const user = await exampleRepo.getById(id); + logger.info(user.data); + } + } diff --git a/src/services/newService.js b/src/services/newService.js new file mode 100644 index 0000000..0ed8581 --- /dev/null +++ b/src/services/newService.js @@ -0,0 +1,18 @@ +import exampleRepo from "../repos/exampleRepo.js" +import logger from "./utils/logger.js"; + +export class NewService { + + async getById(id) { + logger.info("Getting data by ID.") + return await exampleRepo.getById(id); + } + + async getDataFromRepo(id) { + return await exampleRepo.getData(id); + } + + +} + +export default new NewService(); \ No newline at end of file From 366d66ee6d85694deff54154507224530b4b580a Mon Sep 17 00:00:00 2001 From: wvl94 Date: Tue, 5 Nov 2024 16:47:30 +0100 Subject: [PATCH 2/3] fix bugs --- .github/workflows/firstmate.yaml | 11 ----------- src/services/exampleService.js | 2 +- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/.github/workflows/firstmate.yaml b/.github/workflows/firstmate.yaml index 7864e97..d253e36 100644 --- a/.github/workflows/firstmate.yaml +++ b/.github/workflows/firstmate.yaml @@ -26,17 +26,6 @@ jobs: run: pnpm lint - name: Install packages run: pnpm test - docker: - runs-on: ubuntu-latest - name: Validate docker - steps: - - uses: actions/checkout@v3 - - name: Setup Docker buildx - uses: docker/setup-buildx-action@v1.6.0 - with: - driver: docker - - name: docker build - run: docker build . -t "test-docker" helm: runs-on: ubuntu-latest name: Validate helm diff --git a/src/services/exampleService.js b/src/services/exampleService.js index fc43642..9b79419 100644 --- a/src/services/exampleService.js +++ b/src/services/exampleService.js @@ -1,5 +1,5 @@ import exampleRepo from "../repos/exampleRepo.js" -import logger from "./utils/logger.js"; +import logger from "../utils/logger.js"; export class ExampleService { From a55a10fbe5afe01060175a7fef76df850c06afb6 Mon Sep 17 00:00:00 2001 From: wvl94 Date: Tue, 5 Nov 2024 17:12:39 +0100 Subject: [PATCH 3/3] add spelling mistake --- src/services/exampleService.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/services/exampleService.js b/src/services/exampleService.js index 9b79419..8a136db 100644 --- a/src/services/exampleService.js +++ b/src/services/exampleService.js @@ -7,6 +7,10 @@ export class ExampleService { return await exampleRepo.getById(id) } + async getExcetutedDocuments(id) { + return await exampleRepo.getById(id) + } + async getUserData(id) { const user = await exampleRepo.getById(id); logger.info(user.data);