1
0
forked from PGL/Clyde

Merge master part1

This commit is contained in:
2024-04-21 00:10:33 +02:00
106 changed files with 4878 additions and 609 deletions

View File

@ -3,7 +3,7 @@
*
* TODO: On time of writing, the backend doesn't support these endpoints so it could be modified in the future.
*/
import {restGet, restPatch} from './restConsumer.js'
import {restGet, restPatch, restPost} from './restConsumer.js'
/**
* create a new register requests that can be recovered by the registering service
@ -43,3 +43,4 @@ export async function getAllRegisters(){
export async function validateRegister(id, state){
return restPatch("/request/register/" + id, state);
}

View File

@ -26,7 +26,7 @@ export function disconnect(){
* @param curriculum
* @param imageId id of the image in database returned when uploaded
*/
export async function register(firstname, lastname, birthDate, password, email, address, country, curriculumId, imageId){
export async function register(firstname, lastname, birthDate, password, email, address, country, curriculumId, imageId, identityCardId, submissionDate, equivalence,admissionDocUrl){
return restPost("/register", {
firstName: firstname,
lastName: lastname,
@ -36,7 +36,11 @@ export async function register(firstname, lastname, birthDate, password, email,
address: address,
country: country,
curriculumId: curriculumId,
profilePictureUrl: imageId,
profilePicture: imageId,
identityCard : identityCardId,
submissionDate : submissionDate,
equivalenceState : equivalence,
admissionDocUrl: admissionDocUrl
});
}
@ -52,7 +56,7 @@ export async function register(firstname, lastname, birthDate, password, email,
* @param country
* @param imageId id of the image in database returned when uploaded
*
* PS: the password is not is not required as it is generated by the backend and sent to the user
* PS: the password is not required as it is generated by the backend and sent to the user
* by mail. it's up to the user to change it if he cares about security
*/
export async function createUser(firstname, lastname, birthDate, email, address, country, role, imageId){

View File

@ -4,7 +4,6 @@ import i18n from '@/i18n.js'
// Liste des apps
import LoginPage from '@/Apps/Login.vue'
import Inscription from "@/Apps/Inscription.vue"
import Profil from "@/Apps/Profil.vue"
import Courses from "@/Apps/ManageCourses.vue"
import Users from "@/Apps/UsersList.vue"
@ -13,18 +12,23 @@ import Schedule from "@/Apps/Schedule.vue"
import ManageSchedule from "@/Apps/ManageSchedule.vue"
import ManageOwnedLessons from "@/Apps/ManageOwnLessons.vue";
import LessonRequests from "@/Apps/LessonRequests.vue";
import Msg from "@/Apps/Msg.vue"
import Payments from "@/Apps/Inscription/PaymentInfo.vue";
import ManageRequests from "@/Apps/Inscription/ManageRequests.vue";
const apps = {
'/schedule': Schedule,
'/manage-schedule': ManageSchedule,
'/login': LoginPage,
'/inscription': Inscription,
'/requests': ManageRequests,
'/profil': Profil,
'/manage-courses' : Courses,
'/users-list' : Users,
'/students-list' : Students,
'/manage-owned-lessons': ManageOwnedLessons,
'/manage-schedule-requests' : LessonRequests,
'/msg' : Msg,
'/payments': Payments
}
const appsList = {
@ -33,13 +37,13 @@ const appsList = {
'Forum': { path: '#/forum', icon: 'fa-envelope', text: i18n("app.forum") },
'Schedule': { path: '#/schedule', icon: 'fa-calendar-days', text: i18n("app.schedules") },
'ManageSchedules': { path: '#/manage-schedule', icon: 'fa-calendar-days', text: i18n("app.manageSchedules")},
'Inscription': { path: '#/inscription', icon: 'fa-users', text: i18n("app.inscription.requests") },
'ManageCourses': { path: '#/manage-courses', icon: 'fa-book', text: i18n("app.manage.courses") },
'StudentsList':{ path: '#/students-list',icon: 'fa-users',text: i18n("app.studentList")},
'UsersList':{ path: '#/users-list',icon: 'fa-users',text: i18n("app.users")},
'ManageOwnedLessons':{path: '#/manage-owned-lessons',icon:'fa-calendar-days',text: i18n("app.manageOwnLessons")},
'LessonRequests':{path: '#/manage-schedule-requests', icon:'fa-book', text: i18n("app.lessonRequests")},
'Requests': { path: '#/requests', icon: 'fa-users', text: "Requests" },
'Payments':{path: '#/payments', icon:'fa-users', text:i18n("app.payments")}
}
const currentPath = ref(window.location.hash)

View File

@ -48,3 +48,9 @@ export async function altercurriculum(id, courses){
export async function getSelfCurriculum(){
return restGet("/curriculum");
}
export async function getSomeonesCurriculumList(user){
return restGet("/onescurriculum/"+user)
}

View File

@ -0,0 +1,24 @@
import {restGet, restPatch, restPost} from "@/rest/restConsumer.js";
import {parseInteger} from "jsdom/lib/jsdom/living/helpers/strings.js";
export async function createExternalCurriculum(inscriptionRequestId,school, formation, completion, startYear, endYear, justifdocUrl, userRegNo){
return restPost("/externalcurriculum", {
inscriptionRequestId: inscriptionRequestId,
school:school,
formation :formation,
completion : completion,
startYear : startYear,
endYear: endYear,
justifdocUrl : justifdocUrl,
userRegNo : userRegNo
})
}
export async function getExternalCurriculumByInscrReq(inscrReqId){
return restGet("/externalcurriculum/"+inscrReqId)
}
export async function getExternalCurriculumByUser(userId){
return restGet("/externalcurriculumbyuser/"+userId)
}

View File

@ -45,7 +45,10 @@ export async function getLessons(){
export async function getOwnedLessons(){
return restGet("/lessons/owned")
}
export async function getOnesLessons(){
return restGet("/lessons/OwnCurriculum");
}
/**

View File

@ -0,0 +1,9 @@
import {restGet, restPatch, restPost} from "@/rest/restConsumer.js";
export async function getCurrentMinerval(userRegNo){
return restGet("/minerval/"+userRegNo)
}
export async function editMinerval(updatedMinerval){
return restPatch("/minerval", updatedMinerval)
}

60
frontend/src/rest/msg.js Normal file
View 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();

View File

@ -0,0 +1,6 @@
import {restPost} from "@/rest/restConsumer.js";
export async function postPayment(payment){
return restPost("/payment", payment)
}

View File

@ -0,0 +1,77 @@
import {restGet, restPatch, restPost} from "@/rest/restConsumer.js";
export async function createExemptionsRequest(exempReq){
return restPost("/exemptionreq", exempReq)
}
export async function createScholarshipRequest(reqInfo){
return restPost("/scholarshipreq", reqInfo)
}
export async function getAllScholarShipsRequest(){
return restGet("/scholarshipreq")
}
export async function getAllExemptionsRequest(){
return restGet("/exemptionsreq")
}
export async function editEquivalenceState(id, newstate){
return restPatch("/request/registerequiv/"+id+"/"+newstate)
}
export async function addUninscReq(userId, reason, curriculumId){
return restPost("/unregister", {"userId" : userId, "reason" : reason, "curriculumId":curriculumId})
}
export async function editScholarshipReq(body){
return restPatch("/scholarshipreq/", body)
}
export async function getScholarshipReqById(id){
return restGet("/scholarshipreq/"+id)
}
export async function getAllUnregisters(){
return restGet("/unregister")
}
export async function getUnregisterbyId(id){
return restGet("/unregister/"+id)
}
export async function editUnregReq(id, newstate){
return restPatch("/unregister/"+id+"/"+newstate)
}
export async function getAllPayments(){
return restGet("/payment")
}
export async function postChangeCurrReq(item){
return restPost("/changecurriculumreq", item)
}
export async function getAllChangeCurrReq(){
return restGet("/changecurriculumreq")
}
export async function getChangeCurrReqById(id){
return restGet("/changecurriculumreq/"+id)
}
export async function editChangeCurrReq(id, newState){
return restPatch("/changecurriculumreq/"+id+"/"+newState)
}
export async function editChangeCurrReqTeacherState(id, newState){
return restPatch("/changecurriculumreqteacher/"+id+"/"+newState)
}
export async function getExempReq(id){
return restGet("/exemptionsreq/"+id)
}
export async function editExempReqState(id, newstate){
return restPatch("/exemptionsreq/"+id+"/"+newstate)
}

View File

@ -1,7 +1,7 @@
import { getCookie } from '../utils.js'
import { toast } from 'vue3-toastify'
const restURL = import.meta.env.PROD ? "https://clyde.herisson.ovh/api" : "http://localhost:8080"
const restURL = import.meta.env.VITE_CLYDE_MODE === 'container' ? "http://localhost:8080": import.meta.env.DEV ? "http://localhost:8080" : "https://clyde.herisson.ovh/api"
export async function restGet(endPoint) {
return await _rest(endPoint, {method: "GET"});

View File

@ -7,5 +7,17 @@ import { restPostFile } from '@/rest/restConsumer.js'
export async function uploadProfilePicture(file){
const formData = new FormData();
formData.append("file", file[0]);
return restPostFile("/upload/ProfilePicture", formData)
return restPostFile("/upload/ProfilePicture", formData);
}
/**
* More generic version of the upload method
*/
export async function uploadFile(file, type){
const formData = new FormData();
formData.append("file", file[0]);
return restPostFile("/upload/"+type, formData)
}