Compare commits
18 Commits
706481ed1a
...
4199663d64
Author | SHA1 | Date | |
---|---|---|---|
4199663d64 | |||
34c0a2bfe8 | |||
76c3b76153 | |||
5bb7606721 | |||
b049c46571 | |||
7ca5c34afe | |||
2b9bdf8dac | |||
ccb954e348 | |||
ce56e37a33 | |||
1c61a356a4 | |||
2bdffe6ab4 | |||
729d1ad504 | |||
1522d74ed3 | |||
b4499e04c7 | |||
914f6bdf36 | |||
66e7fa24a1 | |||
7b9f021c24 | |||
2dfa0a0ee0 |
@ -16,6 +16,8 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
compileOnly("org.projectlombok:lombok")
|
||||||
|
annotationProcessor("org.projectlombok:lombok")
|
||||||
implementation("org.springframework.boot:spring-boot-starter-jdbc")
|
implementation("org.springframework.boot:spring-boot-starter-jdbc")
|
||||||
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
|
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
|
||||||
implementation("org.springframework.boot:spring-boot-starter-mail")
|
implementation("org.springframework.boot:spring-boot-starter-mail")
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
package ovh.herisson.Clyde.DTO.Msg;
|
||||||
|
|
||||||
|
/******************************************************
|
||||||
|
* @file DiscussionDTO.java
|
||||||
|
* @author Anthony Debucquoy
|
||||||
|
* @scope Extension messagerie
|
||||||
|
*
|
||||||
|
* File to format a discussion using messageDTO
|
||||||
|
******************************************************/
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import ovh.herisson.Clyde.Tables.User;
|
||||||
|
import ovh.herisson.Clyde.Tables.Msg.Discussion;
|
||||||
|
import ovh.herisson.Clyde.DTO.Msg.MessagesDTO;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class DiscussionDTO {
|
||||||
|
private long id;
|
||||||
|
private String name;
|
||||||
|
private List<User> members;
|
||||||
|
private List<MessagesDTO> msgs;
|
||||||
|
|
||||||
|
public static DiscussionDTO construct(Discussion d, User u){
|
||||||
|
List<MessagesDTO> msgsdto = new ArrayList<>();
|
||||||
|
d.getMsgs().forEach(x -> msgsdto.add(MessagesDTO.construct(x, u)));
|
||||||
|
return new DiscussionDTO(d.getId(), d.getName(), d.getMembers(), msgsdto);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package ovh.herisson.Clyde.DTO.Msg;
|
||||||
|
|
||||||
|
/******************************************************
|
||||||
|
* @file MessagesDTO.java
|
||||||
|
* @author Anthony Debucquoy
|
||||||
|
* @scope Extension messagerie
|
||||||
|
*
|
||||||
|
* File to Format the response adding the sender field
|
||||||
|
******************************************************/
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import ovh.herisson.Clyde.Tables.User;
|
||||||
|
import ovh.herisson.Clyde.Tables.Msg.Message;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class MessagesDTO {
|
||||||
|
private long id;
|
||||||
|
private String content;
|
||||||
|
private User author;
|
||||||
|
private boolean sender;
|
||||||
|
private Date created;
|
||||||
|
//TODO: Attachment
|
||||||
|
|
||||||
|
public static MessagesDTO construct(Message m, User user){
|
||||||
|
boolean sender = false;
|
||||||
|
if(m.getAuthor().equals(user))
|
||||||
|
sender = true;
|
||||||
|
return new MessagesDTO(m.getId(), m.getContent(), m.getAuthor(), sender, m.getCreated());
|
||||||
|
}
|
||||||
|
}
|
@ -41,4 +41,12 @@ public class ExternalCurriculumController {
|
|||||||
ArrayList<ExternalCurriculum> toReturn = ecr.getExternalCurriculumByInscriptionRequest(ir);
|
ArrayList<ExternalCurriculum> toReturn = ecr.getExternalCurriculumByInscriptionRequest(ir);
|
||||||
return new ResponseEntity<>(toReturn, HttpStatus.OK);
|
return new ResponseEntity<>(toReturn, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PatchMapping("/externalcurriculum/{extcurrid}/{newstate}")
|
||||||
|
public ResponseEntity<Object> changeExternalCurrState(@PathVariable long extcurrid, @PathVariable RequestState newstate){
|
||||||
|
ExternalCurriculum externalCurriculum = ecr.getExternalCurriculumById(extcurrid);
|
||||||
|
externalCurriculum.setState(newstate);
|
||||||
|
ecr.save(externalCurriculum);
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ovh.herisson.Clyde.EndPoints;
|
package ovh.herisson.Clyde.EndPoints;
|
||||||
|
|
||||||
|
import org.apache.tomcat.util.http.parser.Authorization;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -79,4 +80,22 @@ public class InscriptionController {
|
|||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Allow teacher or admin to accept or refuse the equivalence
|
||||||
|
@PatchMapping("/request/registerequiv/{id}/{newstate}")
|
||||||
|
public ResponseEntity<Object> editRegisterEquiv(@RequestHeader("Authorization") String token, @PathVariable long id, @PathVariable RequestState newstate){
|
||||||
|
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Teacher}, token))
|
||||||
|
return new UnauthorizedResponse<>(null);
|
||||||
|
|
||||||
|
InscriptionRequest toEdit = inscriptionServ.getById(id);
|
||||||
|
toEdit.setEquivalenceState(newstate);
|
||||||
|
|
||||||
|
inscriptionServ.save(toEdit);
|
||||||
|
|
||||||
|
if (toEdit.getState() == RequestState.Accepted && (toEdit.getEquivalenceState() == RequestState.Accepted || toEdit.getEquivalenceState() == RequestState.Unrequired))
|
||||||
|
{
|
||||||
|
inscriptionServ.createUser(toEdit);
|
||||||
|
}
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,15 @@ import org.springframework.http.HttpHeaders;
|
|||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import ovh.herisson.Clyde.Repositories.CurriculumRepository;
|
||||||
|
import ovh.herisson.Clyde.Repositories.InscriptionRepository;
|
||||||
import ovh.herisson.Clyde.Responses.UnauthorizedResponse;
|
import ovh.herisson.Clyde.Responses.UnauthorizedResponse;
|
||||||
import ovh.herisson.Clyde.Services.AuthenticatorService;
|
import ovh.herisson.Clyde.Services.AuthenticatorService;
|
||||||
import ovh.herisson.Clyde.Services.ProtectionService;
|
import ovh.herisson.Clyde.Services.ProtectionService;
|
||||||
|
import ovh.herisson.Clyde.Tables.Curriculum;
|
||||||
import ovh.herisson.Clyde.Tables.InscriptionRequest;
|
import ovh.herisson.Clyde.Tables.InscriptionRequest;
|
||||||
|
import ovh.herisson.Clyde.Tables.RequestState;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -16,7 +21,7 @@ import java.util.Map;
|
|||||||
@CrossOrigin(originPatterns = "*", allowCredentials = "true")
|
@CrossOrigin(originPatterns = "*", allowCredentials = "true")
|
||||||
public class LoginController {
|
public class LoginController {
|
||||||
private final AuthenticatorService authServ;
|
private final AuthenticatorService authServ;
|
||||||
|
private final CurriculumRepository curriculumRepository;
|
||||||
static public class RequestLogin{
|
static public class RequestLogin{
|
||||||
private final String identifier;
|
private final String identifier;
|
||||||
private final String password;
|
private final String password;
|
||||||
@ -29,8 +34,9 @@ public class LoginController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public LoginController(AuthenticatorService authServ){
|
public LoginController(AuthenticatorService authServ, CurriculumRepository curriculumRepository){
|
||||||
this.authServ = authServ;
|
this.authServ = authServ;
|
||||||
|
this.curriculumRepository = curriculumRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = "/login")
|
@PostMapping(value = "/login")
|
||||||
@ -48,9 +54,18 @@ public class LoginController {
|
|||||||
|
|
||||||
@PostMapping("/register")
|
@PostMapping("/register")
|
||||||
public ResponseEntity<Map<String,Object>> register(@RequestBody InscriptionRequest inscriptionRequest){
|
public ResponseEntity<Map<String,Object>> register(@RequestBody InscriptionRequest inscriptionRequest){
|
||||||
|
//We ensure here that if the targeted cursus year is more than first grade then we need the teacher equivalence approval
|
||||||
|
Curriculum curr = curriculumRepository.findById(inscriptionRequest.getCurriculumId());
|
||||||
|
|
||||||
|
if (curr.getYear() > 1){
|
||||||
|
inscriptionRequest.setEquivalenceState(RequestState.Pending);
|
||||||
|
}else{
|
||||||
|
inscriptionRequest.setEquivalenceState(RequestState.Unrequired);
|
||||||
|
}
|
||||||
|
|
||||||
InscriptionRequest returnedInscriptionRequest = authServ.register(inscriptionRequest);
|
InscriptionRequest returnedInscriptionRequest = authServ.register(inscriptionRequest);
|
||||||
|
|
||||||
|
|
||||||
return new ResponseEntity<>(ProtectionService.requestWithoutPassword(returnedInscriptionRequest), HttpStatus.CREATED);
|
return new ResponseEntity<>(ProtectionService.requestWithoutPassword(returnedInscriptionRequest), HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ public class MockController {
|
|||||||
public final CurriculumCourseService CurriculumCourseService;
|
public final CurriculumCourseService CurriculumCourseService;
|
||||||
public final CurriculumService curriculumService;
|
public final CurriculumService curriculumService;
|
||||||
public final CourseService courseService;
|
public final CourseService courseService;
|
||||||
|
public final ExternalCurriculumRepository externalCurriculumRepository;
|
||||||
public final InscriptionService inscriptionService;
|
public final InscriptionService inscriptionService;
|
||||||
ArrayList<User> mockUsers;
|
ArrayList<User> mockUsers;
|
||||||
|
|
||||||
@ -31,13 +31,14 @@ public class MockController {
|
|||||||
|
|
||||||
public final ScholarshipRequestRepository scholarshipRequestRepository;
|
public final ScholarshipRequestRepository scholarshipRequestRepository;
|
||||||
|
|
||||||
public MockController(UserRepository userRepo, TokenRepository tokenRepo, TokenService tokenService, CurriculumCourseService CurriculumCourseService, CurriculumService curriculumService, CourseService courseService, InscriptionService inscriptionService, UserCurriculumRepository ucr, MinervalRepository minervalRepository, ScholarshipRequestRepository scholarshipRequestRepository){
|
public MockController(UserRepository userRepo, TokenRepository tokenRepo, TokenService tokenService, CurriculumCourseService CurriculumCourseService, CurriculumService curriculumService, CourseService courseService, ExternalCurriculumRepository externalCurriculumRepository, InscriptionService inscriptionService, UserCurriculumRepository ucr, MinervalRepository minervalRepository, ScholarshipRequestRepository scholarshipRequestRepository){
|
||||||
this.tokenRepo = tokenRepo;
|
this.tokenRepo = tokenRepo;
|
||||||
this.userRepo = userRepo;
|
this.userRepo = userRepo;
|
||||||
this.tokenService = tokenService;
|
this.tokenService = tokenService;
|
||||||
this.CurriculumCourseService = CurriculumCourseService;
|
this.CurriculumCourseService = CurriculumCourseService;
|
||||||
this.curriculumService = curriculumService;
|
this.curriculumService = curriculumService;
|
||||||
this.courseService = courseService;
|
this.courseService = courseService;
|
||||||
|
this.externalCurriculumRepository = externalCurriculumRepository;
|
||||||
this.inscriptionService = inscriptionService;
|
this.inscriptionService = inscriptionService;
|
||||||
this.ucr = ucr;
|
this.ucr = ucr;
|
||||||
this.minervalRepository = minervalRepository;
|
this.minervalRepository = minervalRepository;
|
||||||
@ -114,9 +115,12 @@ public class MockController {
|
|||||||
CurriculumCourseService.save(new CurriculumCourse(chemistryBab1,chemistry1));
|
CurriculumCourseService.save(new CurriculumCourse(chemistryBab1,chemistry1));
|
||||||
|
|
||||||
|
|
||||||
InscriptionRequest inscriptionRequest = new InscriptionRequest("helen","prenom","non","helen@gmail.com","america",new Date(),(long) 1,RequestState.Pending,"yes.png","password", null, new Date());
|
InscriptionRequest inscriptionRequest = new InscriptionRequest("helen","prenom","non","helen@gmail.com","america",new Date(),(long) 4,RequestState.Pending,"yes.png","password", null, new Date(), RequestState.Pending);
|
||||||
|
|
||||||
inscriptionService.save(inscriptionRequest);
|
inscriptionService.save(inscriptionRequest);
|
||||||
|
|
||||||
|
ExternalCurriculum externalCurriculum = new ExternalCurriculum(inscriptionRequest, "HEH", "Bachelier en informatique", "Completed", 2015, 2018, null, RequestState.Pending);
|
||||||
|
externalCurriculumRepository.save(externalCurriculum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,126 @@
|
|||||||
|
package ovh.herisson.Clyde.EndPoints.Msg;
|
||||||
|
|
||||||
|
/******************************************************
|
||||||
|
* @file MessagesController.java
|
||||||
|
* @author Anthony Debucquoy
|
||||||
|
* @scope Extension messagerie
|
||||||
|
*
|
||||||
|
* Entry point for the messages application
|
||||||
|
******************************************************/
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
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.PatchMapping;
|
||||||
|
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 lombok.AllArgsConstructor;
|
||||||
|
import ovh.herisson.Clyde.DTO.Msg.DiscussionDTO;
|
||||||
|
import ovh.herisson.Clyde.Repositories.UserRepository;
|
||||||
|
import ovh.herisson.Clyde.Repositories.Msg.DiscussionRepository;
|
||||||
|
import ovh.herisson.Clyde.Responses.UnauthorizedResponse;
|
||||||
|
import ovh.herisson.Clyde.Services.AuthenticatorService;
|
||||||
|
import ovh.herisson.Clyde.Services.UserService;
|
||||||
|
import ovh.herisson.Clyde.Services.Msg.DiscussionService;
|
||||||
|
import ovh.herisson.Clyde.Tables.User;
|
||||||
|
import ovh.herisson.Clyde.Tables.Msg.Discussion;
|
||||||
|
import ovh.herisson.Clyde.Tables.Msg.Message;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@CrossOrigin(originPatterns = "*", allowCredentials = "true")
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class MessagesController {
|
||||||
|
|
||||||
|
private AuthenticatorService authServ;
|
||||||
|
private DiscussionService discServ;
|
||||||
|
private DiscussionRepository discRepo;
|
||||||
|
private UserService userServ;
|
||||||
|
|
||||||
|
@GetMapping("/discussions")
|
||||||
|
public ResponseEntity<Iterable<Discussion>> getDiscussions(@RequestHeader("Authorization") String token ){
|
||||||
|
User user = authServ.getUserFromToken(token);
|
||||||
|
if(user == null){
|
||||||
|
return new UnauthorizedResponse<>(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
Iterable<Discussion> mock = discServ.getOwned(authServ.getUserFromToken(token));
|
||||||
|
|
||||||
|
return new ResponseEntity<>(mock, HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/discussion/{id}")
|
||||||
|
public ResponseEntity<DiscussionDTO> getDiscussion(@RequestHeader("Authorization") String token, @PathVariable long id){
|
||||||
|
User user = authServ.getUserFromToken(token);
|
||||||
|
if(user == null || !discServ.hasDiscussion(user, id) ){
|
||||||
|
return new UnauthorizedResponse<>(null);
|
||||||
|
}
|
||||||
|
return new ResponseEntity<>(DiscussionDTO.construct(discRepo.findById(id).orElse(null), authServ.getUserFromToken(token)), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PatchMapping("/discussion/{id}")
|
||||||
|
public ResponseEntity<Discussion> AlterDiscussion(@RequestHeader("Authorization") String token, @PathVariable long id, @RequestBody Discussion data){
|
||||||
|
User user = authServ.getUserFromToken(token);
|
||||||
|
if(user == null){
|
||||||
|
return new UnauthorizedResponse<>(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
Discussion disc = discRepo.findById(id).orElse(null);
|
||||||
|
disc.setName(data.getName());
|
||||||
|
discRepo.save(disc);
|
||||||
|
return new ResponseEntity<>(disc, HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PatchMapping("/discussion/{id}/add")
|
||||||
|
public ResponseEntity<Discussion> invite(@RequestHeader("Authorization") String token, @PathVariable long id, @RequestBody User data){
|
||||||
|
User user = authServ.getUserFromToken(token);
|
||||||
|
if(user == null){
|
||||||
|
return new UnauthorizedResponse<>(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
Discussion disc = discRepo.findById(id).orElse(null);
|
||||||
|
User invited = userServ.getUserById(data.getRegNo());
|
||||||
|
disc.addMember(invited);
|
||||||
|
discRepo.save(disc);
|
||||||
|
return new ResponseEntity<>(disc, HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PatchMapping("/discussion/{id}/remove")
|
||||||
|
public ResponseEntity<Discussion> removeMember(@RequestHeader("Authorization") String token, @PathVariable long id, @RequestBody User data){
|
||||||
|
User user = authServ.getUserFromToken(token);
|
||||||
|
if(user == null){
|
||||||
|
return new UnauthorizedResponse<>(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
Discussion disc = discRepo.findById(id).orElse(null);
|
||||||
|
User member = userServ.getUserById(data.getRegNo());
|
||||||
|
disc.delMember(member);
|
||||||
|
discRepo.save(disc);
|
||||||
|
return new ResponseEntity<>(disc, HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/discussion/{id}")
|
||||||
|
public ResponseEntity<Discussion> sendMessage(@RequestHeader("Authorization") String token, @PathVariable long id, @RequestBody Message msg){
|
||||||
|
User user = authServ.getUserFromToken(token);
|
||||||
|
if(user == null){
|
||||||
|
return new UnauthorizedResponse<>(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
Discussion disc = discRepo.findById(id).orElse(null);
|
||||||
|
msg.setAuthor(user);
|
||||||
|
if(disc != null)
|
||||||
|
discServ.CreateMessage(disc, msg);
|
||||||
|
return new ResponseEntity<>(disc, HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/discussion")
|
||||||
|
public ResponseEntity<Discussion> createDiscussion(@RequestHeader("Authorization") String token, @RequestBody Discussion data){
|
||||||
|
return new ResponseEntity<>(discServ.create(data.getName(), authServ.getUserFromToken(token)), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
}
|
@ -9,4 +9,6 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
public interface ExternalCurriculumRepository extends CrudRepository<ExternalCurriculum, Long> {
|
public interface ExternalCurriculumRepository extends CrudRepository<ExternalCurriculum, Long> {
|
||||||
ArrayList<ExternalCurriculum> getExternalCurriculumByInscriptionRequest(InscriptionRequest ir);
|
ArrayList<ExternalCurriculum> getExternalCurriculumByInscriptionRequest(InscriptionRequest ir);
|
||||||
|
|
||||||
|
ExternalCurriculum getExternalCurriculumById(long id);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
package ovh.herisson.Clyde.Repositories.Msg;
|
||||||
|
|
||||||
|
/******************************************************
|
||||||
|
* @file DiscussionRepository.java
|
||||||
|
* @author Anthony Debucquoy
|
||||||
|
* @scope Extension messagerie
|
||||||
|
*
|
||||||
|
* Repository of Discussion allowing to fetch discussion by user
|
||||||
|
******************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
|
||||||
|
import ovh.herisson.Clyde.Tables.Msg.Discussion;
|
||||||
|
|
||||||
|
public interface DiscussionRepository extends CrudRepository<Discussion, Long>{
|
||||||
|
|
||||||
|
@Query("SELECT d FROM Discussion d INNER JOIN FETCH d.members dm WHERE dm.id = ?1")
|
||||||
|
List<Discussion> findByMembership(long userid);
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package ovh.herisson.Clyde.Repositories.Msg;
|
||||||
|
|
||||||
|
/******************************************************
|
||||||
|
* @file MessageRepository.java
|
||||||
|
* @author Anthony Debucquoy
|
||||||
|
* @scope Extension messagerie
|
||||||
|
******************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
|
||||||
|
import ovh.herisson.Clyde.Tables.Msg.Message;
|
||||||
|
|
||||||
|
public interface MessageRepository extends CrudRepository<Message, Long> {}
|
@ -47,48 +47,43 @@ public class InscriptionService {
|
|||||||
if (inscrRequest == null)
|
if (inscrRequest == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// if th state is the same we don't send an email
|
|
||||||
if (requestState == inscrRequest.getState())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/** todo send an email to tell the poster of the inscrRequest (inscrRequest.getEmail())
|
|
||||||
* to notify them that the state of their request changed
|
|
||||||
* FooEmailFormat toSend = (String.format("Your request state changed from %s to %s"),
|
|
||||||
* inscrRequest.getState(), requestState)
|
|
||||||
* FooEmailSender.send(toSend, inscrRequest.getEmail())
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
//saves the user from the request if accepted
|
|
||||||
if (requestState == RequestState.Accepted)
|
|
||||||
{
|
|
||||||
if (curriculumRepo.findById(inscrRequest.getCurriculumId()) == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
User userFromRequest = new User(
|
|
||||||
inscrRequest.getLastName(),
|
|
||||||
inscrRequest.getFirstName(),
|
|
||||||
inscrRequest.getEmail(),
|
|
||||||
inscrRequest.getAddress(),
|
|
||||||
inscrRequest.getCountry(),
|
|
||||||
inscrRequest.getBirthDate(),
|
|
||||||
inscrRequest.getProfilePicture(),
|
|
||||||
inscrRequest.getPassword()
|
|
||||||
);
|
|
||||||
|
|
||||||
userRepo.save(userFromRequest);
|
|
||||||
userCurriculumRepo.save(new UserCurriculum(userFromRequest, curriculumRepo.findById(inscrRequest.getCurriculumId()),0));
|
|
||||||
|
|
||||||
//Create a minerval for the new student
|
|
||||||
Minerval minerval = new Minerval(userFromRequest.getRegNo(), 0, 852, 2023);
|
|
||||||
minervalRepository.save(minerval);
|
|
||||||
|
|
||||||
}
|
|
||||||
inscrRequest.setState(requestState);
|
inscrRequest.setState(requestState);
|
||||||
save(inscrRequest);
|
save(inscrRequest);
|
||||||
|
|
||||||
|
//saves the user from the request if accepted from teacher and inscription services
|
||||||
|
if (requestState == RequestState.Accepted && (inscrRequest.getEquivalenceState() == RequestState.Accepted || inscrRequest.getEquivalenceState() == RequestState.Unrequired))
|
||||||
|
{
|
||||||
|
return createUser(inscrRequest);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean createUser(InscriptionRequest inscrRequest){
|
||||||
|
//We must send an email here
|
||||||
|
|
||||||
|
if (curriculumRepo.findById(inscrRequest.getCurriculumId()) == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
User userFromRequest = new User(
|
||||||
|
inscrRequest.getLastName(),
|
||||||
|
inscrRequest.getFirstName(),
|
||||||
|
inscrRequest.getEmail(),
|
||||||
|
inscrRequest.getAddress(),
|
||||||
|
inscrRequest.getCountry(),
|
||||||
|
inscrRequest.getBirthDate(),
|
||||||
|
inscrRequest.getProfilePicture(),
|
||||||
|
inscrRequest.getPassword()
|
||||||
|
);
|
||||||
|
|
||||||
|
userRepo.save(userFromRequest);
|
||||||
|
userCurriculumRepo.save(new UserCurriculum(userFromRequest, curriculumRepo.findById(inscrRequest.getCurriculumId()),0));
|
||||||
|
|
||||||
|
//Create a minerval for the new student
|
||||||
|
Minerval minerval = new Minerval(userFromRequest.getRegNo(), 0, 852, 2023);
|
||||||
|
minervalRepository.save(minerval);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
public void delete(InscriptionRequest toDelete) {
|
public void delete(InscriptionRequest toDelete) {
|
||||||
inscriptionRepo.delete(toDelete);
|
inscriptionRepo.delete(toDelete);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,57 @@
|
|||||||
|
package ovh.herisson.Clyde.Services.Msg;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/******************************************************
|
||||||
|
* @file DiscussionService.java
|
||||||
|
* @author Anthony Debucquoy
|
||||||
|
* @scope Extension messagerie
|
||||||
|
*
|
||||||
|
* Various function utilised by the messages application
|
||||||
|
******************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.util.JSONPObject;
|
||||||
|
|
||||||
|
import ovh.herisson.Clyde.Repositories.Msg.DiscussionRepository;
|
||||||
|
import ovh.herisson.Clyde.Tables.User;
|
||||||
|
import ovh.herisson.Clyde.Tables.Msg.Discussion;
|
||||||
|
import ovh.herisson.Clyde.Tables.Msg.Message;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class DiscussionService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DiscussionRepository discRepo;
|
||||||
|
|
||||||
|
public Discussion create(String name, User author){
|
||||||
|
return discRepo.save(new Discussion(name, author));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* list discussions owned by a certain user
|
||||||
|
*/
|
||||||
|
public Iterable<Discussion> getOwned(User author){
|
||||||
|
return discRepo.findByMembership(author.getRegNo());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a message and link it to it's discussion
|
||||||
|
*/
|
||||||
|
public Discussion CreateMessage(Discussion disc, Message msg){
|
||||||
|
disc.addMessage(msg);
|
||||||
|
return discRepo.save(disc);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a user is in a discussion
|
||||||
|
*/
|
||||||
|
public boolean hasDiscussion(User user, long id) {
|
||||||
|
Discussion disc = discRepo.findById(id).orElse(null);
|
||||||
|
List<User> members = disc.getMembers();
|
||||||
|
return members.contains(user);
|
||||||
|
}
|
||||||
|
}
|
@ -89,6 +89,7 @@ public class ProtectionService {
|
|||||||
toReturn.put("profilePictureUrl", inscriptionRequest.getProfilePicture());
|
toReturn.put("profilePictureUrl", inscriptionRequest.getProfilePicture());
|
||||||
toReturn.put("identityCard", inscriptionRequest.getIdentityCard());
|
toReturn.put("identityCard", inscriptionRequest.getIdentityCard());
|
||||||
toReturn.put("submissionDate", inscriptionRequest.getSubmissionDate());
|
toReturn.put("submissionDate", inscriptionRequest.getSubmissionDate());
|
||||||
|
toReturn.put("equivalenceState", inscriptionRequest.getEquivalenceState());
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,9 +21,10 @@ public class InscriptionRequest {
|
|||||||
private String password;
|
private String password;
|
||||||
private String identityCard;
|
private String identityCard;
|
||||||
private Date submissionDate;
|
private Date submissionDate;
|
||||||
|
private RequestState equivalenceState;
|
||||||
public InscriptionRequest(){}
|
public InscriptionRequest(){}
|
||||||
|
|
||||||
public InscriptionRequest(String lastName, String firstName, String address, String email, String country, Date birthDate,Long curriculumId, RequestState state, String profilePicture, String password, String identityCard, Date submissionDate){
|
public InscriptionRequest(String lastName, String firstName, String address, String email, String country, Date birthDate,Long curriculumId, RequestState state, String profilePicture, String password, String identityCard, Date submissionDate, RequestState equivalenceState){
|
||||||
this.lastName = lastName;
|
this.lastName = lastName;
|
||||||
this.firstName = firstName;
|
this.firstName = firstName;
|
||||||
this.address = address;
|
this.address = address;
|
||||||
@ -36,6 +37,7 @@ public class InscriptionRequest {
|
|||||||
this.password = password;
|
this.password = password;
|
||||||
this.identityCard = identityCard;
|
this.identityCard = identityCard;
|
||||||
this.submissionDate = submissionDate;
|
this.submissionDate = submissionDate;
|
||||||
|
this.equivalenceState = equivalenceState;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
@ -137,4 +139,12 @@ public class InscriptionRequest {
|
|||||||
public void setSubmissionDate(Date submissionDate) {
|
public void setSubmissionDate(Date submissionDate) {
|
||||||
this.submissionDate = submissionDate;
|
this.submissionDate = submissionDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RequestState getEquivalenceState() {
|
||||||
|
return equivalenceState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEquivalenceState(RequestState equivalenceState) {
|
||||||
|
this.equivalenceState = equivalenceState;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,72 @@
|
|||||||
|
package ovh.herisson.Clyde.Tables.Msg;
|
||||||
|
|
||||||
|
/******************************************************
|
||||||
|
* @file Discussion.java
|
||||||
|
* @author Anthony Debucquoy
|
||||||
|
* @scope Extension messagerie
|
||||||
|
*
|
||||||
|
* Discussion allow to regroupe multiple user in and message together
|
||||||
|
* for the messages application to work
|
||||||
|
******************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import jakarta.persistence.CascadeType;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.JoinTable;
|
||||||
|
import jakarta.persistence.ManyToMany;
|
||||||
|
import jakarta.persistence.OneToMany;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
import ovh.herisson.Clyde.Tables.User;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class Discussion{
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||||
|
private long id;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ManyToMany
|
||||||
|
@JoinTable(
|
||||||
|
name = "discussion_members",
|
||||||
|
joinColumns = @JoinColumn(name = "discussion_id"),
|
||||||
|
inverseJoinColumns = @JoinColumn(name = "user_id")
|
||||||
|
)
|
||||||
|
private List<User> members;
|
||||||
|
|
||||||
|
@OneToMany(mappedBy="discussion", orphanRemoval = true, cascade = CascadeType.ALL)
|
||||||
|
private List<Message> msgs;
|
||||||
|
|
||||||
|
public Discussion(String name){
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Discussion(String name, User user){
|
||||||
|
this.name = name;
|
||||||
|
this.members = List.of(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addMessage(Message msg){
|
||||||
|
msg.setDiscussion(this);
|
||||||
|
msgs.add(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addMember(User user) {
|
||||||
|
members.add(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delMember(User user) {
|
||||||
|
members.remove(user);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,66 @@
|
|||||||
|
package ovh.herisson.Clyde.Tables.Msg;
|
||||||
|
|
||||||
|
/******************************************************
|
||||||
|
* @file Message.java
|
||||||
|
* @author Anthony Debucquoy
|
||||||
|
* @scope Extension messagerie
|
||||||
|
*
|
||||||
|
* Represent a message sent to a discussion
|
||||||
|
******************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
import org.hibernate.annotations.CreationTimestamp;
|
||||||
|
import org.hibernate.annotations.UpdateTimestamp;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import jakarta.persistence.CascadeType;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.OneToMany;
|
||||||
|
import jakarta.persistence.OneToOne;
|
||||||
|
import jakarta.persistence.PrePersist;
|
||||||
|
import jakarta.persistence.Temporal;
|
||||||
|
import jakarta.persistence.TemporalType;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
import ovh.herisson.Clyde.Tables.User;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Entity
|
||||||
|
public class Message {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||||
|
private long id;
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@CreationTimestamp
|
||||||
|
@Column(nullable = false)
|
||||||
|
private Date created;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
private User author;
|
||||||
|
|
||||||
|
public User getAuthor() {
|
||||||
|
return author;
|
||||||
|
}
|
||||||
|
|
||||||
|
@OneToOne
|
||||||
|
private Message response;
|
||||||
|
|
||||||
|
@ManyToOne(optional = false)
|
||||||
|
@JsonIgnore
|
||||||
|
private Discussion discussion;
|
||||||
|
|
||||||
|
}
|
@ -3,5 +3,6 @@ package ovh.herisson.Clyde.Tables;
|
|||||||
public enum RequestState {
|
public enum RequestState {
|
||||||
Accepted,
|
Accepted,
|
||||||
Refused,
|
Refused,
|
||||||
Pending
|
Pending,
|
||||||
|
Unrequired
|
||||||
}
|
}
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
package ovh.herisson.Clyde.Tables;
|
|
||||||
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
public class University {
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
|
||||||
private int id;
|
|
||||||
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
public University(){}
|
|
||||||
|
|
||||||
public University(String name){
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +1,11 @@
|
|||||||
package ovh.herisson.Clyde.Tables;
|
package ovh.herisson.Clyde.Tables;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
|
import ovh.herisson.Clyde.Tables.Msg.Discussion;
|
||||||
|
import ovh.herisson.Clyde.Tables.Msg.Message;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@ -20,6 +24,15 @@ public class User {
|
|||||||
private String profilePictureUrl;
|
private String profilePictureUrl;
|
||||||
private ovh.herisson.Clyde.Tables.Role role;
|
private ovh.herisson.Clyde.Tables.Role role;
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
|
////// Extension Messagerie /////
|
||||||
|
@OneToMany(mappedBy = "author", cascade = CascadeType.ALL)
|
||||||
|
private List<Message> msgs;
|
||||||
|
/////////////////////////////////
|
||||||
|
|
||||||
|
@ManyToMany( mappedBy = "members" )
|
||||||
|
private List<Discussion> discussions;
|
||||||
|
|
||||||
public User(String lastName, String firstName, String email, String address,
|
public User(String lastName, String firstName, String email, String address,
|
||||||
String country, Date birthDate, String profilePictureUrl, Role role, String password)
|
String country, Date birthDate, String profilePictureUrl, Role role, String password)
|
||||||
{
|
{
|
||||||
|
@ -1,27 +1,35 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import i18n from "@/i18n.js"
|
import i18n from "@/i18n.js"
|
||||||
import {getUser} from '../rest/Users.js'
|
import {getSelf, getUser} from '../rest/Users.js'
|
||||||
import {getcurriculum,getSomeonesCurriculumList} from "@/rest/curriculum.js";
|
import {getcurriculum,getSomeonesCurriculumList} from "@/rest/curriculum.js";
|
||||||
import {getRegisters} from "@/rest/ServiceInscription.js";
|
import {getRegisters} from "@/rest/ServiceInscription.js";
|
||||||
import {get} from "jsdom/lib/jsdom/named-properties-tracker.js";
|
import {get} from "jsdom/lib/jsdom/named-properties-tracker.js";
|
||||||
import {getExternalCurriculumByInscrReq} from "@/rest/externalCurriculum.js";
|
import {getExternalCurriculumByInscrReq} from "@/rest/externalCurriculum.js";
|
||||||
|
import {ref} from "vue";
|
||||||
|
import ExternalCurriculumList from "@/Apps/ExternalCurriculumList.vue";
|
||||||
|
import {editEquivalenceState} from "@/rest/requests.js";
|
||||||
|
|
||||||
const props = defineProps(['target']);
|
const props = defineProps(['target']);
|
||||||
let request = await getRegisters(props.target);
|
const request = await getRegisters(props.target);
|
||||||
const cursus = await getcurriculum(request.curriculum);
|
const cursus = await getcurriculum(request.curriculum);
|
||||||
|
const user = await getSelf();
|
||||||
|
const list = ref(false);
|
||||||
const externalCurriculum = await getExternalCurriculumByInscrReq(request.id)
|
const externalCurriculum = await getExternalCurriculumByInscrReq(request.id)
|
||||||
console.log(externalCurriculum)
|
|
||||||
function getPP(){
|
function getPP(){
|
||||||
if(request.profilePictureUrl === null){
|
if(request.profilePictureUrl === null){
|
||||||
return "/Clyde.png"
|
return "/Clyde.png"
|
||||||
}
|
}
|
||||||
return request.profilePictureUrl;
|
return request.profilePictureUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function editEquivalence(id, newstate){
|
||||||
|
await editEquivalenceState(id, newstate)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="body">
|
<div class="body" v-if="list == false">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="profilPic">
|
<div class="profilPic">
|
||||||
<img class="subContainter" :src=getPP()>
|
<img class="subContainter" :src=getPP()>
|
||||||
@ -46,24 +54,20 @@ function getPP(){
|
|||||||
<div>
|
<div>
|
||||||
Cursus voulu : BAB {{cursus.year}} {{cursus.option}}
|
Cursus voulu : BAB {{cursus.year}} {{cursus.option}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div v-if="cursus.year > 1">
|
||||||
</div>
|
<button style="background-color:rgb(105,05,105);margin-left: 5%" @click="list=!list" v-if="(user.role == 'Teacher' || user.role == 'Admin')&& request.equivalenceState == 'Pending'">See external curriculums</button>
|
||||||
<div class="moreInfos">
|
|
||||||
<div class = "oldcursus">
|
|
||||||
<div class="listTitle">
|
|
||||||
Cursus extérieurs a l'univesité
|
|
||||||
</div>
|
|
||||||
<div class="listElement">
|
|
||||||
<div class=" containerElement" v-for="item in externalCurriculum">
|
|
||||||
<div class="formation">item.formation</div>
|
|
||||||
<div class="school">item.school</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="list==true">
|
||||||
|
<ExternalCurriculumList :ext-curr-list="externalCurriculum" :inscr-req-id="request.id"></ExternalCurriculumList>
|
||||||
|
<div>
|
||||||
|
<button @click="editEquivalence(request.id, 'Accepted'); request.equivalenceState='Accepted'">Accept Equivalence</button>
|
||||||
|
<button @click="editEquivalence(request.id, 'Refused'); request.equivalenceState='Refused'">Refuse Equivalence</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
@ -117,50 +121,6 @@ function getPP(){
|
|||||||
border-radius:20px;
|
border-radius:20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.moreInfos {
|
|
||||||
display:grid;
|
|
||||||
grid-template-rows:200px auto;
|
|
||||||
column-gap:50px;
|
|
||||||
row-gap:45px;
|
|
||||||
grid-template-areas:
|
|
||||||
"minfos minfos";
|
|
||||||
grid-template-columns:600px 600px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.listTitle{
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
width:250px;
|
|
||||||
margin-left:auto;
|
|
||||||
margin-right:auto;
|
|
||||||
border:2px solid black;
|
|
||||||
font-size:25px;
|
|
||||||
color:white;
|
|
||||||
padding:20px;
|
|
||||||
background-color:rgb(50,50,50);
|
|
||||||
border-radius:20px;margin-bottom:10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.listElement{
|
|
||||||
border:2px solid black;
|
|
||||||
font-size:25px;
|
|
||||||
color:white;
|
|
||||||
padding:20px;
|
|
||||||
background-color:rgb(50,50,50);
|
|
||||||
border-radius:20px;
|
|
||||||
margin-bottom:10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.containerElement{
|
|
||||||
justify-content:center;
|
|
||||||
display:grid;
|
|
||||||
grid-template-columns:100px 100px 300px;
|
|
||||||
grid-template-areas:
|
|
||||||
"year option dateyear";
|
|
||||||
column-gap:40px;
|
|
||||||
padding-left: 25px;
|
|
||||||
}
|
|
||||||
button{
|
button{
|
||||||
font-size:15px;
|
font-size:15px;
|
||||||
height:50px;
|
height:50px;
|
||||||
@ -169,42 +129,4 @@ button{
|
|||||||
border-radius:20px;
|
border-radius:20px;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.moreInfos {
|
|
||||||
display:grid;
|
|
||||||
grid-template-rows:200px auto;
|
|
||||||
column-gap:50px;
|
|
||||||
row-gap:45px;
|
|
||||||
grid-template-areas:
|
|
||||||
"minfos minfos";
|
|
||||||
grid-template-columns:600px 600px;
|
|
||||||
align-items:center;
|
|
||||||
justify-content:center;
|
|
||||||
margin-left: 320%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.listTitle{
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
width:250px;
|
|
||||||
margin-left:auto;
|
|
||||||
margin-right:auto;
|
|
||||||
border:2px solid black;
|
|
||||||
font-size:25px;
|
|
||||||
color:white;
|
|
||||||
padding:20px;
|
|
||||||
background-color:rgb(50,50,50);
|
|
||||||
border-radius:20px;margin-bottom:10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.listElement{
|
|
||||||
border:2px solid black;
|
|
||||||
font-size:25px;
|
|
||||||
color:white;
|
|
||||||
padding:20px;
|
|
||||||
background-color:rgb(50,50,50);
|
|
||||||
border-radius:20px;
|
|
||||||
margin-bottom:10px;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
103
frontend/src/Apps/ExternalCurriculumList.vue
Normal file
103
frontend/src/Apps/ExternalCurriculumList.vue
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
<script setup>
|
||||||
|
import i18n from "@/i18n.js";
|
||||||
|
import {editExternalCurriculum} from "@/rest/externalCurriculum.js";
|
||||||
|
import {ref} from "vue";
|
||||||
|
import {editEquivalenceState} from "@/rest/requests.js";
|
||||||
|
|
||||||
|
const props = defineProps(["extCurrList","inscrReqId"])
|
||||||
|
|
||||||
|
const extCurrList = ref(props.extCurrList)
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template style="margin-top:5%;">
|
||||||
|
<div style="display:flex; justify-content:center; " v-for="item in extCurrList">
|
||||||
|
<div class="bodu">
|
||||||
|
<div class="container">
|
||||||
|
<div class="status"><a style="margin-left:30px">{{item.state}}</a></div>
|
||||||
|
<div class="school"><a>{{item.school}}</a></div>
|
||||||
|
<div class="formation"><a>{{item.formation}}</a></div>
|
||||||
|
<div class="completion"><a>{{item.completion}}</a></div>
|
||||||
|
<div class="download"><button>Download document</button></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.container{
|
||||||
|
color:white;
|
||||||
|
height:100px;
|
||||||
|
font-size:30px;
|
||||||
|
display:grid;
|
||||||
|
grid-template-columns:15% 10% 20% 15% 13.1%;
|
||||||
|
grid-template-areas:
|
||||||
|
"status school formation completion download";
|
||||||
|
column-gap:10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status {
|
||||||
|
grid-area:status;
|
||||||
|
align-self:center;
|
||||||
|
font-size: 70%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.school{
|
||||||
|
grid-area:school;
|
||||||
|
align-self:center;
|
||||||
|
font-size: 70%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.formation{
|
||||||
|
grid-area:formation;
|
||||||
|
align-self:center;
|
||||||
|
font-size: 70%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.completion{
|
||||||
|
grid-area:completion;
|
||||||
|
align-self:center;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow:ellipsis;
|
||||||
|
font-size: 70%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.accept{
|
||||||
|
grid-area:accept;
|
||||||
|
align-self:center;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow:ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.refuse{
|
||||||
|
grid-area: refuse;
|
||||||
|
align-self:center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.download{
|
||||||
|
grid-area: download;
|
||||||
|
align-self:center;
|
||||||
|
}
|
||||||
|
button{
|
||||||
|
font-size:15px;
|
||||||
|
height:50px;
|
||||||
|
width:75%;
|
||||||
|
border:none;
|
||||||
|
border-radius:20px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.bodu {
|
||||||
|
margin-top:2%;
|
||||||
|
width:66%;
|
||||||
|
border:2px solid black;
|
||||||
|
border-radius:9px;
|
||||||
|
background-color:rgb(50,50,50);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
@ -16,9 +16,7 @@
|
|||||||
|
|
||||||
async function upPage(id,review){
|
async function upPage(id,review){
|
||||||
await validateRegister(id,review);
|
await validateRegister(id,review);
|
||||||
if (review == "Accepted"){
|
|
||||||
|
|
||||||
}
|
|
||||||
requests.value = await getAllRegisters();
|
requests.value = await getAllRegisters();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +38,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="windowsState === 1">
|
<div v-if="windowsState === 1">
|
||||||
<AboutRequest :target="targetId"></AboutRequest>
|
<AboutRequest :target="targetId"></AboutRequest>
|
||||||
<button style="background-color:rgb(105,05,105);margin-left: 30%" @click="windowsState=0;">Retour</button>
|
<button style="background-color:rgb(105,05,105);margin-left: 30%; margin-top: 5%" @click="windowsState=0;loadRequests()">Retour</button>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="windowsState === 0">
|
<div v-if="windowsState === 0">
|
||||||
<div style="margin-top: 2%;margin-left: 2%">
|
<div style="margin-top: 2%;margin-left: 2%">
|
||||||
@ -61,15 +59,16 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div style='display:flex; justify-content:center; min-width:1140px;' v-for="item of requests">
|
<div style='display:flex; justify-content:center; min-width:1140px;' v-for="item of requests">
|
||||||
<div class="bodu" v-if="filterType == 'None' || filterType == item.state">
|
<div class="bodu" style="width: 95%" v-if="filterType == 'None' || filterType == item.state">
|
||||||
<div class="container" style="grid-template-columns:15% 15% 10% 14.2% 14.2% 14.2% 14.2%;grid-template-areas:'date state surname firstname accept refuse infos';" v-if="requestType === 'inscription'">
|
<div class="container" style="grid-template-columns:11% 15% 20% 10% 10% 9% 9%;grid-template-areas:'date state equivalencestate surname firstname accept refuse infos';" v-if="requestType === 'inscription'">
|
||||||
<!--
|
<!--
|
||||||
The condition below avoids an error occuring because loadRequests() finishes after the vue refresh
|
The condition below avoids an error occuring because loadRequests() finishes after the vue refresh
|
||||||
then submissionDate is undefined an it triggers an error in the console despite the fact that it is working
|
then submissionDate is undefined an it triggers an error in the console despite the fact that it is working
|
||||||
properly at the end.
|
properly at the end.
|
||||||
-->
|
-->
|
||||||
<div class="date" v-if="item.submissionDate !== undefined">{{item.submissionDate.slice(0, 10)}}</div>
|
<div class="date" v-if="item.submissionDate !== undefined">{{item.submissionDate.slice(0, 10)}}</div>
|
||||||
<div class="state">{{item.state}}</div>
|
<div class="state" style="font-size: 80%">Approval : {{item.state}}</div>
|
||||||
|
<div class="equivalencestate" style="font-size: 80%">Teacher approval : {{item.equivalenceState}}</div>
|
||||||
<div class="surname">{{item.lastName}}</div>
|
<div class="surname">{{item.lastName}}</div>
|
||||||
<div class="firstname">{{item.firstName}}</div>
|
<div class="firstname">{{item.firstName}}</div>
|
||||||
<div class="accept" v-if="item.state === 'Pending'"><button @click="windowsState=2;targetId=item.id;" style="background-color:rgb(0,105,50);">{{i18n("request.accept")}}</button></div>
|
<div class="accept" v-if="item.state === 'Pending'"><button @click="windowsState=2;targetId=item.id;" style="background-color:rgb(0,105,50);">{{i18n("request.accept")}}</button></div>
|
||||||
@ -110,6 +109,10 @@
|
|||||||
column-gap:10px;
|
column-gap:10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.equivalencestate{
|
||||||
|
grid-area: equivalencestate;
|
||||||
|
align-self: center;
|
||||||
|
}
|
||||||
.studentfirstname{
|
.studentfirstname{
|
||||||
grid-area: studentfirstname;
|
grid-area: studentfirstname;
|
||||||
align-self: center;
|
align-self: center;
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
address:null,
|
address:null,
|
||||||
country:null,
|
country:null,
|
||||||
curriculum:null,
|
curriculum:null,
|
||||||
|
equivalenceState: "Unrequired"
|
||||||
})
|
})
|
||||||
|
|
||||||
const notcompletedCheck = ref(false);
|
const notcompletedCheck = ref(false);
|
||||||
@ -76,18 +77,12 @@
|
|||||||
//This functions makes the distinction between a master cursus (year 4 or more) and a bachelor cursus (year 3 or less)
|
//This functions makes the distinction between a master cursus (year 4 or more) and a bachelor cursus (year 3 or less)
|
||||||
function getCursusDisplay(cursus){
|
function getCursusDisplay(cursus){
|
||||||
if (cursus.year <= 3){
|
if (cursus.year <= 3){
|
||||||
return cursus.curriculumId + " BAB " + cursus.year + " " + cursus.option;
|
return "BAB " + cursus.year + " " + cursus.option;
|
||||||
}else{
|
}else{
|
||||||
return cursus.curriculumId + " MA" + (parseInt(cursus.year)-3).toString() + " " + cursus.option;
|
return "MA" + (parseInt(cursus.year)-3).toString() + " " + cursus.option;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//This function return the id of a decorated cursus (decorated by the function up)
|
|
||||||
function parseDecoratedCursus(cursus){
|
|
||||||
let id = cursus.substring(0, cursus.indexOf(" ")+1);
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getCurriculumYear(curriculumId){
|
async function getCurriculumYear(curriculumId){
|
||||||
const curriculum = await getcurriculum(curriculumId);
|
const curriculum = await getcurriculum(curriculumId);
|
||||||
return parseInt(curriculum.year);
|
return parseInt(curriculum.year);
|
||||||
@ -97,7 +92,7 @@
|
|||||||
|
|
||||||
//Post the register request and return the id of the newly created request and also post the external curriculum list in the database
|
//Post the register request and return the id of the newly created request and also post the external curriculum list in the database
|
||||||
async function postRegisterReq(){
|
async function postRegisterReq(){
|
||||||
const val = await register(outputs.firstname, outputs.surname, outputs.birthday, outputs.password, outputs.email, outputs.address, outputs.country, parseDecoratedCursus(outputs.curriculum), ppData, null, new Date());
|
const val = await register(outputs.firstname, outputs.surname, outputs.birthday, outputs.password, outputs.email, outputs.address, outputs.country, outputs.curriculum, ppData, null, new Date(), outputs.equivalenceState);
|
||||||
for (let item in externalCurrTab.value){
|
for (let item in externalCurrTab.value){
|
||||||
await createExternalCurriculum(val.id, externalCurrTab.value[item].school, externalCurrTab.value[item].formation, externalCurrTab.value[item].completion, externalCurrTab.value[item].startYear, externalCurrTab.value[item].endYear, externalCurrTab.value[item].justifdocUrl);
|
await createExternalCurriculum(val.id, externalCurrTab.value[item].school, externalCurrTab.value[item].formation, externalCurrTab.value[item].completion, externalCurrTab.value[item].startYear, externalCurrTab.value[item].endYear, externalCurrTab.value[item].justifdocUrl);
|
||||||
}
|
}
|
||||||
@ -198,7 +193,7 @@
|
|||||||
<div class="inputBox">
|
<div class="inputBox">
|
||||||
<p>{{i18n("Curriculum").toUpperCase()}}</p>
|
<p>{{i18n("Curriculum").toUpperCase()}}</p>
|
||||||
<select v-model="outputs.curriculum">
|
<select v-model="outputs.curriculum">
|
||||||
<option v-for="item in curricula">{{getCursusDisplay(item)}}</option>
|
<option v-for="item in curricula" :value="item.curriculumId">{{getCursusDisplay(item)}}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<p style="color:rgb(239,60,168);">
|
<p style="color:rgb(239,60,168);">
|
||||||
|
213
frontend/src/Apps/Msg.vue
Normal file
213
frontend/src/Apps/Msg.vue
Normal file
@ -0,0 +1,213 @@
|
|||||||
|
<!----------------------------------------------------
|
||||||
|
File: Msg.vue
|
||||||
|
Author: Anthony Debucquoy
|
||||||
|
Scope: Extension messagerie
|
||||||
|
Description: Main msg page
|
||||||
|
----------------------------------------------------->
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, reactive } from 'vue'
|
||||||
|
import { discussionsList, currentDiscussion, fetchDiscussion, createDiscussion, sendMessage, updateDiscussionName, invite, removeMember} from '@/rest/msg.js'
|
||||||
|
|
||||||
|
const msgContent = ref("");
|
||||||
|
const addMember = ref(false);
|
||||||
|
const currentTitle = ref("");
|
||||||
|
|
||||||
|
function formatTime(date){
|
||||||
|
return date.getHours() + ":" + date.getMinutes() + " " + date.getDate() + "/" + date.getMonth();
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div id="msg">
|
||||||
|
<div id="discList">
|
||||||
|
<div @click="fetchDiscussion(discussion.id).then(e => currentTitle = currentDiscussion.name)" class="discItem" v-for="discussion in discussionsList" :key="discussion.id">{{ discussion.name }}</div>
|
||||||
|
<button id="createDiscussion" @click="createDiscussion('New Discussion')">+</button>
|
||||||
|
</div>
|
||||||
|
<div id="discussion" v-if="currentDiscussion.length != 0">
|
||||||
|
<h1 id=msgName ><input class="InputTitle" type="text" @change="updateDiscussionName(currentDiscussion.id, currentTitle)" v-model="currentTitle"></h1>
|
||||||
|
<div id=msgs>
|
||||||
|
<div class="msg" v-for="msg in currentDiscussion.msgs" :sender="msg.sender" :key="msg.id">
|
||||||
|
{{ msg.content }}<br/>
|
||||||
|
<span class="sender"><span v-if="!msg.sender">{{ msg.author.firstName }} {{ msg.author.lastName.toUpperCase() }}</span> {{formatTime(new Date(msg.created))}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id=messageBox>
|
||||||
|
<input type="text" @keyup.enter="sendMessage(currentDiscussion.id, msgContent, null); msgContent = ''" v-model="msgContent">
|
||||||
|
<input type="submit" @click="sendMessage(currentDiscussion.id, msgContent, null); msgContent = ''" value="send">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="members" v-if="currentDiscussion.length != 0">
|
||||||
|
<div class="memberItem" v-for="member in currentDiscussion.members" @click="removeMember(currentDiscussion.id, member.regNo)" :key="member.id"><span>{{ member.firstName }} {{ member.lastName.toUpperCase() }}</span></div>
|
||||||
|
<input type=text id="addMembers" @focus="addMember = true" @blur="addMember = false;$event.target.value = ''" @change="invite(currentDiscussion.id, $event.target.value)" :placeholder="addMember ? 'Regno' : '+'"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
div#msg{
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 20% auto 10%;
|
||||||
|
}
|
||||||
|
|
||||||
|
div#discList{
|
||||||
|
margin: 30px 0 30px 30px;
|
||||||
|
background-color: rgba(255, 255, 255, 0.05);
|
||||||
|
border-radius: 10px;
|
||||||
|
overflow: hidden;
|
||||||
|
padding: 10px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
div#members{
|
||||||
|
margin: 30px 0;
|
||||||
|
border-radius: 10px 0 0 10px;
|
||||||
|
background-color: red;
|
||||||
|
background-color: rgba(255, 255, 255, 0.05);
|
||||||
|
overflow: hidden;
|
||||||
|
display: flex;
|
||||||
|
padding: 10px 0 0 10px;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.InputTitle{
|
||||||
|
all: inherit;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.discItem{
|
||||||
|
color: darkorange;
|
||||||
|
display: flex;
|
||||||
|
font-family: sans-serif;
|
||||||
|
font-weight: bold;
|
||||||
|
height: 4vh;
|
||||||
|
margin: 5px;
|
||||||
|
border-radius: 0 30px 30px 0;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border: 1px solid darkorange;
|
||||||
|
}
|
||||||
|
|
||||||
|
.memberItem{
|
||||||
|
color: darkorange;
|
||||||
|
display: flex;
|
||||||
|
font-family: sans-serif;
|
||||||
|
font-weight: bold;
|
||||||
|
height: 4vh;
|
||||||
|
margin: 5px;
|
||||||
|
border-radius: 30px 0 0 30px;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border: 1px solid darkorange;
|
||||||
|
}
|
||||||
|
|
||||||
|
.memberItem:hover span{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.memberItem:hover{
|
||||||
|
background-color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
.memberItem:hover:before{
|
||||||
|
color: white;
|
||||||
|
content: "X"
|
||||||
|
}
|
||||||
|
|
||||||
|
#createDiscussion{
|
||||||
|
height: 4vh;
|
||||||
|
margin: 5px;
|
||||||
|
color: white;
|
||||||
|
background-color: green;
|
||||||
|
border-radius: 0 30px 30px 0;
|
||||||
|
border: none;
|
||||||
|
font-weight: 900;
|
||||||
|
font-size: 2em;
|
||||||
|
}
|
||||||
|
#addMembers{
|
||||||
|
height: 4vh;
|
||||||
|
margin: 5px;
|
||||||
|
text-align: center;
|
||||||
|
color: white;
|
||||||
|
background-color: green;
|
||||||
|
border-radius: 30px 0 0 30px;
|
||||||
|
border: none;
|
||||||
|
font-weight: 900;
|
||||||
|
font-size: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
div#discussion{
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
margin: 30px;
|
||||||
|
background-color: rgba(255, 255, 255, 0.05);
|
||||||
|
border-radius: 10px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
#msgName{
|
||||||
|
text-align: center;
|
||||||
|
display: block;
|
||||||
|
background-color: #2a1981;
|
||||||
|
border-radius: 5px;
|
||||||
|
color: white;
|
||||||
|
width: 75%;
|
||||||
|
margin: 30px auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.discItem:hover{
|
||||||
|
background-color: gray;
|
||||||
|
}
|
||||||
|
|
||||||
|
#msgs{
|
||||||
|
display: flex;
|
||||||
|
flex-grow: 1;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.msg {
|
||||||
|
background-color: aliceblue;
|
||||||
|
font-family: sans-serif;
|
||||||
|
margin: 10px;
|
||||||
|
padding: 5px;
|
||||||
|
border-radius: 3px;
|
||||||
|
max-width: 50%;
|
||||||
|
align-self: start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sender{
|
||||||
|
display: inline-block;
|
||||||
|
color: gray;
|
||||||
|
font-size: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.msg[sender=true]{
|
||||||
|
background-color: darkorange;
|
||||||
|
align-self: end;
|
||||||
|
}
|
||||||
|
|
||||||
|
#messageBox{
|
||||||
|
width: 100%;
|
||||||
|
height: 30px;
|
||||||
|
background-color: white;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
#messageBox input[type="text"]{
|
||||||
|
all: inherit;
|
||||||
|
padding: 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#messageBox input[type="submit"]{
|
||||||
|
border: inherit;
|
||||||
|
padding: 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
@ -43,3 +43,4 @@ export async function getAllRegisters(){
|
|||||||
export async function validateRegister(id, state){
|
export async function validateRegister(id, state){
|
||||||
return restPatch("/request/register/" + id, state);
|
return restPatch("/request/register/" + id, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ export function disconnect(){
|
|||||||
* @param curriculum
|
* @param curriculum
|
||||||
* @param imageId id of the image in database returned when uploaded
|
* @param imageId id of the image in database returned when uploaded
|
||||||
*/
|
*/
|
||||||
export async function register(firstname, lastname, birthDate, password, email, address, country, curriculumId, imageId, identityCardId, submissionDate){
|
export async function register(firstname, lastname, birthDate, password, email, address, country, curriculumId, imageId, identityCardId, submissionDate, equivalence){
|
||||||
return restPost("/register", {
|
return restPost("/register", {
|
||||||
firstName: firstname,
|
firstName: firstname,
|
||||||
lastName: lastname,
|
lastName: lastname,
|
||||||
@ -38,7 +38,8 @@ export async function register(firstname, lastname, birthDate, password, email,
|
|||||||
curriculumId: curriculumId,
|
curriculumId: curriculumId,
|
||||||
profilePicture: imageId,
|
profilePicture: imageId,
|
||||||
identityCard : identityCardId,
|
identityCard : identityCardId,
|
||||||
submissionDate : submissionDate
|
submissionDate : submissionDate,
|
||||||
|
equivalenceState : equivalence
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import Courses from "@/Apps/ManageCourses.vue"
|
|||||||
import Users from "@/Apps/UsersList.vue"
|
import Users from "@/Apps/UsersList.vue"
|
||||||
import Students from "@/Apps/StudentsList.vue"
|
import Students from "@/Apps/StudentsList.vue"
|
||||||
import AboutStudent from "@/Apps/AboutStudent.vue";
|
import AboutStudent from "@/Apps/AboutStudent.vue";
|
||||||
|
import Msg from "@/Apps/Msg.vue"
|
||||||
|
|
||||||
const apps = {
|
const apps = {
|
||||||
'/login': LoginPage,
|
'/login': LoginPage,
|
||||||
@ -18,6 +19,7 @@ const apps = {
|
|||||||
'/manage-courses' : Courses,
|
'/manage-courses' : Courses,
|
||||||
'/users-list' : Users,
|
'/users-list' : Users,
|
||||||
'/students-list' : Students,
|
'/students-list' : Students,
|
||||||
|
'/msg' : Msg,
|
||||||
}
|
}
|
||||||
|
|
||||||
const appsList = {
|
const appsList = {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {restGet, restPost} from "@/rest/restConsumer.js";
|
import {restGet, restPatch, restPost} from "@/rest/restConsumer.js";
|
||||||
import {parseInteger} from "jsdom/lib/jsdom/living/helpers/strings.js";
|
import {parseInteger} from "jsdom/lib/jsdom/living/helpers/strings.js";
|
||||||
|
|
||||||
export async function createExternalCurriculum(inscriptionRequestId,school, formation, completion, startYear, endYear, justifdocUrl){
|
export async function createExternalCurriculum(inscriptionRequestId,school, formation, completion, startYear, endYear, justifdocUrl){
|
||||||
@ -14,5 +14,9 @@ export async function createExternalCurriculum(inscriptionRequestId,school, form
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getExternalCurriculumByInscrReq(inscrReqId){
|
export async function getExternalCurriculumByInscrReq(inscrReqId){
|
||||||
return restGet("/externalcurriculum/"+inscrReqId);
|
return restGet("/externalcurriculum/"+inscrReqId)
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function editExternalCurriculum(extReqId, newState){
|
||||||
|
return restPatch("/externalcurriculum/"+extReqId+"/"+newState)
|
||||||
}
|
}
|
||||||
|
60
frontend/src/rest/msg.js
Normal file
60
frontend/src/rest/msg.js
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
/*******************************************************
|
||||||
|
* File: msg.js
|
||||||
|
* Author: Anthony Debucquoy
|
||||||
|
* Scope: Extension messagerie
|
||||||
|
* Description: Messages frontend api consumer
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
import { restGet, restPost, restPatch } from './restConsumer.js'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* - id
|
||||||
|
* - name
|
||||||
|
* - members
|
||||||
|
*/
|
||||||
|
export const discussionsList = ref();
|
||||||
|
export const currentDiscussion = ref([]);
|
||||||
|
let timerSet = false
|
||||||
|
|
||||||
|
|
||||||
|
export async function createDiscussion(name){
|
||||||
|
let disc = await restPost("/discussion", {name: name});
|
||||||
|
discussionsList.value.push(disc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export async function invite(id, regNo){
|
||||||
|
restPatch("/discussion/"+ id+ "/add", {regNo: parseInt(regNo)}).then(() => fetchDiscussion(id))
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function removeMember(id, regNo){
|
||||||
|
restPatch("/discussion/"+ id+ "/remove", {regNo: parseInt(regNo)}).then(() => fetchDiscussion(id))
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function sendMessage(id, content, responseId){
|
||||||
|
let data = {
|
||||||
|
content: content,
|
||||||
|
response: responseId,
|
||||||
|
}
|
||||||
|
restPost("/discussion/" + id, data).then(() => fetchDiscussion(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function updateDiscussionName(id, name){
|
||||||
|
restPatch("/discussion/" + id, {name: name}).then(() => fetchDiscussions());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async function fetchDiscussions(){
|
||||||
|
discussionsList.value = await restGet("/discussions");
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function fetchDiscussion(id){
|
||||||
|
currentDiscussion.value = await restGet("/discussion/" + id);
|
||||||
|
if(!timerSet){
|
||||||
|
timerSet = true;
|
||||||
|
setTimeout(() => {timerSet = false;fetchDiscussion(currentDiscussion.value.id)} , 5000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await fetchDiscussions();
|
@ -1,4 +1,4 @@
|
|||||||
import {restGet, restPost} from "@/rest/restConsumer.js";
|
import {restGet, restPatch, restPost} from "@/rest/restConsumer.js";
|
||||||
|
|
||||||
export async function createExemptionsRequest(exempReq){
|
export async function createExemptionsRequest(exempReq){
|
||||||
return restPost("/exemptionreq", exempReq)
|
return restPost("/exemptionreq", exempReq)
|
||||||
@ -15,3 +15,7 @@ export async function getAllScholarShipsRequest(){
|
|||||||
export async function getAllExemptionsRequest(){
|
export async function getAllExemptionsRequest(){
|
||||||
return restGet("/exemptionsreq")
|
return restGet("/exemptionsreq")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function editEquivalenceState(id, newstate){
|
||||||
|
return restPatch("/request/registerequiv/"+id+"/"+newstate)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user