diff --git a/CHANGELOG.md b/CHANGELOG.md index cc3cc36e0c6cc8d9c84d6328c02459b2d2c15e01..ae30d505619a762bbeaf8e528bffaaf372d919d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,37 +18,43 @@ --> -## 3.5.1 (???) +## 3.5.2 (2024-02-26) + +### π Bugfix +- Add missing code to move correction from private to internal repository + + +## 3.5.1 (2024-02-22) ### π Bugfix - Corrections: Take the exercise last commit instead of the assignment last commit -## 3.5.0 (???) +## 3.5.0 (2024-02-21) ### β¨ Feature - Link a commit of an exercise as a corrige of an assignment -## 3.4.2 (2023-01-23) +## 3.4.2 (2024-01-23) ### π Documentation - Wiki: add tutorial about adding a new route to the API -## 3.4.1 (2023-01-25) +## 3.4.1 (2024-01-25) ### π Bugfix - Fix assignment gitlab CI/CD pipeline: fix the name of the dind service -## 3.4.0 (2023-01-23) +## 3.4.0 (2024-01-23) ### β¨ Feature - Limit of 2 exercises by user -## 3.3.0 (2023-01-18) +## 3.3.0 (2024-01-18) ### β¨ Feature - **CLI**: Show an information message when a new version of the CLI is available (and not required) diff --git a/ExpressAPI/package-lock.json b/ExpressAPI/package-lock.json index 07d4f0dc839bd5bcef99e93a15a46714637ddab9..55efbdbf8f3f291d860a14570f6e545156ee685c 100644 --- a/ExpressAPI/package-lock.json +++ b/ExpressAPI/package-lock.json @@ -1,12 +1,12 @@ { "name": "dojo_backend_api", - "version": "3.5.1", + "version": "3.5.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "dojo_backend_api", - "version": "3.5.1", + "version": "3.5.2", "license": "AGPLv3", "dependencies": { "@gitbeaker/rest": "^39.34.2", diff --git a/ExpressAPI/package.json b/ExpressAPI/package.json index 90dcd432ccce579e5bbde0404e7e519e2c94f444..e18d783375e5edee6271f6ff45ab2dc27038ea02 100644 --- a/ExpressAPI/package.json +++ b/ExpressAPI/package.json @@ -1,7 +1,7 @@ { "name" : "dojo_backend_api", "description" : "Backend API of the Dojo project", - "version" : "3.5.1", + "version" : "3.5.2", "license" : "AGPLv3", "author" : "MichaΓ«l Minelli <dojo@minelli.me>", "main" : "dist/src/app.js", diff --git a/ExpressAPI/src/routes/AssignmentRoutes.ts b/ExpressAPI/src/routes/AssignmentRoutes.ts index 052a8bd9399d139bfe6805239a7c463150c9668d..dd89e3a6e96ec4fde69f3f15e3dea8dd1a63f715 100644 --- a/ExpressAPI/src/routes/AssignmentRoutes.ts +++ b/ExpressAPI/src/routes/AssignmentRoutes.ts @@ -61,8 +61,8 @@ class AssignmentRoutes implements RoutesManager { backend.patch('/assignments/:assignmentNameOrUrl/publish', SecurityMiddleware.check(true, SecurityCheckType.ASSIGNMENT_STAFF), this.changeAssignmentPublishedStatus(true).bind(this)); backend.patch('/assignments/:assignmentNameOrUrl/unpublish', SecurityMiddleware.check(true, SecurityCheckType.ASSIGNMENT_STAFF), this.changeAssignmentPublishedStatus(false).bind(this)); - backend.post('/assignments/:assignmentNameOrUrl/corrections', SecurityMiddleware.check(true, SecurityCheckType.ASSIGNMENT_STAFF), ParamsValidatorMiddleware.validate(this.assignmentAddCorrigeValidator), this.addUpdateAssignmentCorrection(false).bind(this)); - backend.patch('/assignments/:assignmentNameOrUrl/corrections/:exerciseIdOrUrl', SecurityMiddleware.check(true, SecurityCheckType.ASSIGNMENT_STAFF), this.addUpdateAssignmentCorrection(true).bind(this)); + backend.post('/assignments/:assignmentNameOrUrl/corrections', SecurityMiddleware.check(true, SecurityCheckType.ASSIGNMENT_STAFF), ParamsValidatorMiddleware.validate(this.assignmentAddCorrigeValidator), this.linkUpdateAssignmentCorrection(false).bind(this)); + backend.patch('/assignments/:assignmentNameOrUrl/corrections/:exerciseIdOrUrl', SecurityMiddleware.check(true, SecurityCheckType.ASSIGNMENT_STAFF), this.linkUpdateAssignmentCorrection(true).bind(this)); } // Get an assignment by its name or gitlab url @@ -203,7 +203,7 @@ class AssignmentRoutes implements RoutesManager { }; } - private addUpdateAssignmentCorrection(isUpdate: boolean): (req: express.Request, res: express.Response) => Promise<void> { + private linkUpdateAssignmentCorrection(isUpdate: boolean): (req: express.Request, res: express.Response) => Promise<void> { return async (req: express.Request, res: express.Response): Promise<void> => { if ( req.boundParams.exercise?.assignmentName != req.boundParams.assignment?.name ) { return req.session.sendResponse(res, StatusCodes.BAD_REQUEST, undefined, 'The exercise does not belong to the assignment', DojoStatusCode.ASSIGNMENT_EXERCISE_NOT_RELATED); @@ -221,6 +221,10 @@ class AssignmentRoutes implements RoutesManager { const lastCommit = await GitlabManager.getRepositoryLastCommit(req.boundParams.exercise!.gitlabId); if ( lastCommit ) { + if ( !isUpdate ) { + await GitlabManager.changeRepositoryVisibility(req.boundParams.assignment.gitlabId, GitlabVisibility.INTERNAL); + } + await db.exercise.update({ where: { id: req.boundParams.exercise!.id