diff --git a/.gitea/workflows/backend.yaml b/.gitea/workflows/backend.yaml index a330b5c..fa91896 100644 --- a/.gitea/workflows/backend.yaml +++ b/.gitea/workflows/backend.yaml @@ -18,15 +18,3 @@ jobs: - uses: gradle/gradle-build-action@v3 - name: building run: ./gradlew backend:build -x test - # Test-backend: - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v4 - # - uses: actions/setup-java@v3 - # with: - # java-version: '21' - # distribution: 'temurin' - # - run: curl -fsSL https://get.docker.com | sh - # - uses: gradle/gradle-build-action@v3 - # - name: testing - # run: ./gradlew backend:test diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index 31425c2..996112c 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -39,13 +39,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-java@v3 - with: - java-version: '21' - distribution: 'temurin' - - uses: gradle/gradle-build-action@v3 - - name: building - run: ./gradlew backend:build -x test - name: pushing to the server run: | echo "${{ secrets.SSH_KEY }}" > key @@ -53,5 +46,5 @@ jobs: scp -o "StrictHostKeyChecking=no" -o "LogLevel=ERROR" -i key -r * ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:api/ - name: restarting the backend run: | - ssh -o "StrictHostKeyChecking=no" -o "LogLevel=ERROR" -i key ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} 'cd api/backend && docker build -t clyde/backend . && docker rm clyde_backend_prod -f || true && docker run --rm -d -u $(id -u clyde):$(id -g clyde) -v /var/run/postgresql:/var/run/postgresql --name clyde_backend_prod -p 4000:8080 clyde/backend && docker image prune -f' + ssh -o "StrictHostKeyChecking=no" -o "LogLevel=ERROR" -i key ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} 'cd api/ && docker-compose up --force-recreate --build -d' - run: echo "The backend has been deployed. running at https://clyde.herisson.ovh/api" diff --git a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/CourseController.java b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/CourseController.java index 9ee05de..5d73444 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/CourseController.java +++ b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/CourseController.java @@ -3,15 +3,17 @@ package ovh.herisson.Clyde.EndPoints; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; +import ovh.herisson.Clyde.Repositories.CurriculumCourseRepository; import ovh.herisson.Clyde.Responses.UnauthorizedResponse; -import ovh.herisson.Clyde.Services.AuthenticatorService; -import ovh.herisson.Clyde.Services.CourseService; -import ovh.herisson.Clyde.Services.ProtectionService; -import ovh.herisson.Clyde.Services.TeacherCourseService; +import ovh.herisson.Clyde.Services.*; import ovh.herisson.Clyde.Tables.Course; import ovh.herisson.Clyde.Tables.Role; import ovh.herisson.Clyde.Tables.User; +import ovh.herisson.Clyde.Tables.UserCurriculum; + +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; @RestController @@ -24,10 +26,20 @@ public class CourseController { private final AuthenticatorService authServ; - public CourseController(CourseService courseServ, TeacherCourseService teacherCourseServ, AuthenticatorService authServ) { + private final UserService userService; + + private final UserCurriculumService userCurriculumService; + + private final CurriculumCourseRepository curriculumCourseRepository; + private final CurriculumCourseService curriculumCourseService; + public CourseController(CourseService courseServ, TeacherCourseService teacherCourseServ, AuthenticatorService authServ, UserService userService, UserCurriculumService userCurriculumService, CurriculumCourseRepository curriculumCourseRepository, CurriculumCourseService curriculumCourseService) { this.courseServ = courseServ; this.teacherCourseServ = teacherCourseServ; this.authServ = authServ; + this.userService = userService; + this.userCurriculumService = userCurriculumService; + this.curriculumCourseRepository = curriculumCourseRepository; + this.curriculumCourseService = curriculumCourseService; } @GetMapping("/course/{id}") @@ -134,4 +146,28 @@ public class CourseController { return new ResponseEntity<>(HttpStatus.OK); } + + //Get all the courses followed by an user + @GetMapping("/usercourses") + public ResponseEntity> getAllUserCourses(@RequestHeader("Authorization") String token){ + User u = authServ.getUserFromToken(token); + + //We get all the actual curriculums of the user + List userCurricula = userCurriculumService.findByStudentAndActual(u, true); + List toReturn = new ArrayList<>(); + + //We iterate through all the curriculums and we extract the courses + for (int i = 0; i < userCurricula.size(); i++){ + curriculumCourseRepository.findCoursesByCurriculum(userCurricula.get(i).getCurriculum()).forEach((item) -> { + //We need this to eliminate clones because a course can belong to several curriculums + if(!toReturn.contains(item)){ + toReturn.add(item); + } + }); + } + + return new ResponseEntity<>(toReturn, HttpStatus.OK); + } + + } diff --git a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/Inscription/InscriptionController.java b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/Inscription/InscriptionController.java index 60f4585..eb283e8 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/Inscription/InscriptionController.java +++ b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/Inscription/InscriptionController.java @@ -29,7 +29,7 @@ public class InscriptionController { @GetMapping("/requests/register") public ResponseEntity>> getAllRequests(@RequestHeader("Authorization") String token){ - if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService},token)) + if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService, Role.Teacher},token)) return new UnauthorizedResponse<>(null); Iterable inscriptionRequests = inscriptionServ.getAll(); @@ -41,7 +41,7 @@ public class InscriptionController { @GetMapping("/request/register/{id}") public ResponseEntity> getById(@RequestHeader("Authorization") String token, @PathVariable long id){ - if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService},token)) + if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService, Role.Teacher},token)) return new UnauthorizedResponse<>(null); InscriptionRequest foundInscriptionRequest = inscriptionServ.getById(id); @@ -87,6 +87,12 @@ public class InscriptionController { return new UnauthorizedResponse<>(null); InscriptionRequest toEdit = inscriptionServ.getById(id); + + //If the request is already accepted we just return ok (otherwise we would duplicate the procedure below) + if (toEdit.getEquivalenceState() == RequestState.Accepted){ + return new ResponseEntity<>(HttpStatus.OK); + } + toEdit.setEquivalenceState(newstate); inscriptionServ.save(toEdit); diff --git a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/Inscription/RequestsController.java b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/Inscription/RequestsController.java index 74d1bf0..b21a6ca 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/Inscription/RequestsController.java +++ b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/Inscription/RequestsController.java @@ -13,6 +13,7 @@ import ovh.herisson.Clyde.Repositories.UserCurriculumRepository; import ovh.herisson.Clyde.Repositories.UserRepository; import ovh.herisson.Clyde.Responses.UnauthorizedResponse; import ovh.herisson.Clyde.Services.AuthenticatorService; +import ovh.herisson.Clyde.Services.TokenService; import ovh.herisson.Clyde.Services.UserService; import ovh.herisson.Clyde.Tables.*; import ovh.herisson.Clyde.Tables.Inscription.ExemptionsRequest; @@ -28,6 +29,7 @@ import java.util.Map; @CrossOrigin(originPatterns = "*", allowCredentials = "true") public class RequestsController { + public final TokenService tokenService; public final ExemptionsRequestRepository err; public final ScholarshipRequestRepository srr; public final UserRepository userRepository; @@ -40,7 +42,8 @@ public class RequestsController { public final ChangeCurriculumRequestRepository changeCurriculumRequestRepository; - public RequestsController(ExemptionsRequestRepository err, ScholarshipRequestRepository srr, UserRepository userRepository, AuthenticatorService authServ, UnregisterRequestRepository unregisterRequestRepository, CourseRepository courseRepository, UserService userService, UserCurriculumRepository userCurriculumRepository, CurriculumRepository curriculumRepository, ChangeCurriculumRequestRepository changeCurriculumRequestRepository) { + public RequestsController(TokenService tokenService, ExemptionsRequestRepository err, ScholarshipRequestRepository srr, UserRepository userRepository, AuthenticatorService authServ, UnregisterRequestRepository unregisterRequestRepository, CourseRepository courseRepository, UserService userService, UserCurriculumRepository userCurriculumRepository, CurriculumRepository curriculumRepository, ChangeCurriculumRequestRepository changeCurriculumRequestRepository) { + this.tokenService = tokenService; this.err = err; this.srr = srr; this.userRepository = userRepository; @@ -78,7 +81,7 @@ public class RequestsController { //Get all the exemptions Request @GetMapping(value = "/exemptionsreq") public ResponseEntity> getAllExemptionsRequests(@RequestHeader("Authorization") String token){ - if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary,Role.InscriptionService},token)) + if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService, Role.Teacher},token)) return new UnauthorizedResponse<>(null); ArrayList toReturn = new ArrayList<>(); @@ -90,7 +93,7 @@ public class RequestsController { @GetMapping(value = "/exemptionsreq/{id}") public ResponseEntity getExemptionRequestbyId(@RequestHeader("Authorization") String token, @PathVariable long id){ - if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary,Role.InscriptionService},token)) + if (authServ.isNotIn(new Role[]{Role.Admin,Role.Teacher,Role.InscriptionService},token)) return new UnauthorizedResponse<>(null); ExemptionsRequest exemptionsRequest = err.findById(id); @@ -100,10 +103,15 @@ public class RequestsController { @PatchMapping(value = "/exemptionsreq/{id}/{newstate}") public ResponseEntity changeExemptionReqState(@RequestHeader("Authorization") String token, @PathVariable long id, @PathVariable RequestState newstate){ - if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary,Role.InscriptionService},token)) + if (authServ.isNotIn(new Role[]{Role.Admin,Role.Teacher},token)) return new UnauthorizedResponse<>(null); ExemptionsRequest exemptionsRequest = err.findById(id); + + if (exemptionsRequest.getState() == RequestState.Accepted){ + return new ResponseEntity<>(HttpStatus.OK); + } + exemptionsRequest.setState(newstate); err.save(exemptionsRequest); @@ -140,9 +148,17 @@ public class RequestsController { } @PatchMapping(value = "/scholarshipreq/") - public ResponseEntity editScholReq(@RequestBody Map infos){ + public ResponseEntity editScholReq(@RequestHeader("Authorization") String token, @RequestBody Map infos){ + if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService},token)) + return new UnauthorizedResponse<>(null); + ScholarshipRequest scholarshipRequest = srr.findById((Integer) infos.get("id")); + //If the request is already accepted we just return ok (otherwise we would duplicate the procedure below) + if (scholarshipRequest.getState() == RequestState.Accepted){ + return new ResponseEntity<>(HttpStatus.OK); + } + if (infos.get("state").equals("Accepted")){ scholarshipRequest.setState(RequestState.Accepted); scholarshipRequest.setAmount((int) infos.get("amount")); @@ -155,30 +171,48 @@ public class RequestsController { } @GetMapping(value = "/scholarshipreq/{id}") - public ResponseEntity getScholReqbyId(@PathVariable long id){ + public ResponseEntity getScholReqbyId(@RequestHeader("Authorization") String token, @PathVariable long id){ + if (authServ.isNotIn(new Role[]{Role.Admin, Role.InscriptionService},token)) + return new UnauthorizedResponse<>(null); + ScholarshipRequest toReturn = srr.findById(id); return new ResponseEntity<>(toReturn, HttpStatus.OK); } @GetMapping(value = "/unregister") - public ResponseEntity> getAllUnregReq(){ + public ResponseEntity> getAllUnregReq(@RequestHeader("Authorization") String token){ + if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService},token)) + return new UnauthorizedResponse<>(null); + ArrayList toReturn = new ArrayList<>(); unregisterRequestRepository.findAll().forEach(toReturn::add); return new ResponseEntity<>(toReturn, HttpStatus.OK); } @GetMapping(value = "/unregister/{id}") - public ResponseEntity getUnregbyId(@PathVariable long id){ + public ResponseEntity getUnregbyId(@RequestHeader("Authorization") String token, @PathVariable long id){ + if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService},token)) + return new UnauthorizedResponse<>(null); + UnregisterRequest unregisterRequest = unregisterRequestRepository.findById(id); return new ResponseEntity<>(unregisterRequest, HttpStatus.OK); } @PatchMapping(value = "/unregister/{id}/{newstate}") - public ResponseEntity pathUnregReq(@PathVariable long id, @PathVariable RequestState newstate){ + public ResponseEntity pathUnregReq(@RequestHeader("Authorization") String token, @PathVariable long id, @PathVariable RequestState newstate){ + if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService},token)) + return new UnauthorizedResponse<>(null); + UnregisterRequest unregisterRequest = unregisterRequestRepository.findById(id); User u = userRepository.findById(unregisterRequest.getRegNo()); - unregisterRequest.setState(newstate); + //If the request is already accepted we just return ok (otherwise we would duplicate the procedure below) + if (unregisterRequest.getState() == RequestState.Accepted){ + return new ResponseEntity<>(HttpStatus.OK); + } + + unregisterRequest.setState(newstate); + unregisterRequestRepository.save(unregisterRequest); if (newstate == RequestState.Accepted){ if (unregisterRequest.getCurriculum() == null){ ArrayList userCurricula = userCurriculumRepository.findByUserOrderByCurriculum(u); @@ -193,8 +227,6 @@ public class RequestsController { userCurriculumRepository.save(userCurriculum); } } - - unregisterRequestRepository.save(unregisterRequest); return new ResponseEntity<>(HttpStatus.OK); } @@ -236,7 +268,7 @@ public class RequestsController { @GetMapping("/changecurriculumreq") public ResponseEntity> getAllChangeCurrReq(@RequestHeader("Authorization") String token){ - if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary,Role.InscriptionService},token)) + if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService, Role.Teacher},token)) return new UnauthorizedResponse<>(null); ArrayList toReturn = new ArrayList<>(); @@ -248,7 +280,7 @@ public class RequestsController { @GetMapping("/changecurriculumreq/{id}") public ResponseEntity getCCrbyId(@RequestHeader("Authorization") String token, @PathVariable long id){ - if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary,Role.InscriptionService},token)) + if (authServ.isNotIn(new Role[]{Role.Admin,Role.Teacher,Role.InscriptionService},token)) return new UnauthorizedResponse<>(null); ChangeCurriculumRequest toReturn = changeCurriculumRequestRepository.findById(id); @@ -257,37 +289,45 @@ public class RequestsController { @PatchMapping("/changecurriculumreq/{id}/{newState}") public ResponseEntity editCCReq(@RequestHeader("Authorization") String token, @PathVariable long id, @PathVariable RequestState newState){ - if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary,Role.InscriptionService},token)) + if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService},token)) return new UnauthorizedResponse<>(null); ChangeCurriculumRequest toEdit = changeCurriculumRequestRepository.findById(id); - toEdit.setState(newState); + //If the request is already accepted we just return ok (otherwise we would duplicate the procedure below) + if (toEdit.getState() == RequestState.Accepted){ + return new ResponseEntity<>(HttpStatus.OK); + } + toEdit.setState(newState); + changeCurriculumRequestRepository.save(toEdit); if (newState == RequestState.Accepted && (toEdit.getTeacherApprovalState() == RequestState.Accepted || toEdit.getTeacherApprovalState() == RequestState.Unrequired)){ //If actual curriculum is not null then we need to set that the user doesn't follow it anymore acceptProcedure(toEdit); } - changeCurriculumRequestRepository.save(toEdit); return new ResponseEntity<>(HttpStatus.OK); } @PatchMapping("/changecurriculumreqteacher/{id}/{newteacherstate}") public ResponseEntity editCCReqTeacherState(@RequestHeader("Authorization") String token, @PathVariable long id, @PathVariable RequestState newteacherstate){ - if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary,Role.InscriptionService},token)) + if (authServ.isNotIn(new Role[]{Role.Admin,Role.Teacher},token)) return new UnauthorizedResponse<>(null); ChangeCurriculumRequest toEdit = changeCurriculumRequestRepository.findById(id); + //If the request is already accepted we just return ok (otherwise we would duplicate the procedure below) + if (toEdit.getTeacherApprovalState() == RequestState.Accepted){ + return new ResponseEntity<>(HttpStatus.OK); + } + toEdit.setState(newteacherstate); + changeCurriculumRequestRepository.save(toEdit); if (newteacherstate == RequestState.Accepted && toEdit.getState() == RequestState.Accepted){ //If actual curriculum is not null then we need to set that the user doesn't follow it anymore acceptProcedure(toEdit); } - - changeCurriculumRequestRepository.save(toEdit); return new ResponseEntity<>(HttpStatus.OK); } @@ -309,4 +349,18 @@ public class RequestsController { UserCurriculum userCurriculum = new UserCurriculum(u, toEdit.getDestinationCurriculum(), c.get(Calendar.YEAR), true); userCurriculumRepository.save(userCurriculum); } + + @GetMapping("/exemptionreq/{userId}") + public ResponseEntity> getExReqByuser(@RequestHeader("Authorization") String token, @PathVariable long userId){ + User currentUser = tokenService.getUserFromToken(token); + + //Only admin, teacher, secretary and the student himself can access a student's data here + if (authServ.isNotIn(new Role[]{Role.Admin,Role.Teacher, Role.Secretary},token) && currentUser.getRegNo() != userId) + return new UnauthorizedResponse<>(null); + + User u = userRepository.findById(userId); + + ArrayList exList = err.findByUser(u); + return new ResponseEntity<>(exList, HttpStatus.OK); + } } diff --git a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/MockController.java b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/MockController.java index a9d5487..3b80212 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/MockController.java +++ b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/MockController.java @@ -119,7 +119,7 @@ public class MockController { ucr.save(new UserCurriculum(popo, infoBab2, 2023, true)); Course progra1 = new Course(5,"Programmation et algorithmique 1",joke); - Course chemistry1 = new Course(12, "Thermochimie",joke); + Course chemistry1 = new Course(12, "Thermochimie",jojo); Course psycho1 = new Course(21, "Neuroreaction of isolated brain cells",joke); Course commun = new Course(2, "cours commun",joke); @@ -136,7 +136,7 @@ public class MockController { CurriculumCourseService.save(new CurriculumCourse(infoBab1, psycho1)); CurriculumCourseService.save(new CurriculumCourse(psychologyBab1,psycho1)); CurriculumCourseService.save(new CurriculumCourse(psychologyBab1,commun)); - + CurriculumCourseService.save(new CurriculumCourse(chemistryBab1, chemistry1)); CurriculumCourseService.save(new CurriculumCourse(chemistryBab1,commun)); CurriculumCourseService.save(new CurriculumCourse(chemistryBab1,chemistry1)); diff --git a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/Msg/ForumController.java b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/Msg/ForumController.java new file mode 100644 index 0000000..a0c74f5 --- /dev/null +++ b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/Msg/ForumController.java @@ -0,0 +1,113 @@ +package ovh.herisson.Clyde.EndPoints.Msg; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.HttpStatusCode; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RestController; + +import jakarta.websocket.server.PathParam; +import lombok.AllArgsConstructor; +import ovh.herisson.Clyde.Repositories.CourseRepository; +import ovh.herisson.Clyde.Repositories.Msg.AnswerRepository; +import ovh.herisson.Clyde.Repositories.Msg.ForumRepository; +import ovh.herisson.Clyde.Repositories.Msg.TopicRepository; +import ovh.herisson.Clyde.Responses.UnauthorizedResponse; +import ovh.herisson.Clyde.Services.AuthenticatorService; +import ovh.herisson.Clyde.Services.CourseService; +import ovh.herisson.Clyde.Services.Msg.ForumService; +import ovh.herisson.Clyde.Tables.Course; +import ovh.herisson.Clyde.Tables.Role; +import ovh.herisson.Clyde.Tables.Token; +import ovh.herisson.Clyde.Tables.User; +import ovh.herisson.Clyde.Tables.Msg.Answer; +import ovh.herisson.Clyde.Tables.Msg.Forum; +import ovh.herisson.Clyde.Tables.Msg.Topic; + +@RestController +@CrossOrigin(originPatterns = "*", allowCredentials = "true") +@AllArgsConstructor +public class ForumController { + + private CourseRepository courseRepo; + private AuthenticatorService authServ; + private ForumService forumServ; + private ForumRepository forumRepo; + private TopicRepository topicRepo; + + //// Endpoints to get and create new forums + + @GetMapping("/forums/{id}") + public ResponseEntity> getForumFromCourseId(@RequestHeader("Authorization") String token, @PathVariable long id){ + User u = authServ.getUserFromToken(token); + if(u == null){ + return new UnauthorizedResponse<>(null); + } + return new ResponseEntity<>(courseRepo.findById(id).getForums(), HttpStatus.OK); + } + + @PostMapping("/forums/{id}") + public ResponseEntity createForumOfCourse(@RequestHeader("Authorization") String token, @PathVariable long id, @RequestBody Forum data){ + User u = authServ.getUserFromToken(token); + Course c = courseRepo.findById(id); + if(!(c.getOwner().equals(u) || u.getRole() == Role.Admin)){ + return new UnauthorizedResponse<>(null); + } + forumServ.createForum(c, data); + return new ResponseEntity<>(HttpStatus.ACCEPTED); + } + + //// Endpoints to get and create forum's topic + + @GetMapping("/forum/{id}") + public ResponseEntity> getTopicsFromForumId(@RequestHeader("Authorization") String token, @PathVariable long id){ + User u = authServ.getUserFromToken(token); + if(u == null){ + return new UnauthorizedResponse<>(null); + } + return new ResponseEntity<>(forumRepo.findById(id).orElse(null).getTopics(), HttpStatus.OK); + } + + @PostMapping("/forum/{id}") + public ResponseEntity postTopicToForum(@RequestHeader("Authorization") String token, @PathVariable long id, @RequestBody Topic data){ + User u = authServ.getUserFromToken(token); + Forum f = forumRepo.findById(id).orElse(null); + if(!(f.getWriters().contains(u) || u.getRole() == Role.Admin)){ + return new UnauthorizedResponse<>(null); + } + forumServ.createTopic(f, data); + return new ResponseEntity<>(HttpStatus.ACCEPTED); + } + + //// Endpoints related to topics and messages + + @GetMapping("/forum/post/{id}") + public ResponseEntity getPost(@RequestHeader("Authorization") String token, @PathVariable long id){ + User u = authServ.getUserFromToken(token); + if(u == null){ + return new UnauthorizedResponse<>(null); + } + Topic t = topicRepo.findById(id).orElse(null); + return new ResponseEntity<>(t, HttpStatus.OK); + } + + @PostMapping("/forum/post/{id}") + public ResponseEntity postTopicToForum(@RequestHeader("Authorization") String token, @PathVariable long id, @RequestBody Answer data){ + User u = authServ.getUserFromToken(token); + Topic t = topicRepo.findById(id).orElse(null); + if(t.isLocked() && u.getRole() != Role.Admin){ + return new UnauthorizedResponse<>(null); + } + System.out.println(data); + forumServ.answerTopic(t, data, u); + return new ResponseEntity<>(HttpStatus.ACCEPTED); + } +} diff --git a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/ScheduleController.java b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/ScheduleController.java index 2fe62d5..113b513 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/ScheduleController.java +++ b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/ScheduleController.java @@ -30,16 +30,13 @@ public class ScheduleController { private final ScheduleService scheduleServ; private final LessonService lessonServ; - private final UserCurriculumService userCurriculumService; - private final CurriculumService curriculumServ; private final AuthenticatorService authServ; private final ScheduleLessonService scheduleLessonServ; - public ScheduleController(ScheduleService scheduleServ, UserCurriculumService userCurriculumService, AuthenticatorService authServ, ScheduleLessonService scheduleLessonServ, CurriculumService curriculumServ,LessonService lessonServ) { + public ScheduleController(ScheduleService scheduleServ, AuthenticatorService authServ, ScheduleLessonService scheduleLessonServ, CurriculumService curriculumServ,LessonService lessonServ) { this.scheduleServ = scheduleServ; - this.userCurriculumService = userCurriculumService; this.authServ = authServ; this.scheduleLessonServ = scheduleLessonServ; this.curriculumServ = curriculumServ; diff --git a/backend/src/main/java/ovh/herisson/Clyde/Repositories/Inscription/ExemptionsRequestRepository.java b/backend/src/main/java/ovh/herisson/Clyde/Repositories/Inscription/ExemptionsRequestRepository.java index d644ef1..7682d11 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Repositories/Inscription/ExemptionsRequestRepository.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Repositories/Inscription/ExemptionsRequestRepository.java @@ -2,7 +2,12 @@ package ovh.herisson.Clyde.Repositories.Inscription; import org.springframework.data.repository.CrudRepository; import ovh.herisson.Clyde.Tables.Inscription.ExemptionsRequest; +import ovh.herisson.Clyde.Tables.User; + +import java.util.ArrayList; public interface ExemptionsRequestRepository extends CrudRepository { ExemptionsRequest findById(long id); + + ArrayList findByUser(User user); } diff --git a/backend/src/main/java/ovh/herisson/Clyde/Repositories/Msg/AnswerRepository.java b/backend/src/main/java/ovh/herisson/Clyde/Repositories/Msg/AnswerRepository.java new file mode 100644 index 0000000..0ca5e22 --- /dev/null +++ b/backend/src/main/java/ovh/herisson/Clyde/Repositories/Msg/AnswerRepository.java @@ -0,0 +1,10 @@ +package ovh.herisson.Clyde.Repositories.Msg; + +import org.springframework.data.repository.CrudRepository; + +import ovh.herisson.Clyde.Tables.Msg.Answer; + +public interface AnswerRepository extends CrudRepository { + +} + diff --git a/backend/src/main/java/ovh/herisson/Clyde/Repositories/Msg/ForumRepository.java b/backend/src/main/java/ovh/herisson/Clyde/Repositories/Msg/ForumRepository.java new file mode 100644 index 0000000..07afe54 --- /dev/null +++ b/backend/src/main/java/ovh/herisson/Clyde/Repositories/Msg/ForumRepository.java @@ -0,0 +1,9 @@ +package ovh.herisson.Clyde.Repositories.Msg; + +import org.springframework.data.repository.CrudRepository; + +import ovh.herisson.Clyde.Tables.Msg.Forum; + +public interface ForumRepository extends CrudRepository { + +} diff --git a/backend/src/main/java/ovh/herisson/Clyde/Repositories/Msg/TopicRepository.java b/backend/src/main/java/ovh/herisson/Clyde/Repositories/Msg/TopicRepository.java new file mode 100644 index 0000000..905cd01 --- /dev/null +++ b/backend/src/main/java/ovh/herisson/Clyde/Repositories/Msg/TopicRepository.java @@ -0,0 +1,10 @@ +package ovh.herisson.Clyde.Repositories.Msg; + +import org.springframework.data.repository.CrudRepository; + +import ovh.herisson.Clyde.Tables.Msg.Topic; + +public interface TopicRepository extends CrudRepository { + +} + diff --git a/backend/src/main/java/ovh/herisson/Clyde/Repositories/UserCurriculumRepository.java b/backend/src/main/java/ovh/herisson/Clyde/Repositories/UserCurriculumRepository.java index 75922fa..0e119f1 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Repositories/UserCurriculumRepository.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Repositories/UserCurriculumRepository.java @@ -16,4 +16,6 @@ public interface UserCurriculumRepository extends CrudRepository findByUserOrderByCurriculum(User student); UserCurriculum findByUserAndCurriculumAndActual(User user, Curriculum curriculum, boolean actual); + ArrayList findByUserAndActual(User user, boolean actual); + } diff --git a/backend/src/main/java/ovh/herisson/Clyde/Services/Inscription/InscriptionService.java b/backend/src/main/java/ovh/herisson/Clyde/Services/Inscription/InscriptionService.java index 208471d..534fb88 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Services/Inscription/InscriptionService.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Services/Inscription/InscriptionService.java @@ -59,6 +59,11 @@ public class InscriptionService { if (inscrRequest == null) return false; + //If the request is already accepted we just return ok (otherwise we would duplicate the procedure below) + if (inscrRequest.getState() == RequestState.Accepted){ + return true; + } + inscrRequest.setState(requestState); save(inscrRequest); diff --git a/backend/src/main/java/ovh/herisson/Clyde/Services/LessonRequestService.java b/backend/src/main/java/ovh/herisson/Clyde/Services/LessonRequestService.java index 21a6732..0343ad2 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Services/LessonRequestService.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Services/LessonRequestService.java @@ -74,8 +74,8 @@ public class LessonRequestService { if(lessonRequest == null || state == lessonRequest.getState() || state == null){ return false;} if (state == RequestState.Accepted){ - Course course = courseRepository.findById(lessonRequest.getCourse().getCourseID()); - if(courseRepository.findById(lessonRequest.getCourse().getCourseID())==null|| local == null){ + Course course = courseRepository.findById(lessonRequest.getCourse().getCourseId()); + if(courseRepository.findById(lessonRequest.getCourse().getCourseId())==null|| local == null){ return false;} Lesson lesson = new Lesson(); lesson.setCourse(course); diff --git a/backend/src/main/java/ovh/herisson/Clyde/Services/LessonService.java b/backend/src/main/java/ovh/herisson/Clyde/Services/LessonService.java index 474d473..7bda70e 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Services/LessonService.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Services/LessonService.java @@ -21,7 +21,6 @@ public class LessonService { private final LessonRepository lessonRepo; private final UserCurriculumRepository userCurriculumRepo; private final CourseRepository courseRepo; - private final CurriculumCourseRepository curriculumCourseRepo; public LessonService(LessonRepository lessonRepo, UserCurriculumRepository userCurriculumRepo, CourseRepository courseRepo, CurriculumCourseRepository curriculumCourseRepo){ this.lessonRepo = lessonRepo; @@ -65,11 +64,15 @@ public class LessonService { public Iterable findOnesLessons(User student){ ArrayList toReturn = new ArrayList<>(); ArrayList courses = new ArrayList<>(); - ArrayList userCurriculums = userCurriculumRepo.findByUserOrderByCurriculum(student); - for(UserCurriculum uc: userCurriculums){ - Curriculum c = uc.getCurriculum(); - if(uc.isActual()) - courses.addAll((ArrayList) curriculumCourseRepo.findCoursesByCurriculum(c)); + ArrayList userCurricula = userCurriculumRepo.findByUserAndActual(student, true); + for (UserCurriculum userCurriculum : userCurricula) { + curriculumCourseRepo.findCoursesByCurriculum(userCurriculum.getCurriculum()).forEach((item) -> { + //We need this to eliminate clones because a course can belong to several curriculums + if (!courses.contains(item)) { + System.out.println(item.getTitle()); + courses.add(item); + } + }); } for (Course element : courses) { for(Lesson lesson : lessonRepo.findLessonByCourse(element)) diff --git a/backend/src/main/java/ovh/herisson/Clyde/Services/Msg/ForumService.java b/backend/src/main/java/ovh/herisson/Clyde/Services/Msg/ForumService.java new file mode 100644 index 0000000..02fca22 --- /dev/null +++ b/backend/src/main/java/ovh/herisson/Clyde/Services/Msg/ForumService.java @@ -0,0 +1,38 @@ +package ovh.herisson.Clyde.Services.Msg; + +import org.springframework.stereotype.Service; + +import lombok.AllArgsConstructor; +import ovh.herisson.Clyde.Repositories.CourseRepository; +import ovh.herisson.Clyde.Repositories.Msg.ForumRepository; +import ovh.herisson.Clyde.Repositories.Msg.TopicRepository; +import ovh.herisson.Clyde.Tables.Course; +import ovh.herisson.Clyde.Tables.User; +import ovh.herisson.Clyde.Tables.Msg.Answer; +import ovh.herisson.Clyde.Tables.Msg.Forum; +import ovh.herisson.Clyde.Tables.Msg.Topic; + +@Service +@AllArgsConstructor +public class ForumService { + + private CourseRepository courseRepo; + private ForumRepository forumRepo; + private TopicRepository topicRepo; + + public void createForum(Course c, Forum f){ + c.addForum(f); + courseRepo.save(c); + } + + public void createTopic(Forum f, Topic data) { + f.addTopic(data); + forumRepo.save(f); + } + + public void answerTopic(Topic t, Answer data, User u) { + data.setAuthor(u); + t.addAnswer(data); + topicRepo.save(t); + } +} diff --git a/backend/src/main/java/ovh/herisson/Clyde/Services/ProtectionService.java b/backend/src/main/java/ovh/herisson/Clyde/Services/ProtectionService.java index 1d7d851..710bf70 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Services/ProtectionService.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Services/ProtectionService.java @@ -50,7 +50,7 @@ public class ProtectionService { HashMap toReturn = new HashMap<>(); - toReturn.put("courseId",course.getCourseID()); + toReturn.put("courseID",course.getCourseId()); toReturn.put("credits",course.getCredits()); toReturn.put("title", course.getTitle()); toReturn.put("owner", userWithoutPassword(course.getOwner())); diff --git a/backend/src/main/java/ovh/herisson/Clyde/Services/UserCurriculumService.java b/backend/src/main/java/ovh/herisson/Clyde/Services/UserCurriculumService.java index 2861a6e..4dbdea3 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Services/UserCurriculumService.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Services/UserCurriculumService.java @@ -49,5 +49,7 @@ public class UserCurriculumService { return toReturn; } - + public ArrayList findByStudentAndActual(User u, boolean actual){ + return userCurriculumRepository.findByUserAndActual(u, actual); + } } diff --git a/backend/src/main/java/ovh/herisson/Clyde/Tables/Course.java b/backend/src/main/java/ovh/herisson/Clyde/Tables/Course.java index af6ac77..96b8064 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Tables/Course.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Tables/Course.java @@ -1,10 +1,20 @@ package ovh.herisson.Clyde.Tables; import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import ovh.herisson.Clyde.Tables.Msg.Forum; + +import java.util.List; + import org.hibernate.annotations.OnDelete; import org.hibernate.annotations.OnDeleteAction; @Entity +@Data +@NoArgsConstructor +@AllArgsConstructor public class Course { @Id @GeneratedValue(strategy = GenerationType.AUTO) @@ -17,42 +27,18 @@ public class Course { @JoinColumn(name = "Users") private User owner; + //// Extension Messagerie ///// + @OneToMany(cascade = CascadeType.ALL) + private List forums; + + public void addForum(Forum f){ + forums.add(f); + } + /////////////////////////////// + public Course(int credits, String title, User owner){ this.credits = credits; this.title = title; this.owner = owner; } - - public Course() {} - - public int getCourseID() { - return courseId; - } - public void setCourseID(int courseId){ - this.courseId = courseId; - } - - public int getCredits() { - return credits; - } - - public void setCredits(int credits){ - this.credits = credits; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title){ - this.title = title; - } - - public User getOwner() { - return owner; - } - - public void setOwner(User owner) { - this.owner = owner; - } } diff --git a/backend/src/main/java/ovh/herisson/Clyde/Tables/Msg/Answer.java b/backend/src/main/java/ovh/herisson/Clyde/Tables/Msg/Answer.java new file mode 100644 index 0000000..4101abb --- /dev/null +++ b/backend/src/main/java/ovh/herisson/Clyde/Tables/Msg/Answer.java @@ -0,0 +1,29 @@ +package ovh.herisson.Clyde.Tables.Msg; + + +import java.util.Date; + +import org.hibernate.annotations.CreationTimestamp; + +import jakarta.persistence.*; +import lombok.Data; +import ovh.herisson.Clyde.Tables.User; + +@Entity +@Data +public class Answer { + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private int id; + + @CreationTimestamp + private Date creation; + + private String content; + + @ManyToOne(cascade=CascadeType.ALL) + private User author; + + private boolean anonymous; + +} diff --git a/backend/src/main/java/ovh/herisson/Clyde/Tables/Msg/Forum.java b/backend/src/main/java/ovh/herisson/Clyde/Tables/Msg/Forum.java new file mode 100644 index 0000000..75508aa --- /dev/null +++ b/backend/src/main/java/ovh/herisson/Clyde/Tables/Msg/Forum.java @@ -0,0 +1,35 @@ +package ovh.herisson.Clyde.Tables.Msg; + +import java.util.List; + +import jakarta.persistence.*; +import lombok.Data; +import ovh.herisson.Clyde.Tables.Course; +import ovh.herisson.Clyde.Tables.User; + +@Entity +@Data +public class Forum { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private int id; + + @ManyToOne + private Course course; + + private String name; + + @OneToMany(cascade = CascadeType.ALL) + private List topics; + + public void addTopic(Topic t) { + topics.add(t); + } + + @OneToMany + private List writers; // User who are authorized to create a post + + @OneToMany + private List register; +} diff --git a/backend/src/main/java/ovh/herisson/Clyde/Tables/Msg/Topic.java b/backend/src/main/java/ovh/herisson/Clyde/Tables/Msg/Topic.java new file mode 100644 index 0000000..3641f5f --- /dev/null +++ b/backend/src/main/java/ovh/herisson/Clyde/Tables/Msg/Topic.java @@ -0,0 +1,31 @@ +package ovh.herisson.Clyde.Tables.Msg; + +import java.util.List; + +import jakarta.persistence.*; +import lombok.Data; +import ovh.herisson.Clyde.Tables.User; + +@Entity +@Data +public class Topic { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private int id; + + private String subject, content; + + @ManyToOne + private User author; + + @OneToMany(cascade = CascadeType.ALL) + private List answers; + + public void addAnswer(Answer a){ + answers.add(a); + } + + private boolean locked; // true if new messages can be posted + +} diff --git a/backend/src/main/java/ovh/herisson/Clyde/Tables/User.java b/backend/src/main/java/ovh/herisson/Clyde/Tables/User.java index b21738e..3fe8559 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Tables/User.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Tables/User.java @@ -11,6 +11,7 @@ import ovh.herisson.Clyde.Tables.Msg.Message; import java.util.Date; import java.util.List; +import com.fasterxml.jackson.annotation.JsonIgnore; @Entity @Table(name = "Users") public class User { @@ -27,7 +28,6 @@ public class User { private Date birthDate; private String profilePictureUrl; private Role role; - @JsonIgnore private String password; diff --git a/backend/src/main/java/ovh/herisson/Clyde/Tables/UserCurriculum.java b/backend/src/main/java/ovh/herisson/Clyde/Tables/UserCurriculum.java index 395eca7..34caf26 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Tables/UserCurriculum.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Tables/UserCurriculum.java @@ -1,10 +1,17 @@ package ovh.herisson.Clyde.Tables; import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + import org.hibernate.annotations.OnDelete; import org.hibernate.annotations.OnDeleteAction; @Entity +@Data +@AllArgsConstructor +@NoArgsConstructor public class UserCurriculum { @Id @GeneratedValue(strategy = GenerationType.AUTO) @@ -26,48 +33,10 @@ public class UserCurriculum { //True if the user has that curriculum at the moment false if not private boolean actual; - public UserCurriculum(User user, Curriculum curriculum, int year, boolean actual){ - this.user = user; - this.curriculum = curriculum; - this.year = year; - this.actual = actual; - } - - public UserCurriculum() {} - - public int getId() { - return id; - } - - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } - - public Curriculum getCurriculum() { - return curriculum; - } - - public void setCurriculum(Curriculum curriculum) { - this.curriculum = curriculum; - } - - public int getYear() { - return year; - } - - public void setYear(int year) { - this.year = year; - } - - public void setActual(boolean actual) { - this.actual = actual; - } - - public boolean isActual() { - return actual; - } + public UserCurriculum(User u, Curriculum cu, int year, boolean actual){ + this.user = u; + this.curriculum = cu; + this.year = year; + this.actual = actual; + } } diff --git a/frontend/public/i18n/EN.txt b/frontend/public/i18n/EN.txt index 60fe065..d21d00b 100644 --- a/frontend/public/i18n/EN.txt +++ b/frontend/public/i18n/EN.txt @@ -13,6 +13,13 @@ login.guest.lastpage=Last Page login.guest.submit=Submit login.guest.birthday=BIRTHDAY login.guest.confirm=CONFIRM +login.guest.browse=Browse... +login.guest.disclaimer=If you are already registered please connect to your account and use the change cursus/reregister function if not continue here. +login.guest.identityCard=Identity Card : +login.guest.attestationdisclaimer=This curriculum requires an entrance exam attestation +login.guest.formationdisclaimer=Please add your old formations with the associated degree/attestation,your case will be check by a member of the inscription service. +login.guest.managecareer=Manage your external formations +login.guest.sendRegReq=Send register request login.cPassword=Confirm Password login.password=Password app.home=Home @@ -35,6 +42,63 @@ app.payments = Payments request.moreInfos=More Infos request.accept=Accept request.refuse=Refuse +Pending=Pending +Delete=Delete +Modify=Modify +Create=Créer +requestType=Request Type +day=Day +start=Start +end=End +monday=Monday +tuesday=Tuesday +wednesday=Wednesday +thursday=Thursday +friday=Friday +saturday=Saturday +sunday=Sunday +january=January +february=February +march=March +april=April +may=May +june=June +july=July +august=August +september=September +october=October +november=November +december=December +Grid=Grid +Week=Week +Month=Month +List=List +Type=Type +Teacher=Teacher +Course=Course +TP=TP +TD=TD +Exam=Exam +OwnSchedule=Own Schedule +SwitchToJSON=Switch to JSON FILE +schedule.previous=Previous +schedule.next=Next +schedule.current=Current +schedule.settings=Settings +schedule.courses=Courses +schedule.teachers=Teacher(s) +schedule.askChanges=Ask Changes +schedule.askCreate=Ask to create course +schedule.askDeletion=Ask Deletion +schedule.createSchedule=Create Schedule +schedule.createLesson=Create course +schedule.deleteMod=Unable deletion +schedule.noDeleteMod=Disable deletion +schedule=Schedule +old_day=Precedent day +old_start=Precedent start +old_end=Precedent end +old_type=Precedent type courses.createCourse=Create course courses.deleteCourse=Delete course courses.modify=Modify @@ -56,3 +120,87 @@ Curriculum=curriculum Credits=Credits InscriptionService=I.S. faculty=Faculty +forum.create=Create forum +forum.create.name=New forum's name +forum.post.create.name=New post's title +firstname/name=Firstname/Name +regNo=regNo +From=From +To=To +WantedCursus=Wanted Cursus +seeprofile=See profile +acceptequiv=Accept equivalence +refuseequiv=Refuse equivalence +course=course +state=state +dljustifdoc=Download justification document +backtoreq=Back to request +dlidentitycard=Download identity card +dladmissiondoc=Download admission document +seeextcur=See external curriculums +dltaxdoc=Download tax justification document +dlresidency=Download residency justification document +enteramount=Please enter the amount to provide : +oldcursus=Old curriculums +newcursus = New curriculums +year=Year +reason=Reason : +selectedcursus=Selected curriculum : +askexemp=Ask exemption +exemp=Exempted +uploadjustifdoc=Please upload the justification document +subexemreq=Submit exemption request +addextcurr=Add external curriculum +dldoc=Download document +edit=Edit +delete=Delete +school=School +checkifnotcompleted=Check the box if you didn't complete the formation +wichyearstop=In which year did you stop (ex: 3rd year) ? +startyear=Start year +endyear=End year +giveextcurdoc=Please upload a document that proves this formation +uploadcurr=Upload curriculum +editcurr=Edit curriculum +reqtype=Request type : +inscription=register +scholarship=scholarship +exemption=exemption +unregister=unregister +curriculumch=curriculum change +filter=Filter : +approval=Approval : +teacherapproval=Teacher approval : +surreq=Are you sure that you want to accept this request ? +validate=Validate +amount=Amount +role=Role +manageextcur=Manage external curriculum +managecourse=Manage courses +manageminerval=Manage school fees +enterreason=Please enter the reason you leave +onlycursus=I only want to unregister from a specific cursus +plsselectcurs=Please select that cursus +sureunreg=Are you sure that you want to unregister ? +no=No +yes=Yes +reqsend=Your request has been send ! +payment=Payment +lefttopay=left to pay +paydeposit=Pay deposit +payrest=Pay all the rest +alreadypaid=Payment : School fees have already been paid this year +askscholarship=Ask scholarship +uploaddocs=Please upload the required documents +taxjustdoc=Tax justification document : +residencydoc=Residency justification document : +reqsent=Your request has been sent to the inscription service. +backprofile=Go back to profile +procpayment=Proceed to payment of +procpaybutton=Process payment +rereg=Reregister in the next year of one of my cursus +reregsup=Register in a supplementary cursus +chcur=Change from a cursus to another +iwouldlike=I would like to : +newcurr=New curriculum +cursusprereq=The cursus you selected has some prerequisites ensure that your external curriculum data is updated in your profile diff --git a/frontend/public/i18n/FR.txt b/frontend/public/i18n/FR.txt index db0a730..0c9f8ba 100644 --- a/frontend/public/i18n/FR.txt +++ b/frontend/public/i18n/FR.txt @@ -13,6 +13,13 @@ login.guest.lastpage=Derniere Page login.guest.submit=Envoyer login.guest.birthday=DATE DE NAISSANCE login.guest.confirm=CONFIRMER +login.guest.browse=Parcourir... +login.guest.disclaimer=Si vous êtes déja inscrits dans cette université veuillez vous connecter a votre compte et utilisez les fonctions changer de cursus/réinscription sinon continuez ici. +login.guest.identityCard=Carte d'identité : +login.guest.attestationdisclaimer=Ce cursus requiert une attestation de réussite d'un examen d'entrée +login.guest.formationdisclaimer=Veuillez ajouter vos formations antérieures en y joignant les attestations/diplomes, votre dossier sera vérifié par un membre du service d'inscription. +login.guest.managecareer=Gèrer mon parcours extérieur +login.guest.sendRegReq=Envoyer la demande d'inscription login.cPassword=Confirmer mot de passe login.password=Mot de passe app.home=Home @@ -35,6 +42,63 @@ app.payments = Payements request.moreInfos=Plus d'Infos request.accept=Accepter request.refuse=Refuser +Pending=En attente +Delete=Supprimer +Modify=Modifier +Create=Créer +requestType=Type de Requête +day=Jour +start=Début +end=Fin +monday=Lundi +tuesday=Mardi +wednesday=Mercredi +thursday=Jeudi +friday=Vendredi +saturday=Samedi +sunday=Dimanche +january=Janvier +february=Février +march=Mars +april=Avril +may=Mai +june=Juin +july=Juillet +august=Août +september=Septembre +october=Octobre +november=Novembre +december=Decembre +Grid=Grille +Week=Semaine +Month=Mois +List=Liste +Type=Type +Teacher=Professeur +Course=Cours +TP=TP +TD=TD +Exam=Exam +OwnSchedule=Mon Horaire +SwitchToJSON=Afficher le JSON +schedule.previous=Précédent +schedule.next=Prochain +schedule.current=Actuel +schedule.settings=Options +schedule.courses=Cours +schedule.teachers=Professeurs(s) +schedule.askChanges=Demander Changement +schedule.askCreate=Demander de créer un cours +schedule.askDeletion=Demander suppression +schedule.createSchedule=Créer Horaire +schedule.createLesson=Créer cours +schedule.deleteMod=Activer suppression +schedule.noDeleteMod=Désactiver suppression +schedule=Horaire +old_day=Ancien Jour +old_start=Ancien Début +old_end=Ancienne Fin +old_type=Ancien Type courses.createCourse=Créer un cours courses.deleteCourse=Supprimer un cours courses.modify=Modifier @@ -56,4 +120,87 @@ Curriculum=Cursus Credits=Credits InscriptionService=S.I. faculty=Faculté - +forum.create=Créer un forum +forum.create.name=Nom du forum +forum.post.create.name=Titre du post +firstname/name=Prénom/Nom +regNo=Matricule +From=De +To=A +WantedCursus=Cursus voulu +seeprofile=Voir le profil +acceptequiv=Accepter l'équivalence +refuseequiv=Refuser l'équivalence +course=cours +state=état +dljustifdoc=Télécharger le justificatif +backtoreq=Retour a la requête +dlidentitycard=Télécharger la carte d'identité +dladmissiondoc=Télécharger le certificat d'admission +seeextcur=Voir le parcours extérieur +dltaxdoc=Télécharger le justificatif d'impot +dlresidency=Télécharger le justificatif de résidence +enteramount=Veuillez entrer le montant alloué : +oldcursus=Anciens cursus +newcursus=Nouveaux cursus +year=Année +reason=Raison : +selectedcursus=Cursus selectionné : +askexemp=Demander une dispense +exemp=Dispensé +uploadjustifdoc=Veuillez soumettre le justificatif +subexemreq=Envoyer la demande de dispense +addextcurr=Ajouter une formation +dldoc=Télécharger le document +edit=Modifier +delete=Supprimer +school=Ecole +checkifnotcompleted=Cochez la case si vous n'avez terminé cette formation +wichyearstop=En quelle année de la formation vous êtes vous arrété (exemple: 3ème) ? +startyear=Année de début +endyear=Année de fin +giveextcurdoc=Veuillez soumettre un document attestant de ce parcours +uploadcurr=Ajouter la formation +editcurr=Modifier la formation +reqtype=Type de requête : +inscription=inscription +scholarship=bourse +exemption=dispense +unregister=désinscription +curriculumch=changement de cursus +filer=Filtre : +approval=Approbation : +teacherapproval=Approbation d'un prof : +surreq=Etes vous sur de vouloir accepter cette demande ? +validate=Valider +amount=Montant +role=Role +manageextcur=Gérer les formations +managecourse=Gérer les cours +manageminerval=Gérer le minerval +enterreason=Veuillez entrer la raison de votre départ +onlycursus=Je veux uniquement me désinscrire d'un seul cursus +plsselectcurs=Veuillez sélectionner ce cursus +sureunreg=Etes-vous sur de vouloir vous désinscrire ? +no=Non +yes=Oui +reqsend=Votre requête a été envoyée ! +payment=Payement +lefttopay=restants a payer +paydeposit=Payer l'acompte +payrest=Payer le reste +alreadypaid=Payement : les frais ont déja été payés cette année +askscholarship=Demander une bourse +uploaddocs=Veuillez soumettre les documents requis +taxjustdoc=Justificatif d'impôts : +residencydoc=Justificatif de résidence : +reqsent=Votre requête a été envoyée au service d'inscription. +backprofile=Retour au profil +procpayment=Procéder au payement de +procpaybutton=Procéder au payement +rereg=Me réinscrire dans l'année supérieure +reregsup=M'inscrire dans un cursus supplémentaire +chcur=Changer d'un cursus vers un autre +iwouldlike=Je voudrais : +newcurr=Nouveau cursus +cursusprereq=Le cursus que vous avez selectionné a des prérequis assurez vous que votre dossier de parcours est a jour dans votre profil diff --git a/frontend/src/Apps/Forums.vue b/frontend/src/Apps/Forums.vue new file mode 100644 index 0000000..d2004c5 --- /dev/null +++ b/frontend/src/Apps/Forums.vue @@ -0,0 +1,215 @@ + + + + + + + + diff --git a/frontend/src/Apps/Inscription/AboutChangeCurriculum.vue b/frontend/src/Apps/Inscription/AboutChangeCurriculum.vue index 9a3f40d..0f2e21d 100644 --- a/frontend/src/Apps/Inscription/AboutChangeCurriculum.vue +++ b/frontend/src/Apps/Inscription/AboutChangeCurriculum.vue @@ -39,39 +39,39 @@ async function editChangeCurrReqTeacherApproval(state){
- Firstname/Name : {{req.user.firstName}} {{req.user.lastName}} + {{i18n("firstname/name")}} : {{req.user.firstName}} {{req.user.lastName}}
- regNo : {{req.user.regNo}} + {{i18n("regNo")}} : {{req.user.regNo}}
- From : Bac {{req.actualCurriculum.year}} {{req.actualCurriculum.option}} - To : Bac {{req.destinationCurriculum.year}} {{req.destinationCurriculum.option}} + {{i18n("From")}} : Bac {{req.actualCurriculum.year}} {{req.actualCurriculum.option}} + {{i18n("To")}} : Bac {{req.destinationCurriculum.year}} {{req.destinationCurriculum.option}}
- Wanted cursus : Bac {{req.destinationCurriculum.year}} {{req.destinationCurriculum.option}} + {{i18n("WantedCursus")}} : Bac {{req.destinationCurriculum.year}} {{req.destinationCurriculum.option}}
- +
- - + +
- - + +
-
- +
+
- +
@@ -125,4 +125,12 @@ async function editChangeCurrReqTeacherApproval(state){ background-color:rgb(50,50,50); border-radius:20px; } + +button{ + border:none; + background-color:rgb(239, 60, 168); + border-radius:10px; + height:35px; + margin-top:10px; +} \ No newline at end of file diff --git a/frontend/src/Apps/Inscription/AboutExemption.vue b/frontend/src/Apps/Inscription/AboutExemption.vue index 366c32a..f4cdc98 100644 --- a/frontend/src/Apps/Inscription/AboutExemption.vue +++ b/frontend/src/Apps/Inscription/AboutExemption.vue @@ -32,23 +32,23 @@ async function editExemp(newstate){
- Firstname/Name : {{req.user.firstName}} {{req.user.lastName}} + {{ i18n("firstname/name") }} : {{req.user.firstName}} {{req.user.lastName}}
- Course: {{req.course.title}} + {{ i18n("course") }}: {{req.course.title}}
- State : {{req.state}} + {{ i18n("state") }} : {{req.state}}
- +
- +
- - + +
@@ -56,10 +56,10 @@ async function editExemp(newstate){
- +
- +
@@ -113,4 +113,12 @@ async function editExemp(newstate){ background-color:rgb(50,50,50); border-radius:20px; } + +button{ + border:none; + background-color:rgb(239, 60, 168); + border-radius:10px; + height:35px; + margin-top:10px; +} \ No newline at end of file diff --git a/frontend/src/Apps/Inscription/AboutRequest.vue b/frontend/src/Apps/Inscription/AboutRequest.vue index c6d15df..4d8a11b 100644 --- a/frontend/src/Apps/Inscription/AboutRequest.vue +++ b/frontend/src/Apps/Inscription/AboutRequest.vue @@ -1,7 +1,7 @@