From f6f6cd8b67f63e2b45d9c20194f52ebd18003612 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Minelli?= <michael@minelli.me> Date: Wed, 21 Feb 2024 00:44:44 +0100 Subject: [PATCH] ExerciseManager => Update the get function to accept git url in addition of id --- ExpressAPI/src/managers/ExerciseManager.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ExpressAPI/src/managers/ExerciseManager.ts b/ExpressAPI/src/managers/ExerciseManager.ts index 66cfda8..720827d 100644 --- a/ExpressAPI/src/managers/ExerciseManager.ts +++ b/ExpressAPI/src/managers/ExerciseManager.ts @@ -4,7 +4,9 @@ import db from '../helpers/DatabaseHelper'; class ExerciseManager { - async get(id: string, include: Prisma.ExerciseInclude | undefined = undefined): Promise<Exercise | undefined> { + async get(idOrUrl: string, include: Prisma.ExerciseInclude | undefined = undefined): Promise<Exercise | undefined> { + const id = idOrUrl.replace('.git', '').split('_').pop()!; + return await db.exercise.findUnique({ where : { id: id -- GitLab