this is a test dw
This commit is contained in:
		@ -118,26 +118,4 @@ public class CurriculumController {
 | 
			
		||||
        curriculumServ.delete(toDelete);
 | 
			
		||||
        return new ResponseEntity<>(HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @GetMapping("/externalcurriculum/{inscriptionRequestId}")
 | 
			
		||||
    public ResponseEntity<Map<String,Object>> getInscriptionRequestExternalCurriculum(@RequestHeader("Authorization") String token, @PathVariable long inscriptionRequestId){
 | 
			
		||||
        if (authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin, Role.Teacher},token))
 | 
			
		||||
            return new UnauthorizedResponse<>(null);
 | 
			
		||||
 | 
			
		||||
        HashMap<String,Object> toReturn = userCurriculumServ.findAllExternalCurriculumByInscriptionRequestId(inscriptionRequestId);
 | 
			
		||||
 | 
			
		||||
        if (toReturn == null)
 | 
			
		||||
            return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
 | 
			
		||||
 | 
			
		||||
        return new ResponseEntity<>(toReturn,HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    //Note : everyone can post some externalcurriculums (the validity of the elements is assured by the inscription service)
 | 
			
		||||
    @PostMapping("/externalcurriculum")
 | 
			
		||||
    public ResponseEntity<ExternalCurriculum> postExternalCurriculum(@RequestBody ExternalCurriculum ec){
 | 
			
		||||
        ec.setState(RequestState.Pending);
 | 
			
		||||
        return new ResponseEntity<>(ecr.save(ec), HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -49,28 +49,4 @@ public class UserCurriculumService {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public HashMap<String,Object> findAllExternalCurriculumByInscriptionRequestId(Long id) {
 | 
			
		||||
        ArrayList<ExternalCurriculum> list = externalCurriculumRepo.getExternalCurriculumByInscriptionRequestId(id);
 | 
			
		||||
 | 
			
		||||
        ArrayList<HashMap<String, Object>> externalCurriculumList = new ArrayList<HashMap<String, Object>>();
 | 
			
		||||
 | 
			
		||||
        for (int i = 0; i < list.size(); i++) {
 | 
			
		||||
            HashMap<String, Object> element = new HashMap<>();
 | 
			
		||||
            element.put("id", list.get(0).getId());
 | 
			
		||||
            element.put("inscriptionRequestId", list.get(0).getInscriptionRequestId());
 | 
			
		||||
            element.put("school", list.get(0).getSchool());
 | 
			
		||||
            element.put("formation", list.get(0).getFormation());
 | 
			
		||||
            element.put("completion", list.get(0).getCompletion());
 | 
			
		||||
            element.put("startYear", list.get(0).getStartYear());
 | 
			
		||||
            element.put("endYear", list.get(0).getEndYear());
 | 
			
		||||
            element.put("justifDocUrl", list.get(0).getJustifdocUrl());
 | 
			
		||||
            element.put("state", list.get(0).getState());
 | 
			
		||||
            externalCurriculumList.add(element);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        HashMap<String, Object> toReturn = new HashMap<String, Object>();
 | 
			
		||||
        toReturn.put("externalCurriculumList", externalCurriculumList);
 | 
			
		||||
        return toReturn;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -10,7 +10,9 @@ public class ExternalCurriculum {
 | 
			
		||||
    @GeneratedValue(strategy = GenerationType.AUTO)
 | 
			
		||||
    private int id;
 | 
			
		||||
 | 
			
		||||
    private Long inscriptionRequestId;
 | 
			
		||||
    @ManyToOne(fetch = FetchType.EAGER)
 | 
			
		||||
    @JoinColumn(name="InscriptionRequest")
 | 
			
		||||
    private InscriptionRequest inscriptionRequest;
 | 
			
		||||
 | 
			
		||||
    private String school;
 | 
			
		||||
 | 
			
		||||
@ -28,8 +30,8 @@ public class ExternalCurriculum {
 | 
			
		||||
 | 
			
		||||
    public ExternalCurriculum(){}
 | 
			
		||||
 | 
			
		||||
    public ExternalCurriculum(Long ir, String school, String formation, String completion, int startYear, int endYear, String justifdocUrl, RequestState state){
 | 
			
		||||
        this.inscriptionRequestId = ir;
 | 
			
		||||
    public ExternalCurriculum(InscriptionRequest ir, String school, String formation, String completion, int startYear, int endYear, String justifdocUrl, RequestState state){
 | 
			
		||||
        this.inscriptionRequest = ir;
 | 
			
		||||
        this.school = school;
 | 
			
		||||
        this.formation = formation;
 | 
			
		||||
        this.completion = completion;
 | 
			
		||||
@ -43,12 +45,12 @@ public class ExternalCurriculum {
 | 
			
		||||
        return id;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Long getInscriptionRequestId() {
 | 
			
		||||
        return inscriptionRequestId;
 | 
			
		||||
    public InscriptionRequest getInscriptionRequest() {
 | 
			
		||||
        return inscriptionRequest;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setInscriptionRequest(Long inscriptionRequestId) {
 | 
			
		||||
        this.inscriptionRequestId = inscriptionRequestId;
 | 
			
		||||
    public void setInscriptionRequest(InscriptionRequest inscriptionRequest) {
 | 
			
		||||
        this.inscriptionRequest = inscriptionRequest;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getSchool() {
 | 
			
		||||
 | 
			
		||||
@ -2,10 +2,11 @@
 | 
			
		||||
  import {reactive, ref } from 'vue'
 | 
			
		||||
  import i18n from '@/i18n.js'
 | 
			
		||||
  import {login, register, disconnect, isLogged} from '@/rest/Users.js'
 | 
			
		||||
  import {createExternalCurriculum, getAllCurriculums, getcurriculum} from '@/rest/curriculum.js'
 | 
			
		||||
  import {getAllCurriculums, getcurriculum} from '@/rest/curriculum.js'
 | 
			
		||||
  import { uploadProfilePicture } from '@/rest/uploads.js'
 | 
			
		||||
  import {toast} from 'vue3-toastify'
 | 
			
		||||
  import 'vue3-toastify/dist/index.css';
 | 
			
		||||
  import {createExternalCurriculum} from "@/rest/externalCurriculum.js";
 | 
			
		||||
 | 
			
		||||
  const loginPage= ref(true)
 | 
			
		||||
  const page = ref(0)
 | 
			
		||||
 | 
			
		||||
@ -53,18 +53,4 @@ export async function getSomeonesCurriculumList(user){
 | 
			
		||||
	return restGet("/onescurriculum/"+user)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export async function createExternalCurriculum(inscriptionRequestId,school, formation, completion, startYear, endYear, justifdocUrl){
 | 
			
		||||
	return restPost("/externalcurriculum", {
 | 
			
		||||
		inscriptionRequestId: inscriptionRequestId,
 | 
			
		||||
		school:school,
 | 
			
		||||
		formation :formation,
 | 
			
		||||
		completion : completion,
 | 
			
		||||
		startYear : startYear,
 | 
			
		||||
		endYear: endYear,
 | 
			
		||||
		justifdocUrl : justifdocUrl
 | 
			
		||||
	})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export async function getExternalCurriculumListByInscrReq(inscriptionRequestId){
 | 
			
		||||
	return restGet("/externalCurriculum/"+parseInt(inscriptionRequestId))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										17
									
								
								frontend/src/rest/externalCurriculum.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								frontend/src/rest/externalCurriculum.js
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,17 @@
 | 
			
		||||
import {restGet, restPost} from "@/rest/restConsumer.js";
 | 
			
		||||
 | 
			
		||||
export async function createExternalCurriculum(inscriptionRequestId,school, formation, completion, startYear, endYear, justifdocUrl){
 | 
			
		||||
    return restPost("/externalcurriculum", {
 | 
			
		||||
        inscriptionRequestId: inscriptionRequestId,
 | 
			
		||||
        school:school,
 | 
			
		||||
        formation :formation,
 | 
			
		||||
        completion : completion,
 | 
			
		||||
        startYear : startYear,
 | 
			
		||||
        endYear: endYear,
 | 
			
		||||
        justifdocUrl : justifdocUrl
 | 
			
		||||
    })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export async function getExternalCurriculumListByInscrReq(inscriptionRequestId){
 | 
			
		||||
    return restGet("/externalCurriculum/"+parseInt(inscriptionRequestId))
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user