Compare commits
	
		
			47 Commits
		
	
	
		
			tonitch/ma
			...
			7a05fc1316
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 7a05fc1316 | |||
| 821377a72f | |||
| 388c53e47b | |||
| 87b02af68e | |||
| f184de21a8 | |||
| 63d0087d0c | |||
| eacdf8d47a | |||
| 1498cfa11e | |||
| 17cb969160 | |||
| 4720669c2c | |||
| 5e9eccc4f6 | |||
| 8650482d11 | |||
| 783cd8fa9f | |||
| 40186f9898 | |||
| b7a729c899 | |||
| fdf4993def | |||
| dad6953f99 | |||
| f99ed470f8 | |||
| 9a83d14aea | |||
| 76c3b76153 | |||
| 0cbe0dd82b | |||
| 3167d1f2fc | |||
| a94167c8a0 | |||
| d31547c4cc | |||
| ec2b975467 | |||
| 
						
						
							
						
						5bb7606721
	
				 | 
					
					
						|||
| 
						
						
							
						
						b049c46571
	
				 | 
					
					
						|||
| 05359d64ac | |||
| 
						
						
							
						
						7ca5c34afe
	
				 | 
					
					
						|||
| 
						
						
							
						
						2b9bdf8dac
	
				 | 
					
					
						|||
| 
						
						
							
						
						ccb954e348
	
				 | 
					
					
						|||
| 
						
						
							
						
						ce56e37a33
	
				 | 
					
					
						|||
| 
						
						
							
						
						1c61a356a4
	
				 | 
					
					
						|||
| 
						
						
							
						
						2bdffe6ab4
	
				 | 
					
					
						|||
| 
						
						
							
						
						729d1ad504
	
				 | 
					
					
						|||
| 
						
						
							
						
						1522d74ed3
	
				 | 
					
					
						|||
| 
						
						
							
						
						b4499e04c7
	
				 | 
					
					
						|||
| 
						
						
							
						
						914f6bdf36
	
				 | 
					
					
						|||
| 
						
						
							
						
						66e7fa24a1
	
				 | 
					
					
						|||
| 
						
						
							
						
						7b9f021c24
	
				 | 
					
					
						|||
| 
						
						
							
						
						2dfa0a0ee0
	
				 | 
					
					
						|||
| 9e0db361b8 | |||
| 7a13d412f1 | |||
| 9de4b06e75 | |||
| 123fa97611 | |||
| 1fad792be7 | |||
| 
						
						
							
						
						acd1262955
	
				 | 
					
					
						
@ -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());
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,51 @@
 | 
				
			|||||||
 | 
					package ovh.herisson.Clyde.DTO.ScientificPublications;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/******************************************************
 | 
				
			||||||
 | 
					 * @file ResearchDTO.java
 | 
				
			||||||
 | 
					 * @author Bartha Maxime
 | 
				
			||||||
 | 
					 * @scope Publications Scientifiques
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Research format to return to front (without author's password)
 | 
				
			||||||
 | 
					 ******************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.ScientificPublications.Access;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.ScientificPublications.PaperType;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.ScientificPublications.Research;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.Date;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Data
 | 
				
			||||||
 | 
					public class ResearchDTO {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private long id;
 | 
				
			||||||
 | 
					    private String title;
 | 
				
			||||||
 | 
					    private ResearcherDTO researcher;
 | 
				
			||||||
 | 
					    private Date releaseDate;
 | 
				
			||||||
 | 
					    private PaperType paperType;
 | 
				
			||||||
 | 
					    private String pdfLocation;
 | 
				
			||||||
 | 
					    private String language;
 | 
				
			||||||
 | 
					    private Access access;
 | 
				
			||||||
 | 
					    private String domain;
 | 
				
			||||||
 | 
					    private String summary;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private ResearchDTO(String title, ResearcherDTO researcherDTO, Date releaseDate, PaperType paperType, String pdfLocation, String language, Access access, String domain, String summary, long id) {
 | 
				
			||||||
 | 
					        this.title = title;
 | 
				
			||||||
 | 
					        this.researcher = researcherDTO;
 | 
				
			||||||
 | 
					        this.releaseDate = releaseDate;
 | 
				
			||||||
 | 
					        this.paperType = paperType;
 | 
				
			||||||
 | 
					        this.pdfLocation = pdfLocation;
 | 
				
			||||||
 | 
					        this.language = language;
 | 
				
			||||||
 | 
					        this.access = access;
 | 
				
			||||||
 | 
					        this.domain = domain;
 | 
				
			||||||
 | 
					        this.summary = summary;
 | 
				
			||||||
 | 
					        this.id = id;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static ResearchDTO construct(Research research){
 | 
				
			||||||
 | 
					        return new ResearchDTO(research.getTitle(), ResearcherDTO.construct(research.getAuthor()), research.getReleaseDate(),
 | 
				
			||||||
 | 
					                research.getPaperType(),research.getPdfLocation(),research.getLanguage(),research.getAccess(),
 | 
				
			||||||
 | 
					                research.getDomain(), research.getSummary(), research.getId());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,38 @@
 | 
				
			|||||||
 | 
					package ovh.herisson.Clyde.DTO.ScientificPublications;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/******************************************************
 | 
				
			||||||
 | 
					 * @file ResearcherDTO.java
 | 
				
			||||||
 | 
					 * @author Bartha Maxime
 | 
				
			||||||
 | 
					 * @scope Publications Scientifiques
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Researcher Format to return to front (without user password)
 | 
				
			||||||
 | 
					 ******************************************************/
 | 
				
			||||||
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Services.ProtectionService;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.ScientificPublications.Researcher;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Data
 | 
				
			||||||
 | 
					public class ResearcherDTO {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private long id;
 | 
				
			||||||
 | 
					    private Map<String,Object> user;
 | 
				
			||||||
 | 
					    private String site;
 | 
				
			||||||
 | 
					    private String domain;
 | 
				
			||||||
 | 
					    private String orcidId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private ResearcherDTO(long id, Map<String ,Object> user, String site,String domain,String orcidId){
 | 
				
			||||||
 | 
					        this.domain = domain;
 | 
				
			||||||
 | 
					        this.orcidId = orcidId;
 | 
				
			||||||
 | 
					        this.site = site;
 | 
				
			||||||
 | 
					        this.user = user;
 | 
				
			||||||
 | 
					        this.id = id;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static ResearcherDTO construct(Researcher researcher){
 | 
				
			||||||
 | 
					        return new ResearcherDTO(researcher.getId(), ProtectionService.userWithoutPassword(researcher.getUser()),researcher.getSite(),
 | 
				
			||||||
 | 
					                researcher.getDomain(),researcher.getOrcidId());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -5,7 +5,13 @@ import org.springframework.web.bind.annotation.*;
 | 
				
			|||||||
import ovh.herisson.Clyde.Repositories.TokenRepository;
 | 
					import ovh.herisson.Clyde.Repositories.TokenRepository;
 | 
				
			||||||
import ovh.herisson.Clyde.Repositories.UserRepository;
 | 
					import ovh.herisson.Clyde.Repositories.UserRepository;
 | 
				
			||||||
import ovh.herisson.Clyde.Services.*;
 | 
					import ovh.herisson.Clyde.Services.*;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Services.ScientificPublications.ResearchesService;
 | 
				
			||||||
import ovh.herisson.Clyde.Tables.*;
 | 
					import ovh.herisson.Clyde.Tables.*;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.ScientificPublications.Access;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.ScientificPublications.PaperType;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.ScientificPublications.Research;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.ScientificPublications.Researcher;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.ArrayList;
 | 
					import java.util.ArrayList;
 | 
				
			||||||
import java.util.Arrays;
 | 
					import java.util.Arrays;
 | 
				
			||||||
import java.util.Date;
 | 
					import java.util.Date;
 | 
				
			||||||
@ -24,10 +30,12 @@ public class MockController {
 | 
				
			|||||||
    public final CourseService courseService;
 | 
					    public final CourseService courseService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public final InscriptionService inscriptionService;
 | 
					    public final InscriptionService inscriptionService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public final ResearchesService researchesService;
 | 
				
			||||||
    ArrayList<User> mockUsers;
 | 
					    ArrayList<User> mockUsers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public MockController(UserRepository userRepo, TokenRepository tokenRepo, TokenService tokenService, CurriculumCourseService CurriculumCourseService, CurriculumService curriculumService, CourseService courseService, InscriptionService inscriptionService){
 | 
					    public MockController(UserRepository userRepo, TokenRepository tokenRepo, TokenService tokenService, CurriculumCourseService CurriculumCourseService, CurriculumService curriculumService, CourseService courseService, InscriptionService inscriptionService, ResearchesService researchesService){
 | 
				
			||||||
        this.tokenRepo = tokenRepo;
 | 
					        this.tokenRepo = tokenRepo;
 | 
				
			||||||
        this.userRepo = userRepo;
 | 
					        this.userRepo = userRepo;
 | 
				
			||||||
        this.tokenService = tokenService;
 | 
					        this.tokenService = tokenService;
 | 
				
			||||||
@ -35,6 +43,7 @@ public class MockController {
 | 
				
			|||||||
        this.curriculumService = curriculumService;
 | 
					        this.curriculumService = curriculumService;
 | 
				
			||||||
        this.courseService = courseService;
 | 
					        this.courseService = courseService;
 | 
				
			||||||
        this.inscriptionService = inscriptionService;
 | 
					        this.inscriptionService = inscriptionService;
 | 
				
			||||||
 | 
					        this.researchesService = researchesService;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /** Saves an example of each user type by :
 | 
					    /** Saves an example of each user type by :
 | 
				
			||||||
@ -96,6 +105,30 @@ public class MockController {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        inscriptionService.save(inscriptionRequest);
 | 
					        inscriptionService.save(inscriptionRequest);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        ///////////////////////////
 | 
				
			||||||
 | 
					        // extension Publications Scientifiques
 | 
				
			||||||
 | 
					        Researcher jojoResearcherAccount = new Researcher(jojo,"3363-22555-AB33-T",null,"IT");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Researcher output = researchesService.saveResearcher(jojoResearcherAccount);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Research jojoResearch = new Research("Graphs : Advanced Search Algorithms",output,new Date(0),
 | 
				
			||||||
 | 
					                PaperType.Article,"here.pdf",null,"english",
 | 
				
			||||||
 | 
					                Access.OpenSource,"IT","This Article's title speaks for itself \n We'll discuss about advanced Graph search Algorithms");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Research restrictedResearch = new Research("just another Name",output,new Date(1111111111),
 | 
				
			||||||
 | 
					                PaperType.Article,"restricted",null,"english",
 | 
				
			||||||
 | 
					                Access.Restricted,"Restricted","This Article's title speaks for itself\n We'll discuss about advanced Graph search Algorithms");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Research privateResearch = new Research("the great Potato War",output,new Date(),
 | 
				
			||||||
 | 
					                PaperType.Article,"private",null,"english",
 | 
				
			||||||
 | 
					                Access.Private,"private","This Article's title speaks for itself\n We'll discuss about advanced Graph search Algorithms");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        researchesService.saveResearch(restrictedResearch);
 | 
				
			||||||
 | 
					        researchesService.saveResearch(privateResearch);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        researchesService.saveResearch(jojoResearch);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -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);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,240 @@
 | 
				
			|||||||
 | 
					package ovh.herisson.Clyde.EndPoints.ScientificPublications;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/******************************************************
 | 
				
			||||||
 | 
					 * @file ResearchController.java
 | 
				
			||||||
 | 
					 * @author Bartha Maxime
 | 
				
			||||||
 | 
					 * @scope Publications Scientifiques
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * API class for the researches
 | 
				
			||||||
 | 
					 ******************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import lombok.AllArgsConstructor;
 | 
				
			||||||
 | 
					import org.springframework.http.HttpStatus;
 | 
				
			||||||
 | 
					import org.springframework.http.ResponseEntity;
 | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.*;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.DTO.ScientificPublications.ResearchDTO;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.DTO.ScientificPublications.ResearcherDTO;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Responses.UnauthorizedResponse;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Services.AuthenticatorService;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Services.ScientificPublications.ResearchesService;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.Role;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.ScientificPublications.Research;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.ScientificPublications.Researcher;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.ArrayList;
 | 
				
			||||||
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@RestController
 | 
				
			||||||
 | 
					@CrossOrigin(originPatterns = "*", allowCredentials = "true")
 | 
				
			||||||
 | 
					@AllArgsConstructor
 | 
				
			||||||
 | 
					public class ResearchController {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   private final ResearchesService researchesServ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   private final AuthenticatorService authServ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** Is accessible by anyone
 | 
				
			||||||
 | 
					     * but if the user doesn't have the permission to download the research
 | 
				
			||||||
 | 
					     * the return Research Download URL will be null
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @GetMapping("/research/{id}")
 | 
				
			||||||
 | 
					    public ResponseEntity<ResearchDTO> getResearch(@RequestHeader(value = "Authorization", required = false) String token, @PathVariable long id){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Research research = researchesServ.getResearchById(id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (research == null)
 | 
				
			||||||
 | 
					            return new ResponseEntity<>(HttpStatus.NOT_FOUND);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (researchesServ.hasNoAccessTo(research,authServ.getUserFromToken(token))){
 | 
				
			||||||
 | 
					           research.setPdfLocation(null);
 | 
				
			||||||
 | 
					        }// If the user doesn't have access to the document he can't download the pdf
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return new ResponseEntity<>(ResearchDTO.construct(research), HttpStatus.OK);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * @param token  used to know if the user can download or not the research pdf
 | 
				
			||||||
 | 
					     * @return every research
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @GetMapping("/researches")
 | 
				
			||||||
 | 
					    public ResponseEntity<Iterable<ResearchDTO>> getResearches(@RequestHeader(value = "Authorization",required = false) String token){
 | 
				
			||||||
 | 
					        Iterable<Research> researches = researchesServ.getAllResearches();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        ArrayList<ResearchDTO> toReturnResearches = new ArrayList<>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        for (Research research: researches){
 | 
				
			||||||
 | 
					            if (researchesServ.hasNoAccessTo(research,authServ.getUserFromToken(token))){
 | 
				
			||||||
 | 
					                research.setPdfLocation(null);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            toReturnResearches.add(ResearchDTO.construct(research));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return new ResponseEntity<>(toReturnResearches,HttpStatus.OK);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @GetMapping("/researches/{id}")
 | 
				
			||||||
 | 
					    public ResponseEntity<Iterable<ResearchDTO>> getResearchesFromResearcher(@RequestHeader(value = "Authorization",required = false) String token,
 | 
				
			||||||
 | 
					                                                                             @PathVariable Long id
 | 
				
			||||||
 | 
					    ){
 | 
				
			||||||
 | 
					        Iterable<Research> researches = researchesServ.getResearchesByAuthor(id);
 | 
				
			||||||
 | 
					        if (researches == null) return new ResponseEntity<>(HttpStatus.NOT_FOUND);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        ArrayList<ResearchDTO> toReturnResearches = new ArrayList<>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        for (Research research: researches){
 | 
				
			||||||
 | 
					            if (researchesServ.hasNoAccessTo(research,authServ.getUserFromToken(token))){
 | 
				
			||||||
 | 
					                research.setPdfLocation(null);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            toReturnResearches.add(ResearchDTO.construct(research));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return new ResponseEntity<>(toReturnResearches,HttpStatus.OK);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** post a new research
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return the research saved
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @PostMapping("/research")
 | 
				
			||||||
 | 
					    public ResponseEntity<Research> postResearch(@RequestHeader("Authorization") String token, @RequestBody Research research){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (authServ.isNotIn(new Role[]{Role.Admin},token) &&
 | 
				
			||||||
 | 
					                researchesServ.getResearcherByUser(authServ.getUserFromToken(token)) == null){
 | 
				
			||||||
 | 
					            return new UnauthorizedResponse<>(null);
 | 
				
			||||||
 | 
					        } // if the poster isn't a researcher
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return new ResponseEntity<>(researchesServ.saveResearch(research), HttpStatus.OK);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** post updates to the research
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @PatchMapping("/research/{id}")
 | 
				
			||||||
 | 
					    public ResponseEntity<String> patchResearch(@RequestHeader("Authorization") String token,
 | 
				
			||||||
 | 
					                                          @RequestBody Map<String,Object> updates,
 | 
				
			||||||
 | 
					                                          @PathVariable long id
 | 
				
			||||||
 | 
					                                          )
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        Research research = researchesServ.getResearchById(id);
 | 
				
			||||||
 | 
					        Researcher researcher = researchesServ.getResearcherByUser(authServ.getUserFromToken(token));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (research == null)
 | 
				
			||||||
 | 
					            return new ResponseEntity<>(HttpStatus.NOT_FOUND);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary},token) &&
 | 
				
			||||||
 | 
					                researcher != research.getAuthor()) {
 | 
				
			||||||
 | 
					            return new UnauthorizedResponse<>(null);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      researchesServ.modifyResearchData(research, updates);
 | 
				
			||||||
 | 
					      return new ResponseEntity<>(HttpStatus.OK);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** Only Admin, Secretary and author can delete a research
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @DeleteMapping("/research/{id}")
 | 
				
			||||||
 | 
					    public ResponseEntity<String> deleteResearch(@RequestHeader("Authorization") String token, @PathVariable long id){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Research research = researchesServ.getResearchById(id);
 | 
				
			||||||
 | 
					        Researcher researcher = researchesServ.getResearcherByUser(authServ.getUserFromToken(token));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (research == null)
 | 
				
			||||||
 | 
					            return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (authServ.isNotIn(new Role[]{Role.Admin, Role.Secretary},token) &&
 | 
				
			||||||
 | 
					                researcher != research.getAuthor()){
 | 
				
			||||||
 | 
					            return new UnauthorizedResponse<>(null);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        researchesServ.deleteResearch(research);
 | 
				
			||||||
 | 
					        return new ResponseEntity<>(HttpStatus.OK);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /////////////
 | 
				
			||||||
 | 
					    // Co-authors Part
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** get all the co-authors in a research
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param id the research id
 | 
				
			||||||
 | 
					     * @return all the co-authors associated with the research
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @GetMapping("/research/{id}/co-authors")
 | 
				
			||||||
 | 
					    public  ResponseEntity<Iterable<ResearcherDTO>> getCoAuthors(@PathVariable long id){
 | 
				
			||||||
 | 
					       Research research = researchesServ.getResearchById(id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					       if (research == null) return new ResponseEntity<>(HttpStatus.NOT_FOUND);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					       Iterable<Researcher> researchers= researchesServ.getCoAuthors(research);
 | 
				
			||||||
 | 
					       ArrayList<ResearcherDTO> toReturn = new ArrayList<>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					       for (Researcher researcher: researchers){
 | 
				
			||||||
 | 
					           toReturn.add(ResearcherDTO.construct(researcher));
 | 
				
			||||||
 | 
					       }
 | 
				
			||||||
 | 
					       return new ResponseEntity<>(toReturn,HttpStatus.OK);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** post co-authors to the research
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param token the Authorization header
 | 
				
			||||||
 | 
					     * @param researchersId the co-authors ids
 | 
				
			||||||
 | 
					     * @param id the research id
 | 
				
			||||||
 | 
					     * @return the added researchers
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @PostMapping("/research/{id}/co-authors")
 | 
				
			||||||
 | 
					    public ResponseEntity<Iterable<ResearcherDTO>> postCoAuthor(@RequestHeader("Authorization") String token,
 | 
				
			||||||
 | 
					                                                              @RequestBody Iterable<Long> researchersId,
 | 
				
			||||||
 | 
					                                                              @PathVariable long id)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        Research research = researchesServ.getResearchById(id);
 | 
				
			||||||
 | 
					        if (research == null) return new ResponseEntity<>(HttpStatus.NOT_FOUND);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (authServ.isNotIn(new Role[]{Role.Admin}, token) || research.getAuthor() != researchesServ.getResearcherByUser(authServ.getUserFromToken(token)))
 | 
				
			||||||
 | 
					            return new UnauthorizedResponse<>(null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (!researchesServ.saveCoAuthors(researchersId,research))
 | 
				
			||||||
 | 
					            return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        ArrayList<ResearcherDTO> toReturn = new ArrayList<>();
 | 
				
			||||||
 | 
					        for (Long reId: researchersId){
 | 
				
			||||||
 | 
					            toReturn.add(ResearcherDTO.construct(researchesServ.getResearcherById(reId)));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return  new ResponseEntity<>(toReturn,HttpStatus.OK);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** deletes the co-author with *coAuthorId* from the research with the *researchId*
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @DeleteMapping("/research/{researchId}/co-author/{coAuthorId}")
 | 
				
			||||||
 | 
					    public ResponseEntity<String> deleteCoAuthor(@RequestHeader("Authorization") String token,
 | 
				
			||||||
 | 
					                                                 @PathVariable long researchId,
 | 
				
			||||||
 | 
					                                                 @PathVariable long coAuthorId)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        Research research = researchesServ.getResearchById(researchId);
 | 
				
			||||||
 | 
					        Researcher coAuthor = researchesServ.getResearcherById(coAuthorId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (authServ.isNotIn(new Role[]{Role.Admin}, token) || research.getAuthor() != researchesServ.getResearcherByUser(authServ.getUserFromToken(token)))
 | 
				
			||||||
 | 
					            return new UnauthorizedResponse<>(null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (coAuthor == null) return new ResponseEntity<>(HttpStatus.NOT_FOUND);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					       if (!researchesServ.deleteCoAuthor(research, coAuthor))
 | 
				
			||||||
 | 
					           return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return new ResponseEntity<>(HttpStatus.OK);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ///////
 | 
				
			||||||
 | 
					    //views part
 | 
				
			||||||
 | 
					    @PostMapping("/addView/{url}")
 | 
				
			||||||
 | 
					    public ResponseEntity<ResearchDTO> addView(@PathVariable String url){
 | 
				
			||||||
 | 
					        Research research = researchesServ.getResearchByUrl(url);
 | 
				
			||||||
 | 
					        if (research ==null) return new ResponseEntity<>(HttpStatus.NOT_FOUND);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return new ResponseEntity<>(ResearchDTO.construct(researchesServ.addView(research)), HttpStatus.OK);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,91 @@
 | 
				
			|||||||
 | 
					package ovh.herisson.Clyde.EndPoints.ScientificPublications;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/******************************************************
 | 
				
			||||||
 | 
					 * @file ResearcherController.java
 | 
				
			||||||
 | 
					 * @author Bartha Maxime
 | 
				
			||||||
 | 
					 * @scope Publications Scientifiques
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * API class for the researchers
 | 
				
			||||||
 | 
					 ******************************************************/
 | 
				
			||||||
 | 
					import lombok.AllArgsConstructor;
 | 
				
			||||||
 | 
					import org.springframework.http.HttpStatus;
 | 
				
			||||||
 | 
					import org.springframework.http.ResponseEntity;
 | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.*;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.DTO.ScientificPublications.ResearcherDTO;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Responses.UnauthorizedResponse;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Services.AuthenticatorService;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Services.ScientificPublications.ResearchesService;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.Role;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.ScientificPublications.Researcher;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.ArrayList;
 | 
				
			||||||
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@RestController
 | 
				
			||||||
 | 
					@CrossOrigin(originPatterns = "*", allowCredentials = "true")
 | 
				
			||||||
 | 
					@AllArgsConstructor
 | 
				
			||||||
 | 
					public class ResearcherController {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ResearchesService researchesServ;
 | 
				
			||||||
 | 
					    AuthenticatorService authServ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @GetMapping("/researcher/{id}")
 | 
				
			||||||
 | 
					    public ResponseEntity<ResearcherDTO> getResearcher(@PathVariable long id){
 | 
				
			||||||
 | 
					        Researcher researcher = researchesServ.getResearcherById(id);
 | 
				
			||||||
 | 
					        return new ResponseEntity<>(ResearcherDTO.construct(researcher),HttpStatus.OK);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Everyone can access every researcher Account
 | 
				
			||||||
 | 
					     * @return all the researchers accounts
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @GetMapping("/researchers")
 | 
				
			||||||
 | 
					    public ResponseEntity<Iterable<ResearcherDTO>> getAllResearchers(){
 | 
				
			||||||
 | 
					        Iterable<Researcher> researchers = researchesServ.getAllResearchers();
 | 
				
			||||||
 | 
					        ArrayList<ResearcherDTO> toReturnResearchersDTO = new ArrayList<>();
 | 
				
			||||||
 | 
					        for (Researcher researcher: researchers){
 | 
				
			||||||
 | 
					            toReturnResearchersDTO.add(ResearcherDTO.construct(researcher));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return new ResponseEntity<>(toReturnResearchersDTO, HttpStatus.OK);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @PostMapping("/researcher")
 | 
				
			||||||
 | 
					    public ResponseEntity<ResearcherDTO> postResearcher(@RequestHeader("Authorization") String token, @RequestBody Researcher researcher){
 | 
				
			||||||
 | 
					        if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary}, token)){
 | 
				
			||||||
 | 
					            return new UnauthorizedResponse<>(null);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Researcher posted = researchesServ.saveResearcher(researcher);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (posted == null) return new ResponseEntity<>(null, HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return new ResponseEntity<>(ResearcherDTO.construct(posted), HttpStatus.CREATED);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @PatchMapping("/researcher/{id}")
 | 
				
			||||||
 | 
					    public ResponseEntity<ResearcherDTO> patchResearcher(@RequestHeader("Authorization") String token,
 | 
				
			||||||
 | 
					                                                         @PathVariable long id,
 | 
				
			||||||
 | 
					                                                         @RequestBody Map<String ,Object> updates){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Researcher researcher = researchesServ.getResearcherById(id);
 | 
				
			||||||
 | 
					        if (authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin}, token)
 | 
				
			||||||
 | 
					                || researcher == researchesServ.getResearcherByUser(authServ.getUserFromToken(token)))
 | 
				
			||||||
 | 
					            return new UnauthorizedResponse<>(null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (researcher == null) return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        researchesServ.modifyResearcherData(researcher,updates);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return new ResponseEntity<>(ResearcherDTO.construct(researcher),HttpStatus.OK);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @DeleteMapping("/researcher/{id}")
 | 
				
			||||||
 | 
					    public ResponseEntity<String> deleteResearcher(@RequestHeader ("Authorization") String token, @PathVariable long id){
 | 
				
			||||||
 | 
					       if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary},token))
 | 
				
			||||||
 | 
					           return new UnauthorizedResponse<>(null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					       researchesServ.deleteResearcher(researchesServ.getResearcherById(id));
 | 
				
			||||||
 | 
					       return new ResponseEntity<>(HttpStatus.OK);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,40 @@
 | 
				
			|||||||
 | 
					package ovh.herisson.Clyde.EndPoints.ScientificPublications;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import lombok.AllArgsConstructor;
 | 
				
			||||||
 | 
					import org.springframework.http.HttpStatus;
 | 
				
			||||||
 | 
					import org.springframework.http.ResponseEntity;
 | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.*;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Services.ScientificPublications.ResearchesService;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Services.ScientificPublications.StatisticsService;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.ScientificPublications.Researcher;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@RestController
 | 
				
			||||||
 | 
					@CrossOrigin(originPatterns = "*", allowCredentials = "true")
 | 
				
			||||||
 | 
					@AllArgsConstructor
 | 
				
			||||||
 | 
					public class StatController {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private StatisticsService statServ;
 | 
				
			||||||
 | 
					    private ResearchesService researchesServ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** returns all the statistics in a 2D array
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param id the researcher's id
 | 
				
			||||||
 | 
					     * @return all the stats in a 2D array
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @GetMapping("/stats/{id}")
 | 
				
			||||||
 | 
					    public ResponseEntity<Iterable<Iterable<Map<String, Integer>>>> getStat(@PathVariable Long id){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Researcher researcher = researchesServ.getResearcherById(id);
 | 
				
			||||||
 | 
					        if (researcher == null) return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Iterable<Iterable<Map<String,Integer>>> stats = statServ.generateStats(researcher);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (stats == null) return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return new ResponseEntity<>(stats,HttpStatus.OK);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -96,7 +96,7 @@ public class UserController {
 | 
				
			|||||||
        if (poster == null) {return new UnauthorizedResponse<>("bad token");}
 | 
					        if (poster == null) {return new UnauthorizedResponse<>("bad token");}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!userService.modifyData(id, updates, poster))
 | 
					        if (!userService.modifyData(id, updates, poster))
 | 
				
			||||||
            return new UnauthorizedResponse<>("there was an issue with the updates requested");
 | 
					            return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return new ResponseEntity<>(null, HttpStatus.OK);
 | 
					        return new ResponseEntity<>(null, HttpStatus.OK);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -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> {}
 | 
				
			||||||
@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					package ovh.herisson.Clyde.Repositories.ScientificPublications;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.springframework.data.jpa.repository.Query;
 | 
				
			||||||
 | 
					import org.springframework.data.repository.CrudRepository;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.Course;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.Curriculum;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.ScientificPublications.Research;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.ScientificPublications.ResearchCoAuthors;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.ScientificPublications.Researcher;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public interface ResearchCoAuthorsRepository extends CrudRepository<ResearchCoAuthors,Long> {
 | 
				
			||||||
 | 
					   @Query("select distinct rca.coAuthor from ResearchCoAuthors rca where rca.research = ?1")
 | 
				
			||||||
 | 
					   Iterable<Researcher> findResearchCoAuthors(Research research);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   @Query("select rca from ResearchCoAuthors rca where rca.research = ?1 and rca.coAuthor =?2")
 | 
				
			||||||
 | 
					  ResearchCoAuthors findResearchCoAuthors(Research research, Researcher researcher);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,17 @@
 | 
				
			|||||||
 | 
					package ovh.herisson.Clyde.Repositories.ScientificPublications;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.springframework.data.repository.CrudRepository;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.ScientificPublications.Research;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.ScientificPublications.Researcher;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public interface ResearchRepository extends CrudRepository<Research,Long> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Research findById(long id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Iterable<Research> findByAuthor(Researcher author);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Research findByPdfLocation(String url);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,16 @@
 | 
				
			|||||||
 | 
					package ovh.herisson.Clyde.Repositories.ScientificPublications;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.springframework.data.jpa.repository.Query;
 | 
				
			||||||
 | 
					import org.springframework.data.repository.CrudRepository;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.ScientificPublications.Research;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.ScientificPublications.Researcher;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.User;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public interface ResearcherRepository extends CrudRepository<Researcher,Long> {
 | 
				
			||||||
 | 
					    Researcher findByUser(User user);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Researcher findById(long id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Query("select r from Research r where r.author = ?1")
 | 
				
			||||||
 | 
					    Iterable<Research> findAllByAuthorId(Researcher author);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,40 @@
 | 
				
			|||||||
 | 
					package ovh.herisson.Clyde.Repositories.ScientificPublications;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.springframework.data.jpa.repository.Query;
 | 
				
			||||||
 | 
					import org.springframework.data.repository.CrudRepository;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.ScientificPublications.Research;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public interface StatsRepository extends CrudRepository<Research,Long> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Query("select new map(to_char(r.releaseDate, 'month') as label, sum(r.views) as y) from Research r group by to_char(r.releaseDate, 'month')")
 | 
				
			||||||
 | 
					    Iterable<Map<String ,Integer>> viewsByMonths();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Query("select new map(to_char(r.releaseDate,'YYYY') as label, sum  (r.views) as y) from Research r group by to_char(r.releaseDate,'YYYY')")
 | 
				
			||||||
 | 
					    Iterable<Map<String ,Integer>> viewsByYears();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Query("select new map(r.domain as label, sum(r.views) as y) from Research r group by r.domain")
 | 
				
			||||||
 | 
					    Iterable<Map<String ,Integer>> viewsByTopics();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Query("select new map(r.domain as label, count(r.language) as y) from Research r group by r.domain")
 | 
				
			||||||
 | 
					    Iterable<Map<String ,Integer>> languageByTopics();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Query("select new map(to_char(r.releaseDate,'YYYY') as label,  count(r.language) as y) from Research r group by to_char(r.releaseDate,'YYYY')")
 | 
				
			||||||
 | 
					    Iterable<Map<String ,Integer>> languageByYears();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Query("select new map(to_char(r.releaseDate, 'month') as label, count(r.language) as y) from Research r group by to_char(r.releaseDate, 'month')")
 | 
				
			||||||
 | 
					    Iterable<Map<String ,Integer>> languageByMonths();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Query("select new map(to_char(r.releaseDate,'YYYY') as label, count(r) as y) from Research r group by to_char(r.releaseDate,'YYYY')")
 | 
				
			||||||
 | 
					    Iterable<Map<String ,Integer>> researchesByYears();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Query("select new map(r.domain as label, count(r) as y) from Research r group by r.domain")
 | 
				
			||||||
 | 
					    Iterable<Map<String ,Integer>> researchesByTopics();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Query("select new map(to_char(r.releaseDate, 'month') as label, count(r) as y) from Research r group by to_char(r.releaseDate, 'month')")
 | 
				
			||||||
 | 
					    Iterable<Map<String ,Integer>> researchesByMonth();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -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);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,199 @@
 | 
				
			|||||||
 | 
					package ovh.herisson.Clyde.Services.ScientificPublications;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import lombok.AllArgsConstructor;
 | 
				
			||||||
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.DTO.ScientificPublications.ResearchDTO;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Repositories.ScientificPublications.ResearchCoAuthorsRepository;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Repositories.ScientificPublications.ResearchRepository;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Repositories.ScientificPublications.ResearcherRepository;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.Role;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.ScientificPublications.*;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.User;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.ArrayList;
 | 
				
			||||||
 | 
					import java.util.Date;
 | 
				
			||||||
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Service
 | 
				
			||||||
 | 
					@AllArgsConstructor
 | 
				
			||||||
 | 
					public class ResearchesService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private final ResearcherRepository researcherRepo;
 | 
				
			||||||
 | 
					    private final ResearchCoAuthorsRepository researchCoAuthorsRepo;
 | 
				
			||||||
 | 
					    private final ResearchRepository articleRepo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Researchers Part
 | 
				
			||||||
 | 
					    public Researcher getResearcherByUser(User user){
 | 
				
			||||||
 | 
					        return researcherRepo.findByUser(user);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public boolean isCoAuthor(Research research, Researcher researcher){
 | 
				
			||||||
 | 
					        Iterable<Researcher> coAuthors = researchCoAuthorsRepo.findResearchCoAuthors(research);
 | 
				
			||||||
 | 
					        for (Researcher coAuthor : coAuthors){
 | 
				
			||||||
 | 
					            if (researcher == coAuthor){
 | 
				
			||||||
 | 
					                return true;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // researches Part
 | 
				
			||||||
 | 
					    public Research getResearchById(long id) {
 | 
				
			||||||
 | 
					        return articleRepo.findById(id);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Iterable<Research> getResearchesByAuthor(long authorId){
 | 
				
			||||||
 | 
					        Researcher researcher = researcherRepo.findById(authorId);
 | 
				
			||||||
 | 
					        if (researcher == null) return null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return researcherRepo.findAllByAuthorId(researcher);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public boolean hasNoAccessTo(Research research, User user){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (research.getAccess() == Access.OpenSource) return false; // if the access is open source even non-users can see it
 | 
				
			||||||
 | 
					        if (user == null) return true; // else you need at least to be a user
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (user.getRole() == Role.Admin) return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (research.getAccess() == Access.Restricted &&
 | 
				
			||||||
 | 
					                user.getRole() == Role.Secretary ||
 | 
				
			||||||
 | 
					                user.getRole() == Role.Teacher || user.getRole() == Role.InscriptionService)
 | 
				
			||||||
 | 
					            return false; // if the access is restricted only the staff member (above) can access the research
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Researcher researcher = getResearcherByUser(user);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (researcher==null)
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return (research.getAccess() != Access.Private || research.getAuthor() != researcher) &&
 | 
				
			||||||
 | 
					                (research.getAccess() != Access.Private || !isCoAuthor(research, researcher));
 | 
				
			||||||
 | 
					        // if the researcher is the author or one of the co-authors of the research will return false
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Research saveResearch(Research research) {
 | 
				
			||||||
 | 
					        return articleRepo.save(research);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void modifyResearchData(Research research, Map<String, Object> updates) {
 | 
				
			||||||
 | 
					        for (Map.Entry<String, Object> entry : updates.entrySet()){
 | 
				
			||||||
 | 
					            switch (entry.getKey()){
 | 
				
			||||||
 | 
					                case "title":
 | 
				
			||||||
 | 
					                    research.setTitle((String) entry.getValue());
 | 
				
			||||||
 | 
					                    break;
 | 
				
			||||||
 | 
					                case "date":
 | 
				
			||||||
 | 
					                    research.setReleaseDate((Date) entry.getValue());
 | 
				
			||||||
 | 
					                    break;
 | 
				
			||||||
 | 
					                case "paperType":
 | 
				
			||||||
 | 
					                    research.setPaperType((PaperType) entry.getValue());
 | 
				
			||||||
 | 
					                    break;
 | 
				
			||||||
 | 
					                case "PdfLocation":
 | 
				
			||||||
 | 
					                    research.setPdfLocation((String) entry.getValue());
 | 
				
			||||||
 | 
					                    break;
 | 
				
			||||||
 | 
					                case "bibtexLocation":
 | 
				
			||||||
 | 
					                    research.setBibTexLocation((String) entry.getValue());
 | 
				
			||||||
 | 
					                    break;
 | 
				
			||||||
 | 
					                case "language":
 | 
				
			||||||
 | 
					                    research.setLanguage((String) entry.getValue());
 | 
				
			||||||
 | 
					                    break;
 | 
				
			||||||
 | 
					                case "domain":
 | 
				
			||||||
 | 
					                    research.setDomain((String) entry.getValue());
 | 
				
			||||||
 | 
					                    break;
 | 
				
			||||||
 | 
					                case "summary":
 | 
				
			||||||
 | 
					                    research.setSummary((String) entry.getValue());
 | 
				
			||||||
 | 
					                    break;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        articleRepo.save(research);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void deleteResearch(Research research) {
 | 
				
			||||||
 | 
					        articleRepo.delete(research);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Iterable<Research> getAllResearches() {
 | 
				
			||||||
 | 
					        return articleRepo.findAll();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Researcher saveResearcher(Researcher researcher) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (researcherRepo.findByUser(researcher.getUser()) != null) return null;
 | 
				
			||||||
 | 
					       return researcherRepo.save(researcher);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Iterable<Researcher> getAllResearchers() {
 | 
				
			||||||
 | 
					        return researcherRepo.findAll();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Researcher getResearcherById(long id) {
 | 
				
			||||||
 | 
					        return  researcherRepo.findById(id);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void deleteResearcher(Researcher researcher) {
 | 
				
			||||||
 | 
					       researcherRepo.delete(researcher);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public boolean saveCoAuthors(Iterable<Long> researchersId, Research research) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (researchersId == null) return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        ArrayList<Researcher> toAdd = new ArrayList<>();
 | 
				
			||||||
 | 
					        for (long researcherId : researchersId){
 | 
				
			||||||
 | 
					            Researcher researcher= researcherRepo.findById(researcherId);
 | 
				
			||||||
 | 
					            if (research== null){
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            if (!toAdd.contains(researcher))
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                toAdd.add(researcher);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        for (Researcher researcher: toAdd){
 | 
				
			||||||
 | 
					            researchCoAuthorsRepo.save(new ResearchCoAuthors(researcher,research));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return true;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Iterable<Researcher> getCoAuthors(Research research) {
 | 
				
			||||||
 | 
					        return researchCoAuthorsRepo.findResearchCoAuthors(research);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public boolean deleteCoAuthor(Research research,Researcher coAuthor) {
 | 
				
			||||||
 | 
					        ResearchCoAuthors result = researchCoAuthorsRepo.findResearchCoAuthors(research,coAuthor);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (result ==null)
 | 
				
			||||||
 | 
					            return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        researchCoAuthorsRepo.delete(result);
 | 
				
			||||||
 | 
					        return true;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void modifyResearcherData(Researcher researcher, Map<String, Object> updates) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        for (Map.Entry<String, Object> entry : updates.entrySet()){
 | 
				
			||||||
 | 
					            switch (entry.getKey()){
 | 
				
			||||||
 | 
					                case "orcidId":
 | 
				
			||||||
 | 
					                    researcher.setOrcidId((String) entry.getValue());
 | 
				
			||||||
 | 
					                    break;
 | 
				
			||||||
 | 
					                case "domain":
 | 
				
			||||||
 | 
					                    researcher.setDomain((String) entry.getValue());
 | 
				
			||||||
 | 
					                    break;
 | 
				
			||||||
 | 
					                case "site":
 | 
				
			||||||
 | 
					                    researcher.setSite((String) entry.getValue());
 | 
				
			||||||
 | 
					                    break;
 | 
				
			||||||
 | 
					           }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        researcherRepo.save(researcher);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Research getResearchByUrl(String url) {
 | 
				
			||||||
 | 
					        return articleRepo.findByPdfLocation(url);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Research addView(Research research) {
 | 
				
			||||||
 | 
					        research.setViews(research.getViews()+1);
 | 
				
			||||||
 | 
					        return articleRepo.save(research);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,45 @@
 | 
				
			|||||||
 | 
					package ovh.herisson.Clyde.Services.ScientificPublications;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import lombok.AllArgsConstructor;
 | 
				
			||||||
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Repositories.ScientificPublications.ResearchRepository;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Repositories.ScientificPublications.ResearcherRepository;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Repositories.ScientificPublications.StatsRepository;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.ScientificPublications.Research;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.ScientificPublications.Researcher;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.security.Key;
 | 
				
			||||||
 | 
					import java.util.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Service
 | 
				
			||||||
 | 
					@AllArgsConstructor
 | 
				
			||||||
 | 
					public class StatisticsService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private ResearchRepository articleRepo;
 | 
				
			||||||
 | 
					    private StatsRepository statsRepo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Iterable<Iterable<Map<String, Integer>>> generateStats(Researcher researcher){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Iterable<Research> researches = articleRepo.findByAuthor(researcher);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (researches == null) return null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        ArrayList<Iterable<Map<String,Integer>>> toReturn = new ArrayList<>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        toReturn.add(statsRepo.viewsByYears());
 | 
				
			||||||
 | 
					        toReturn.add(statsRepo.viewsByMonths());
 | 
				
			||||||
 | 
					        toReturn.add(statsRepo.viewsByTopics());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        toReturn.add(statsRepo.researchesByYears());
 | 
				
			||||||
 | 
					        toReturn.add(statsRepo.researchesByMonth());
 | 
				
			||||||
 | 
					        toReturn.add(statsRepo.researchesByTopics());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        toReturn.add(statsRepo.languageByYears());
 | 
				
			||||||
 | 
					        toReturn.add(statsRepo.languageByMonths());
 | 
				
			||||||
 | 
					        toReturn.add(statsRepo.languageByTopics());
 | 
				
			||||||
 | 
					        return toReturn;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -4,5 +4,7 @@ public enum FileType {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    ProfilePicture,
 | 
					    ProfilePicture,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    EducationCertificate
 | 
					    EducationCertificate,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Article,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -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;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,15 @@
 | 
				
			|||||||
 | 
					package ovh.herisson.Clyde.Tables.ScientificPublications;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/******************************************************
 | 
				
			||||||
 | 
					 * @file Access.java
 | 
				
			||||||
 | 
					 * @author Maxime Bartha
 | 
				
			||||||
 | 
					 * @scope Extension Publications scientifiques
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Access Type for the Articles
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 ******************************************************/
 | 
				
			||||||
 | 
					public enum Access {
 | 
				
			||||||
 | 
					    OpenSource, // everyone can see
 | 
				
			||||||
 | 
					    Restricted, // only Researchers and Staff Members (secretary, teachers and Inscription Service)
 | 
				
			||||||
 | 
					    Private, // only authors and co-authors
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,16 @@
 | 
				
			|||||||
 | 
					package ovh.herisson.Clyde.Tables.ScientificPublications;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/******************************************************
 | 
				
			||||||
 | 
					 * @file PaperType.java
 | 
				
			||||||
 | 
					 * @author Maxime Bartha
 | 
				
			||||||
 | 
					 * @scope Extension Publications scientifiques
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Type of the scientific paper
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 ******************************************************/
 | 
				
			||||||
 | 
					public enum PaperType {
 | 
				
			||||||
 | 
					    Article,
 | 
				
			||||||
 | 
					    Paper,
 | 
				
			||||||
 | 
					    Book,
 | 
				
			||||||
 | 
					    BookChapter,
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,68 @@
 | 
				
			|||||||
 | 
					package ovh.herisson.Clyde.Tables.ScientificPublications;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/******************************************************
 | 
				
			||||||
 | 
					 * @file Research.java
 | 
				
			||||||
 | 
					 * @author Maxime Bartha
 | 
				
			||||||
 | 
					 * @scope Extension Publications scientifiques
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Research entity
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 ******************************************************/
 | 
				
			||||||
 | 
					import jakarta.persistence.*;
 | 
				
			||||||
 | 
					import lombok.Getter;
 | 
				
			||||||
 | 
					import lombok.NoArgsConstructor;
 | 
				
			||||||
 | 
					import lombok.Setter;
 | 
				
			||||||
 | 
					import org.hibernate.annotations.CreationTimestamp;
 | 
				
			||||||
 | 
					import org.hibernate.annotations.OnDelete;
 | 
				
			||||||
 | 
					import org.hibernate.annotations.OnDeleteAction;
 | 
				
			||||||
 | 
					import java.util.Date;
 | 
				
			||||||
 | 
					@Getter
 | 
				
			||||||
 | 
					@Setter
 | 
				
			||||||
 | 
					@NoArgsConstructor
 | 
				
			||||||
 | 
					@Entity
 | 
				
			||||||
 | 
					public class Research {
 | 
				
			||||||
 | 
					    @Id
 | 
				
			||||||
 | 
					    @GeneratedValue(strategy = GenerationType.AUTO)
 | 
				
			||||||
 | 
					    private Long id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String title;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @ManyToOne(fetch = FetchType.EAGER)
 | 
				
			||||||
 | 
					    @OnDelete(action = OnDeleteAction.CASCADE)
 | 
				
			||||||
 | 
					    @JoinColumn(name ="Researcher")
 | 
				
			||||||
 | 
					    private Researcher author;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Column(nullable = false)
 | 
				
			||||||
 | 
					    private Date releaseDate;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private PaperType paperType;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String pdfLocation;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String bibTexLocation;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String language;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Access access;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String domain;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String summary;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private int views;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Research(String title, Researcher author, Date releaseDate, PaperType paperType,
 | 
				
			||||||
 | 
					                    String pdfLocation, String bibTexLocation, String language, Access access, String domain, String summary){
 | 
				
			||||||
 | 
					        this.author = author;
 | 
				
			||||||
 | 
					        this.title = title;
 | 
				
			||||||
 | 
					        this.releaseDate = releaseDate;
 | 
				
			||||||
 | 
					        this.paperType = paperType;
 | 
				
			||||||
 | 
					        this.pdfLocation = pdfLocation;
 | 
				
			||||||
 | 
					        this.bibTexLocation = bibTexLocation;
 | 
				
			||||||
 | 
					        this.language = language;
 | 
				
			||||||
 | 
					        this.access = access;
 | 
				
			||||||
 | 
					        this.domain = domain;
 | 
				
			||||||
 | 
					        this.summary = summary;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -0,0 +1,42 @@
 | 
				
			|||||||
 | 
					package ovh.herisson.Clyde.Tables.ScientificPublications;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/******************************************************
 | 
				
			||||||
 | 
					 * @file ResearchCoAuthors
 | 
				
			||||||
 | 
					 * @author Maxime Bartha
 | 
				
			||||||
 | 
					 * @scope Extension Publications scientifiques
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Co-Authors List entity (will be accessed by Articles)
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 ******************************************************/
 | 
				
			||||||
 | 
					import jakarta.persistence.*;
 | 
				
			||||||
 | 
					import lombok.AllArgsConstructor;
 | 
				
			||||||
 | 
					import lombok.Getter;
 | 
				
			||||||
 | 
					import lombok.NoArgsConstructor;
 | 
				
			||||||
 | 
					import lombok.Setter;
 | 
				
			||||||
 | 
					import org.hibernate.annotations.OnDelete;
 | 
				
			||||||
 | 
					import org.hibernate.annotations.OnDeleteAction;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Getter
 | 
				
			||||||
 | 
					@Setter
 | 
				
			||||||
 | 
					@NoArgsConstructor
 | 
				
			||||||
 | 
					@Entity
 | 
				
			||||||
 | 
					public class ResearchCoAuthors {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Id
 | 
				
			||||||
 | 
					    @GeneratedValue(strategy = GenerationType.AUTO)
 | 
				
			||||||
 | 
					    Long id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @ManyToOne(fetch = FetchType.EAGER)
 | 
				
			||||||
 | 
					    @JoinColumn(name = "Researcher")
 | 
				
			||||||
 | 
					    private Researcher coAuthor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @ManyToOne(fetch = FetchType.EAGER)
 | 
				
			||||||
 | 
					    @OnDelete(action = OnDeleteAction.CASCADE)
 | 
				
			||||||
 | 
					    @JoinColumn(name = "Article")
 | 
				
			||||||
 | 
					    private Research research;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public ResearchCoAuthors(Researcher coAuthor, Research research){
 | 
				
			||||||
 | 
					        this.coAuthor = coAuthor;
 | 
				
			||||||
 | 
					        this.research = research;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,39 @@
 | 
				
			|||||||
 | 
					package ovh.herisson.Clyde.Tables.ScientificPublications;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/******************************************************
 | 
				
			||||||
 | 
					 * @file Researcher.java
 | 
				
			||||||
 | 
					 * @author Maxime Bartha
 | 
				
			||||||
 | 
					 * @scope Extension Publications scientifiques
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Researcher entity
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 ******************************************************/
 | 
				
			||||||
 | 
					import jakarta.persistence.*;
 | 
				
			||||||
 | 
					import lombok.AllArgsConstructor;
 | 
				
			||||||
 | 
					import lombok.Getter;
 | 
				
			||||||
 | 
					import lombok.NoArgsConstructor;
 | 
				
			||||||
 | 
					import lombok.Setter;
 | 
				
			||||||
 | 
					import ovh.herisson.Clyde.Tables.User;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Getter
 | 
				
			||||||
 | 
					@Setter
 | 
				
			||||||
 | 
					@NoArgsConstructor
 | 
				
			||||||
 | 
					@Entity
 | 
				
			||||||
 | 
					public class Researcher {
 | 
				
			||||||
 | 
					    @Id
 | 
				
			||||||
 | 
					    @GeneratedValue(strategy = GenerationType.AUTO)
 | 
				
			||||||
 | 
					    private long id;
 | 
				
			||||||
 | 
					    @OneToOne(cascade=CascadeType.REMOVE, optional=true)
 | 
				
			||||||
 | 
					    private User user;
 | 
				
			||||||
 | 
					    private String orcidId;
 | 
				
			||||||
 | 
					    private String site;
 | 
				
			||||||
 | 
					    private String domain;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Researcher(User user, String orcidId, String site, String domain){
 | 
				
			||||||
 | 
					        this.user = user;
 | 
				
			||||||
 | 
					        this.orcidId = orcidId;
 | 
				
			||||||
 | 
					        this.site = site;
 | 
				
			||||||
 | 
					        this.domain = domain;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -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)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										89
									
								
								frontend/package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										89
									
								
								frontend/package-lock.json
									
									
									
										generated
									
									
									
								
							@ -9,6 +9,7 @@
 | 
				
			|||||||
      "version": "0.0.0",
 | 
					      "version": "0.0.0",
 | 
				
			||||||
      "dependencies": {
 | 
					      "dependencies": {
 | 
				
			||||||
        "@canvasjs/vue-charts": "^1.0.4",
 | 
					        "@canvasjs/vue-charts": "^1.0.4",
 | 
				
			||||||
 | 
					        "@vueuse/core": "^10.9.0",
 | 
				
			||||||
        "vite-plugin-top-level-await": "^1.4.1",
 | 
					        "vite-plugin-top-level-await": "^1.4.1",
 | 
				
			||||||
        "vue": "^3.4.15",
 | 
					        "vue": "^3.4.15",
 | 
				
			||||||
        "vue3-toastify": "^0.2.1"
 | 
					        "vue3-toastify": "^0.2.1"
 | 
				
			||||||
@ -768,6 +769,11 @@
 | 
				
			|||||||
      "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz",
 | 
				
			||||||
      "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw=="
 | 
					      "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw=="
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    "node_modules/@types/web-bluetooth": {
 | 
				
			||||||
 | 
					      "version": "0.0.20",
 | 
				
			||||||
 | 
					      "resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.20.tgz",
 | 
				
			||||||
 | 
					      "integrity": "sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow=="
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    "node_modules/@vitejs/plugin-vue": {
 | 
					    "node_modules/@vitejs/plugin-vue": {
 | 
				
			||||||
      "version": "5.0.4",
 | 
					      "version": "5.0.4",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-5.0.4.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-5.0.4.tgz",
 | 
				
			||||||
@ -881,6 +887,89 @@
 | 
				
			|||||||
      "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.19.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.19.tgz",
 | 
				
			||||||
      "integrity": "sha512-/KliRRHMF6LoiThEy+4c1Z4KB/gbPrGjWwJR+crg2otgrf/egKzRaCPvJ51S5oetgsgXLfc4Rm5ZgrKHZrtMSw=="
 | 
					      "integrity": "sha512-/KliRRHMF6LoiThEy+4c1Z4KB/gbPrGjWwJR+crg2otgrf/egKzRaCPvJ51S5oetgsgXLfc4Rm5ZgrKHZrtMSw=="
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    "node_modules/@vueuse/core": {
 | 
				
			||||||
 | 
					      "version": "10.9.0",
 | 
				
			||||||
 | 
					      "resolved": "https://registry.npmjs.org/@vueuse/core/-/core-10.9.0.tgz",
 | 
				
			||||||
 | 
					      "integrity": "sha512-/1vjTol8SXnx6xewDEKfS0Ra//ncg4Hb0DaZiwKf7drgfMsKFExQ+FnnENcN6efPen+1kIzhLQoGSy0eDUVOMg==",
 | 
				
			||||||
 | 
					      "dependencies": {
 | 
				
			||||||
 | 
					        "@types/web-bluetooth": "^0.0.20",
 | 
				
			||||||
 | 
					        "@vueuse/metadata": "10.9.0",
 | 
				
			||||||
 | 
					        "@vueuse/shared": "10.9.0",
 | 
				
			||||||
 | 
					        "vue-demi": ">=0.14.7"
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "funding": {
 | 
				
			||||||
 | 
					        "url": "https://github.com/sponsors/antfu"
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "node_modules/@vueuse/core/node_modules/vue-demi": {
 | 
				
			||||||
 | 
					      "version": "0.14.7",
 | 
				
			||||||
 | 
					      "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.7.tgz",
 | 
				
			||||||
 | 
					      "integrity": "sha512-EOG8KXDQNwkJILkx/gPcoL/7vH+hORoBaKgGe+6W7VFMvCYJfmF2dGbvgDroVnI8LU7/kTu8mbjRZGBU1z9NTA==",
 | 
				
			||||||
 | 
					      "hasInstallScript": true,
 | 
				
			||||||
 | 
					      "bin": {
 | 
				
			||||||
 | 
					        "vue-demi-fix": "bin/vue-demi-fix.js",
 | 
				
			||||||
 | 
					        "vue-demi-switch": "bin/vue-demi-switch.js"
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "engines": {
 | 
				
			||||||
 | 
					        "node": ">=12"
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "funding": {
 | 
				
			||||||
 | 
					        "url": "https://github.com/sponsors/antfu"
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "peerDependencies": {
 | 
				
			||||||
 | 
					        "@vue/composition-api": "^1.0.0-rc.1",
 | 
				
			||||||
 | 
					        "vue": "^3.0.0-0 || ^2.6.0"
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "peerDependenciesMeta": {
 | 
				
			||||||
 | 
					        "@vue/composition-api": {
 | 
				
			||||||
 | 
					          "optional": true
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "node_modules/@vueuse/metadata": {
 | 
				
			||||||
 | 
					      "version": "10.9.0",
 | 
				
			||||||
 | 
					      "resolved": "https://registry.npmjs.org/@vueuse/metadata/-/metadata-10.9.0.tgz",
 | 
				
			||||||
 | 
					      "integrity": "sha512-iddNbg3yZM0X7qFY2sAotomgdHK7YJ6sKUvQqbvwnf7TmaVPxS4EJydcNsVejNdS8iWCtDk+fYXr7E32nyTnGA==",
 | 
				
			||||||
 | 
					      "funding": {
 | 
				
			||||||
 | 
					        "url": "https://github.com/sponsors/antfu"
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "node_modules/@vueuse/shared": {
 | 
				
			||||||
 | 
					      "version": "10.9.0",
 | 
				
			||||||
 | 
					      "resolved": "https://registry.npmjs.org/@vueuse/shared/-/shared-10.9.0.tgz",
 | 
				
			||||||
 | 
					      "integrity": "sha512-Uud2IWncmAfJvRaFYzv5OHDli+FbOzxiVEQdLCKQKLyhz94PIyFC3CHcH7EDMwIn8NPtD06+PNbC/PiO0LGLtw==",
 | 
				
			||||||
 | 
					      "dependencies": {
 | 
				
			||||||
 | 
					        "vue-demi": ">=0.14.7"
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "funding": {
 | 
				
			||||||
 | 
					        "url": "https://github.com/sponsors/antfu"
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "node_modules/@vueuse/shared/node_modules/vue-demi": {
 | 
				
			||||||
 | 
					      "version": "0.14.7",
 | 
				
			||||||
 | 
					      "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.7.tgz",
 | 
				
			||||||
 | 
					      "integrity": "sha512-EOG8KXDQNwkJILkx/gPcoL/7vH+hORoBaKgGe+6W7VFMvCYJfmF2dGbvgDroVnI8LU7/kTu8mbjRZGBU1z9NTA==",
 | 
				
			||||||
 | 
					      "hasInstallScript": true,
 | 
				
			||||||
 | 
					      "bin": {
 | 
				
			||||||
 | 
					        "vue-demi-fix": "bin/vue-demi-fix.js",
 | 
				
			||||||
 | 
					        "vue-demi-switch": "bin/vue-demi-switch.js"
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "engines": {
 | 
				
			||||||
 | 
					        "node": ">=12"
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "funding": {
 | 
				
			||||||
 | 
					        "url": "https://github.com/sponsors/antfu"
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "peerDependencies": {
 | 
				
			||||||
 | 
					        "@vue/composition-api": "^1.0.0-rc.1",
 | 
				
			||||||
 | 
					        "vue": "^3.0.0-0 || ^2.6.0"
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "peerDependenciesMeta": {
 | 
				
			||||||
 | 
					        "@vue/composition-api": {
 | 
				
			||||||
 | 
					          "optional": true
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    "node_modules/agent-base": {
 | 
					    "node_modules/agent-base": {
 | 
				
			||||||
      "version": "7.1.0",
 | 
					      "version": "7.1.0",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz",
 | 
				
			||||||
 | 
				
			|||||||
@ -10,6 +10,7 @@
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
    "@canvasjs/vue-charts": "^1.0.4",
 | 
					    "@canvasjs/vue-charts": "^1.0.4",
 | 
				
			||||||
 | 
					    "@vueuse/core": "^10.9.0",
 | 
				
			||||||
    "vite-plugin-top-level-await": "^1.4.1",
 | 
					    "vite-plugin-top-level-await": "^1.4.1",
 | 
				
			||||||
    "vue": "^3.4.15",
 | 
					    "vue": "^3.4.15",
 | 
				
			||||||
    "vue3-toastify": "^0.2.1"
 | 
					    "vue3-toastify": "^0.2.1"
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										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>
 | 
				
			||||||
							
								
								
									
										158
									
								
								frontend/src/Apps/ScientificPublications/FilterComponent.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										158
									
								
								frontend/src/Apps/ScientificPublications/FilterComponent.vue
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,158 @@
 | 
				
			|||||||
 | 
					<!----------------------------------------------------
 | 
				
			||||||
 | 
						File:  ResearchComponent.vue
 | 
				
			||||||
 | 
						Author: Maxime Bartha
 | 
				
			||||||
 | 
						Scope: Extension Publicatons scientifiquess
 | 
				
			||||||
 | 
						Description: Pop Up for selecting search Filters
 | 
				
			||||||
 | 
					----------------------------------------------------->
 | 
				
			||||||
 | 
					<script setup>
 | 
				
			||||||
 | 
					import { ref } from "vue";
 | 
				
			||||||
 | 
					import {onClickOutside} from '@vueuse/core'
 | 
				
			||||||
 | 
					import {w} from "../../../dist/assets/_plugin-vue_export-helper-Bvj9NrzX.js";
 | 
				
			||||||
 | 
					let checked = ref([])
 | 
				
			||||||
 | 
					const yearList = ref([])
 | 
				
			||||||
 | 
					const monthList = ref([])
 | 
				
			||||||
 | 
					const accessList = ref([])
 | 
				
			||||||
 | 
					const languageList = ref([])
 | 
				
			||||||
 | 
					const domainList = ref([])
 | 
				
			||||||
 | 
					const paperTypeList = ref([])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const props = defineProps({
 | 
				
			||||||
 | 
					  isOpen: Boolean,
 | 
				
			||||||
 | 
					  allArticles: ref([Object])
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					for (let i=0;i< props.allArticles.length;i++) {
 | 
				
			||||||
 | 
					  let r = props.allArticles[i];
 | 
				
			||||||
 | 
					  let year = r.releaseDate.split("-")[0]
 | 
				
			||||||
 | 
					  let month = r.releaseDate.split("-")[1]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!yearList.value.includes(year)) yearList.value.push(year);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!monthList.value.includes(month)) monthList.value.push(month);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!accessList.value.includes(r.access)) accessList.value.push(r.access);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!languageList.value.includes(r.language)) languageList.value.push(r.language);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!domainList.value.includes(r.domain)) domainList.value.push(r.domain);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!paperTypeList.value.includes(r.paperType)) paperTypeList.value.push(r.paperType);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					function monthToString(month){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  switch (month){
 | 
				
			||||||
 | 
					    case "01":
 | 
				
			||||||
 | 
					      return "january"
 | 
				
			||||||
 | 
					    case "02":
 | 
				
			||||||
 | 
					      return "february"
 | 
				
			||||||
 | 
					    case "03":
 | 
				
			||||||
 | 
					      return "march"
 | 
				
			||||||
 | 
					    case "04":
 | 
				
			||||||
 | 
					      return "april"
 | 
				
			||||||
 | 
					    case "05":
 | 
				
			||||||
 | 
					      return "may"
 | 
				
			||||||
 | 
					    case "06":
 | 
				
			||||||
 | 
					      return "june"
 | 
				
			||||||
 | 
					    case "07":
 | 
				
			||||||
 | 
					      return "july"
 | 
				
			||||||
 | 
					    case "08":
 | 
				
			||||||
 | 
					      return "august"
 | 
				
			||||||
 | 
					    case "09":
 | 
				
			||||||
 | 
					      return "september"
 | 
				
			||||||
 | 
					    case "10":
 | 
				
			||||||
 | 
					      return "november"
 | 
				
			||||||
 | 
					    case "11":
 | 
				
			||||||
 | 
					      return "october"
 | 
				
			||||||
 | 
					    case "12":
 | 
				
			||||||
 | 
					      return "december"
 | 
				
			||||||
 | 
					    default:
 | 
				
			||||||
 | 
					      return "unknown"
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const emit = defineEmits(["modal-close"]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const target = ref(null)
 | 
				
			||||||
 | 
					onClickOutside(target, ()=>emit('modal-close'))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<template>
 | 
				
			||||||
 | 
					  <div v-if="isOpen" class="modal-mask">
 | 
				
			||||||
 | 
					    <div class="modal-wrapper">
 | 
				
			||||||
 | 
					      <div class="modal-container" ref="target">
 | 
				
			||||||
 | 
					        <div id="filterGrid">
 | 
				
			||||||
 | 
					          <div> Year :<ul class="checkers"> <li v-for="n in yearList"> <input type="checkbox" :value=n v-model="checked"> {{n}} </li> </ul> </div>
 | 
				
			||||||
 | 
					          <div class="vl"> Access :<ul class="checkers"> <li v-for="n in accessList"> <input type="checkbox" :value=n v-model="checked"> {{n}} </li> </ul> </div>
 | 
				
			||||||
 | 
					          <div class="vl"> Language :<ul class="checkers"> <li v-for="n in languageList"> <input type="checkbox" :value=n v-model="checked"> {{n}} </li> </ul> </div>
 | 
				
			||||||
 | 
					          <div> Month :<ul class="checkers"> <li v-for="n in monthList"> <input type="checkbox" :value=n v-model="checked"> {{monthToString(n)}} </li> </ul> </div>
 | 
				
			||||||
 | 
					          <div class="vl"> Domain :<ul class="checkers"> <li v-for="n in domainList"> <input type="checkbox" :value=n v-model="checked"> {{n}} </li> </ul> </div>
 | 
				
			||||||
 | 
					          <div class="vl"> PaperType :<ul class="checkers"> <li v-for="n in paperTypeList"> <input type="checkbox" :value=n v-model="checked"> {{n}} </li> </ul> </div>
 | 
				
			||||||
 | 
					      </div>
 | 
				
			||||||
 | 
					        <div id="submit">
 | 
				
			||||||
 | 
					          <button @click.stop="emit('modal-close', 'submit')">Submit</button>
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					      </div>
 | 
				
			||||||
 | 
					  </div>
 | 
				
			||||||
 | 
					 </div>
 | 
				
			||||||
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<style scoped>
 | 
				
			||||||
 | 
					.modal-mask {
 | 
				
			||||||
 | 
					  position: fixed;
 | 
				
			||||||
 | 
					  z-index: 9998;
 | 
				
			||||||
 | 
					  top: 0;
 | 
				
			||||||
 | 
					  left: 0;
 | 
				
			||||||
 | 
					  width: 100%;
 | 
				
			||||||
 | 
					  height: 100%;
 | 
				
			||||||
 | 
					  background-color: rgba(0, 0, 0, 0.5);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.modal-container {
 | 
				
			||||||
 | 
					  width: 70%;
 | 
				
			||||||
 | 
					  margin: 150px auto;
 | 
				
			||||||
 | 
					  padding: 20px 30px;
 | 
				
			||||||
 | 
					  background: rgba(157, 99, 205);
 | 
				
			||||||
 | 
					  border-radius: 12px;
 | 
				
			||||||
 | 
					  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.33);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#filterGrid {
 | 
				
			||||||
 | 
					  display: grid;
 | 
				
			||||||
 | 
					  grid-template-columns: auto auto auto;
 | 
				
			||||||
 | 
					  column-gap: 5px;
 | 
				
			||||||
 | 
					  grid-template-rows: auto auto;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#filterGrid ul {
 | 
				
			||||||
 | 
					  list-style-type: none;
 | 
				
			||||||
 | 
					  padding: 15px;
 | 
				
			||||||
 | 
					  height: 100px;
 | 
				
			||||||
 | 
					  overflow: scroll;
 | 
				
			||||||
 | 
					  scrollbar-color: #8a2be2 rgb(255,255,255,0.04);
 | 
				
			||||||
 | 
					  background-color: rgba(255, 255, 255, 0.09);
 | 
				
			||||||
 | 
					  border-radius: 6px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.vl {
 | 
				
			||||||
 | 
					  border-left: 6px solid #8a2be2;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#submit {
 | 
				
			||||||
 | 
					  text-align: end;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#submit button {
 | 
				
			||||||
 | 
					  margin-left: 2px;
 | 
				
			||||||
 | 
					  font-size: large;
 | 
				
			||||||
 | 
					  color: white;
 | 
				
			||||||
 | 
					  background: rgba(191, 64, 191,0.5);
 | 
				
			||||||
 | 
					  border:2px solid black;
 | 
				
			||||||
 | 
					  border-radius: 5px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#submit button:hover{
 | 
				
			||||||
 | 
					  background: rgba(191, 64, 191);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</style>
 | 
				
			||||||
@ -0,0 +1,97 @@
 | 
				
			|||||||
 | 
					<!----------------------------------------------------
 | 
				
			||||||
 | 
						File:  ResearchComponent.vue
 | 
				
			||||||
 | 
						Author: Maxime Bartha
 | 
				
			||||||
 | 
						Scope: Extension Publicatons scientifiquess
 | 
				
			||||||
 | 
						Description: Pop Up summarizing
 | 
				
			||||||
 | 
					----------------------------------------------------->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<script setup>
 | 
				
			||||||
 | 
					import {ref } from "vue";
 | 
				
			||||||
 | 
					import {onClickOutside} from '@vueuse/core'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const props = defineProps({
 | 
				
			||||||
 | 
					  isOpen: Boolean,
 | 
				
			||||||
 | 
					  article: ref(Object)
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					function format(date){
 | 
				
			||||||
 | 
					  let split = date.split("-")
 | 
				
			||||||
 | 
					  let month = split[1]
 | 
				
			||||||
 | 
					  let day = split[2].split("T")[0]
 | 
				
			||||||
 | 
					  let year = split[0]
 | 
				
			||||||
 | 
					  return day +"/"+ month +"/"+ year
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const emit = defineEmits(["downloadPdf","downloadBibTex"]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const target = ref(null)
 | 
				
			||||||
 | 
					onClickOutside(target, ()=>emit('modal-close'))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<template>
 | 
				
			||||||
 | 
					  <div v-if="isOpen" class="modal-mask">
 | 
				
			||||||
 | 
					    <div class="modal-wrapper">
 | 
				
			||||||
 | 
					      <div class="modal-container" ref="target">
 | 
				
			||||||
 | 
					       <ul>
 | 
				
			||||||
 | 
					         <li>Article Id : {{article.id}}</li>
 | 
				
			||||||
 | 
					         <li>Title : {{article.title}}</li>
 | 
				
			||||||
 | 
					         <li>Author : {{article.researcher.user.lastName + " " + article.researcher.user.firstName}}</li>
 | 
				
			||||||
 | 
					         <li>Summary : {{article.summary}}</li>
 | 
				
			||||||
 | 
					         <li>ReleaseDate: {{format(article.releaseDate)}}</li>
 | 
				
			||||||
 | 
					         <li>Language : {{article.language}}</li>
 | 
				
			||||||
 | 
					         <li>PaperType : {{article.paperType}}</li>
 | 
				
			||||||
 | 
					         <li>Domain : {{article.domain}}</li>
 | 
				
			||||||
 | 
					         <li>Access : {{article.access}}</li>
 | 
				
			||||||
 | 
					       </ul>
 | 
				
			||||||
 | 
					        <div id="downloads" v-if="article.pdfLocation !== null">
 | 
				
			||||||
 | 
					          <button @click.stop="emit('downloadBibTex')">Download BibTex</button>
 | 
				
			||||||
 | 
					          <button @click.stop="emit('downloadPdf')">Download Research</button>
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					      </div>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					  </div>
 | 
				
			||||||
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<style scoped>
 | 
				
			||||||
 | 
					.modal-mask {
 | 
				
			||||||
 | 
					  position: fixed;
 | 
				
			||||||
 | 
					  z-index: 9998;
 | 
				
			||||||
 | 
					  top: 0;
 | 
				
			||||||
 | 
					  left: 0;
 | 
				
			||||||
 | 
					  width: 100%;
 | 
				
			||||||
 | 
					  height: 100%;
 | 
				
			||||||
 | 
					  background-color: rgba(0, 0, 0, 0.5);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.modal-container {
 | 
				
			||||||
 | 
					  width: 70%;
 | 
				
			||||||
 | 
					  margin: 150px auto;
 | 
				
			||||||
 | 
					  padding: 20px 30px;
 | 
				
			||||||
 | 
					  background: rgba(157, 99, 205);
 | 
				
			||||||
 | 
					  border-radius: 12px;
 | 
				
			||||||
 | 
					  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.33);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.modal-container ul{
 | 
				
			||||||
 | 
					  margin-top: 9px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#downloads {
 | 
				
			||||||
 | 
					  text-align: end;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#downloads button {
 | 
				
			||||||
 | 
					  align-self: center;
 | 
				
			||||||
 | 
					  margin-left: 2px;
 | 
				
			||||||
 | 
					  font-size: large;
 | 
				
			||||||
 | 
					  color: white;
 | 
				
			||||||
 | 
					  background: rgba(191, 64, 191,0.5);
 | 
				
			||||||
 | 
					  border:2px solid black;
 | 
				
			||||||
 | 
					  border-radius: 5px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#downloads button:hover{
 | 
				
			||||||
 | 
					  background: rgba(191, 64, 191);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</style>
 | 
				
			||||||
@ -7,37 +7,90 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
<script setup>
 | 
					<script setup>
 | 
				
			||||||
import { ref, reactive } from "vue";
 | 
					import { ref, reactive } from "vue";
 | 
				
			||||||
 | 
					import FilterComponent from "@/Apps/ScientificPublications/FilterComponent.vue";
 | 
				
			||||||
 | 
					import ArticleComponent from "@/Apps/ScientificPublications/ResearchComponent.vue";
 | 
				
			||||||
 | 
					import {fetchResearcher, fetchResearches, fetchStats, addView, getFile} from "@/rest/ScientificPublications/ResearcherProfile.js";
 | 
				
			||||||
const input = ref("");
 | 
					const input = ref("");
 | 
				
			||||||
const statsOf = ref("");
 | 
					const statsOf = ref("");
 | 
				
			||||||
const statsBy = ref("");
 | 
					const statsBy = ref("");
 | 
				
			||||||
 | 
					const isFilterOpened = ref(false);
 | 
				
			||||||
 | 
					const isResearchOpened = ref(false);
 | 
				
			||||||
 | 
					const articleToDisplay = ref(Object)
 | 
				
			||||||
 | 
					const filters = ref([]);
 | 
				
			||||||
let chart;
 | 
					let chart;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const jsonMockViewsByYears= [
 | 
					const researchList = ref(await fetchResearches(1));
 | 
				
			||||||
  {label: "2004", y:4},
 | 
					//todo changer dynamiquement le 1 ici en fct de sur quel profil on est
 | 
				
			||||||
  {label: "2005", y:99},
 | 
					const researcher = ref(await fetchResearcher(1));
 | 
				
			||||||
  {label: "2007", y:555},
 | 
					const stats = ref(await fetchStats(1))
 | 
				
			||||||
  {label: "2009", y:22},
 | 
					 | 
				
			||||||
  {label: "2011", y:1666},
 | 
					 | 
				
			||||||
]
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
function inputKeyUp() {
 | 
					const props = defineProps({
 | 
				
			||||||
  let filter, ul, li, a, txtValue;
 | 
					  researcherId: ref(), //int
 | 
				
			||||||
  filter = input.value.toUpperCase();
 | 
					  filters: ref([""]),
 | 
				
			||||||
  if (document.getElementById("myUL") != null) {
 | 
					});
 | 
				
			||||||
    ul = document.getElementById("myUL");
 | 
					 | 
				
			||||||
    li = ul.getElementsByTagName("li");
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Loop through all list items, and hide those who don't match the search query
 | 
					const openFilter = () => {
 | 
				
			||||||
    for (let i = 0; i < li.length; i++) {
 | 
					  isFilterOpened.value = true;
 | 
				
			||||||
      a = li[i].getElementsByTagName("a")[0];
 | 
					};
 | 
				
			||||||
      txtValue = a.textContent || a.innerText;
 | 
					const closeFilter = () => {
 | 
				
			||||||
      if (txtValue.toUpperCase().indexOf(filter) > -1) {
 | 
					  isFilterOpened.value = false;
 | 
				
			||||||
        li[i].style.display = "";
 | 
					};
 | 
				
			||||||
      } else {
 | 
					const submitFilters = ()=>{
 | 
				
			||||||
        li[i].style.display = "none";
 | 
					}
 | 
				
			||||||
      }
 | 
					const openResearch = (article) => {
 | 
				
			||||||
 | 
					  isResearchOpened.value = true;
 | 
				
			||||||
 | 
					  articleToDisplay.value = article;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const closeResearch = () => {
 | 
				
			||||||
 | 
					  isResearchOpened.value =false;
 | 
				
			||||||
 | 
					  articleToDisplay.value = null;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const downloadBibTex = (research) => {
 | 
				
			||||||
 | 
					  getFile(research.bibTexLocation)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const downloadArticle = (research) => {
 | 
				
			||||||
 | 
					  addView(research.pdfLocation)
 | 
				
			||||||
 | 
					  getFile(research.pdfLocation)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function downloadCoAuthors(){
 | 
				
			||||||
 | 
					  const data = JSON.stringify(researcher.value);
 | 
				
			||||||
 | 
					  const blob = new Blob([data], {type:"application/json"});
 | 
				
			||||||
 | 
					  return URL.createObjectURL(blob);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function searchInList(list, searchInput) {
 | 
				
			||||||
 | 
					  let retList = []
 | 
				
			||||||
 | 
					  for (let i = 0; i < list.length; i++) {
 | 
				
			||||||
 | 
					    if (lDistance(list[i].title, searchInput) < 10 || list[i].title.toUpperCase().indexOf(searchInput.toUpperCase()) > -1){
 | 
				
			||||||
 | 
					      retList.push(list[i])
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  return retList
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function lDistance(s,t){
 | 
				
			||||||
 | 
					  if (!s.length) return t.length;
 | 
				
			||||||
 | 
					  if (!t.length) return s.length;
 | 
				
			||||||
 | 
					  const arr = [];
 | 
				
			||||||
 | 
					  for (let i = 0; i <= t.length; i++) {
 | 
				
			||||||
 | 
					    arr[i] = [i];
 | 
				
			||||||
 | 
					    for (let j = 1; j <= s.length; j++) {
 | 
				
			||||||
 | 
					      arr[i][j] =
 | 
				
			||||||
 | 
					          i === 0
 | 
				
			||||||
 | 
					              ? j
 | 
				
			||||||
 | 
					              : Math.min(
 | 
				
			||||||
 | 
					                  arr[i - 1][j] + 1,
 | 
				
			||||||
 | 
					                  arr[i][j - 1] + 1,
 | 
				
			||||||
 | 
					                  arr[i - 1][j - 1] + (s[j - 1] === t[i - 1] ? 0 : 1)
 | 
				
			||||||
 | 
					              );
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  return arr[t.length][s.length];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const options = reactive({
 | 
					const options = reactive({
 | 
				
			||||||
@ -60,50 +113,51 @@ const options = reactive({
 | 
				
			|||||||
	});
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function update(){
 | 
					function update(){
 | 
				
			||||||
      options.title = {
 | 
					  options.title = {
 | 
				
			||||||
        fontColor: "white",
 | 
					    fontColor: "white",
 | 
				
			||||||
        text: statsOf.value + " By "+ statsBy.value,
 | 
					    text: statsOf.value + " By "+ statsBy.value,
 | 
				
			||||||
      }
 | 
					  }
 | 
				
			||||||
      if (statsOf.value === "views" && statsBy.value === "years") {
 | 
					 const index = (0 ?statsOf.value === "views": 3 ? statsOf.value === "researches":6) + (0?statsBy.value ==="years":1?statsBy.value==="months":2)
 | 
				
			||||||
        options.data[0].dataPoints = jsonMockViewsByYears;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      options.title.text = statsOf.value + " By "+ statsBy.value;
 | 
					
 | 
				
			||||||
      chart.render()
 | 
					  options.data[0].dataPoints = stats.value[index]
 | 
				
			||||||
    }
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  options.title.text = statsOf.value + " By "+ statsBy.value;
 | 
				
			||||||
 | 
					  chart.render();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<template>
 | 
					<template>
 | 
				
			||||||
  <div id="main">
 | 
					  <div id="main">
 | 
				
			||||||
 | 
					    <FilterComponent :isOpen="isFilterOpened" :allArticles="researchList" @modal-close="closeFilter" @submit="submitFilters()"></FilterComponent>
 | 
				
			||||||
 | 
					    <ArticleComponent :article="articleToDisplay" :isOpen="isResearchOpened" @modal-close="closeResearch" @downloadPdf="downloadArticle(articleToDisplay)" @downloadBibTex="downloadBibTex(articleToDisplay)"></ArticleComponent>
 | 
				
			||||||
    <div id="profilePicture">
 | 
					    <div id="profilePicture">
 | 
				
			||||||
      <img src="/Clyde.png" />
 | 
					      <img src="/Clyde.png" />
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
    <div id="researcherInfos">
 | 
					    <div id="researcherInfos">
 | 
				
			||||||
      <div class="surrounded">John Doe</div>
 | 
					      <div class="surrounded">{{researcher.user.lastName}} {{researcher.user.firstName}}</div>
 | 
				
			||||||
      <div class="surrounded">Orcid : 12144-2144-12336-B</div>
 | 
					      <div class="surrounded">Orcid : {{researcher.orcidId}}</div>
 | 
				
			||||||
      <div class="surrounded">Email : John.Doe@umons.ac.be</div>
 | 
					      <div class="surrounded">Email : {{researcher.user.email}}</div>
 | 
				
			||||||
 | 
					 | 
				
			||||||
      <div class="surrounded">
 | 
					      <div class="surrounded">
 | 
				
			||||||
        site :
 | 
					        site : <a :href=researcher.site style="color: #007aff"> {{researcher.site}}</a>
 | 
				
			||||||
        <a href="http://localhost:5173" style="color: #007aff">here</a>
 | 
					 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
      <div class="surrounded">Domain : physics, IT</div>
 | 
					      <div class="surrounded">Domain : {{researcher.domain}}</div>
 | 
				
			||||||
      <div id="coAuthorList" class="surrounded">Co-authors list : D</div>
 | 
					      <div id="coAuthorList" class="surrounded">Co-authors list : <a :href=downloadCoAuthors() download="coAuthors.json"> here </a></div>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
    <div id="stats">
 | 
					    <div id="stats">
 | 
				
			||||||
      <div class="surrounded">
 | 
					      <div class="surrounded">
 | 
				
			||||||
        Stat type :
 | 
					        Stat type :
 | 
				
			||||||
        <select @change="update()" id="stats-select" v-model="statsOf">
 | 
					        <select @change="update()" id="stats-select" v-model="statsOf">
 | 
				
			||||||
          <option value="views">Views</option>
 | 
					          <option value="views">Views</option>
 | 
				
			||||||
          <option value="co-authors">Co-authors</option>
 | 
					          <option value="researches">Researches</option>
 | 
				
			||||||
          <option value="articles">Articles</option>
 | 
					          <option value="languages">Languages</option>
 | 
				
			||||||
          <option value="language">Languages</option>
 | 
					 | 
				
			||||||
        </select>
 | 
					        </select>
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
      <div class="surrounded">
 | 
					      <div class="surrounded">
 | 
				
			||||||
        Class by:
 | 
					        Class by:
 | 
				
			||||||
        <select @change="update()" id="classed-select" v-model="statsBy">
 | 
					        <select @change="update()" id="classed-select" v-model="statsBy">
 | 
				
			||||||
          <option selected="selected" value="years">Years</option>
 | 
					          <option value="years">Years</option>
 | 
				
			||||||
          <option value="months">Months</option>
 | 
					          <option value="months">Months</option>
 | 
				
			||||||
          <option value="topics">Topics</option>
 | 
					          <option value="topics">Topics</option>
 | 
				
			||||||
        </select>
 | 
					        </select>
 | 
				
			||||||
@ -112,24 +166,16 @@ function update(){
 | 
				
			|||||||
		  <CanvasJSChart :options="options" id=chart @chart-ref="c => chart = c "/>
 | 
							  <CanvasJSChart :options="options" id=chart @chart-ref="c => chart = c "/>
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
    <div id="articles">
 | 
					    <div id="researches">
 | 
				
			||||||
      <input
 | 
					      <div id="search">
 | 
				
			||||||
        type="text"
 | 
					        <input type="text" id="search-input" placeholder="search for researches" v-model="input"/>
 | 
				
			||||||
        id="search-input"
 | 
					        <button id="filterButton" @click="openFilter">  Filters </button>
 | 
				
			||||||
        @keyup="inputKeyUp()"
 | 
					      </div>
 | 
				
			||||||
        placeholder="search articles"
 | 
					      <ul id="researchUL">
 | 
				
			||||||
        v-model="input"
 | 
					        <li id="researchLi" v-for="n in searchInList(researchList,input)">
 | 
				
			||||||
      />
 | 
					          <div class="vl"> {{n.title}}</div>
 | 
				
			||||||
      <ul id="myUL">
 | 
					          <div class="vl"> {{ n.researcher.user.firstName +" "+ n.researcher.user.lastName }}</div>
 | 
				
			||||||
        <li><a href="#">Adele</a></li>
 | 
					         <a @click="openResearch(n)"> MoreInfo  </a></li>
 | 
				
			||||||
        <li><a href="#">Agnes</a></li>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        <li><a href="#">Billy</a></li>
 | 
					 | 
				
			||||||
        <li><a href="#">Bob</a></li>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        <li><a href="#">Calvin</a></li>
 | 
					 | 
				
			||||||
        <li><a href="#">Christina</a></li>
 | 
					 | 
				
			||||||
        <li><a href="#">Cindy</a></li>
 | 
					 | 
				
			||||||
      </ul>
 | 
					      </ul>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
@ -180,57 +226,68 @@ function update(){
 | 
				
			|||||||
  color: white;
 | 
					  color: white;
 | 
				
			||||||
  background-color: rgb(255, 255, 255, 0.1);
 | 
					  background-color: rgb(255, 255, 255, 0.1);
 | 
				
			||||||
  font-size: large;
 | 
					  font-size: large;
 | 
				
			||||||
  align-self: center;
 | 
					 | 
				
			||||||
  text-align: center;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#statsPie {
 | 
					#statsPie {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#articles {
 | 
					#search{
 | 
				
			||||||
  background-color: orange;
 | 
					  width: 100%;
 | 
				
			||||||
 | 
					  height: 10%;
 | 
				
			||||||
 | 
					  display: inline-flex;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
#search-input {
 | 
					#search-input {
 | 
				
			||||||
  width: 60%;
 | 
					  margin-left: 25px;
 | 
				
			||||||
 | 
					  width: 75%;
 | 
				
			||||||
  font-size: 16px;
 | 
					  font-size: 16px;
 | 
				
			||||||
  padding: 12px 20px 12px 40px;
 | 
					  padding: 12px 20px 12px 40px;
 | 
				
			||||||
  border: 1px solid #ddd;
 | 
					  border: 1px solid #ddd;
 | 
				
			||||||
  margin-bottom: 12px;
 | 
					  height: 20px;
 | 
				
			||||||
 | 
					  align-self: center;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#myUL {
 | 
					#filterButton {
 | 
				
			||||||
 | 
					  align-self: center;
 | 
				
			||||||
 | 
					  margin-left: 2px;
 | 
				
			||||||
 | 
					  font-size: xx-large;
 | 
				
			||||||
 | 
					  color: white;
 | 
				
			||||||
 | 
					  background: rgba(191, 64, 191,0.5);
 | 
				
			||||||
 | 
					  border:2px solid black;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#filterButton:hover{
 | 
				
			||||||
 | 
					  background: rgba(191, 64, 191);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#researchUL {
 | 
				
			||||||
  list-style-type: none;
 | 
					  list-style-type: none;
 | 
				
			||||||
  padding: 0;
 | 
					  color: white;
 | 
				
			||||||
  margin: 0;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#myUL li a {
 | 
					 | 
				
			||||||
  border: 1px solid #ddd;
 | 
					 | 
				
			||||||
  /* Add a border to all links */
 | 
					 | 
				
			||||||
  margin-top: -1px;
 | 
					 | 
				
			||||||
  /* Prevent double borders */
 | 
					 | 
				
			||||||
  background-color: #f6f6f6;
 | 
					 | 
				
			||||||
  /* Grey background color */
 | 
					 | 
				
			||||||
  padding: 12px;
 | 
					  padding: 12px;
 | 
				
			||||||
  /* Add some padding */
 | 
					  margin: 5px;
 | 
				
			||||||
  text-decoration: none;
 | 
					  height: 400px;
 | 
				
			||||||
  /* Remove default text underline */
 | 
					  overflow: scroll;
 | 
				
			||||||
  font-size: 18px;
 | 
					}
 | 
				
			||||||
  /* Increase the font-size */
 | 
					#researchLi{
 | 
				
			||||||
  color: black;
 | 
					  display: grid;
 | 
				
			||||||
  /* Add a black text color */
 | 
					  grid-template-columns: auto auto auto;
 | 
				
			||||||
  display: block;
 | 
					  border: 2px solid black;
 | 
				
			||||||
  /* Make it into a block element to fill the whole list */
 | 
					  color: white;
 | 
				
			||||||
 | 
					  font-size: x-large;
 | 
				
			||||||
 | 
					  text-align: center;
 | 
				
			||||||
 | 
					  text-indent: 7px;
 | 
				
			||||||
 | 
					  background-color: rgba(255, 255, 255, 0.09);
 | 
				
			||||||
 | 
					  border-radius: 18px;
 | 
				
			||||||
 | 
					  margin-bottom: 15px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					a{
 | 
				
			||||||
 | 
					  color:#007aff;
 | 
				
			||||||
 | 
					  text-decoration: underline;
 | 
				
			||||||
 | 
					  cursor: pointer;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#myUL li a:hover:not(.header) {
 | 
					.vl {
 | 
				
			||||||
  background-color: #eee;
 | 
					  border-right: 2px solid black;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#Chart{
 | 
					 | 
				
			||||||
    width: "100%";
 | 
					 | 
				
			||||||
    height: "100%";
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
</style>
 | 
					</style>
 | 
				
			||||||
 | 
				
			|||||||
@ -0,0 +1,20 @@
 | 
				
			|||||||
 | 
					import { restGet, restPost, restDelete, restPatch } from '../restConsumer.js'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export async function fetchResearcher(id){
 | 
				
			||||||
 | 
					    return restGet("/researcher/" + id)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export async function fetchResearches(id){
 | 
				
			||||||
 | 
					    return restGet("/researches/" + id)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export async function fetchStats(id){
 | 
				
			||||||
 | 
					    return restGet("/stats/" +id)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					export async function addView(url){
 | 
				
			||||||
 | 
					    return restPost("/addView/" +url)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export async function getFile(url){
 | 
				
			||||||
 | 
					    return restGet("/" + url)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -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 ResearcherProfile from "@/Apps/ScientificPublications/ResearcherProfile.vue";
 | 
					import ResearcherProfile from "@/Apps/ScientificPublications/ResearcherProfile.vue";
 | 
				
			||||||
 | 
					import Msg from "@/Apps/Msg.vue"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const apps = {
 | 
					const apps = {
 | 
				
			||||||
		'/login': LoginPage,
 | 
							'/login': LoginPage,
 | 
				
			||||||
@ -19,6 +20,7 @@ const apps = {
 | 
				
			|||||||
		'/users-list' : Users,
 | 
							'/users-list' : Users,
 | 
				
			||||||
		'/students-list' : Students,
 | 
							'/students-list' : Students,
 | 
				
			||||||
		'/researcher-profile' : ResearcherProfile,
 | 
							'/researcher-profile' : ResearcherProfile,
 | 
				
			||||||
 | 
							'/msg' : Msg,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const appsList = {
 | 
					const appsList = {
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										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();
 | 
				
			||||||
		Reference in New Issue
	
	Block a user