Merge remote-tracking branch 'origin/master'
This commit is contained in:
23
frontend/src/rest/LessonRequests.js
Normal file
23
frontend/src/rest/LessonRequests.js
Normal file
@ -0,0 +1,23 @@
|
||||
import { restGet, restPost, restDelete, restPatch } from './restConsumer.js'
|
||||
|
||||
export async function getLessonRequest(id){
|
||||
return restGet('/requests/lessonRequest/' + id);
|
||||
}
|
||||
|
||||
export async function getAllRequests(){
|
||||
return restGet("/requests/lessonRequests");
|
||||
}
|
||||
export async function getOwnedRequests(){
|
||||
return restGet("/requests/lessonRequests/owned");
|
||||
}
|
||||
export async function createRequest(request){
|
||||
return restPost("/requests/lessonRequest", request);
|
||||
}
|
||||
|
||||
export async function changeRequestState(id, infos){
|
||||
return restPatch("/requests/lessonRequest/" + id, infos);
|
||||
}
|
||||
|
||||
export async function deleteRequest(id){
|
||||
return restDelete("/requests/lessonRequest/"+id);
|
||||
}
|
@ -30,7 +30,7 @@ export async function patchUser(id,data){
|
||||
* @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, identityCardId, submissionDate, equivalence){
|
||||
export async function register(firstname, lastname, birthDate, password, email, address, country, curriculumId, imageId, identityCardId, submissionDate, equivalence,admissionDocUrl){
|
||||
return restPost("/register", {
|
||||
firstName: firstname,
|
||||
lastName: lastname,
|
||||
@ -43,7 +43,8 @@ export async function register(firstname, lastname, birthDate, password, email,
|
||||
profilePicture: imageId,
|
||||
identityCard : identityCardId,
|
||||
submissionDate : submissionDate,
|
||||
equivalenceState : equivalence
|
||||
equivalenceState : equivalence,
|
||||
admissionDocUrl: admissionDocUrl
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -4,13 +4,17 @@ import i18n from '@/i18n.js'
|
||||
|
||||
// Liste des apps
|
||||
import LoginPage from '@/Apps/Login.vue'
|
||||
import Inscription from "@/Apps/Inscription/ManageRequests.vue"
|
||||
import Profil from "@/Apps/Profil.vue"
|
||||
import Courses from "@/Apps/ManageCourses.vue"
|
||||
import Users from "@/Apps/UsersList.vue"
|
||||
import Students from "@/Apps/StudentsList.vue"
|
||||
import AboutStudent from "@/Apps/Inscription/AboutStudent.vue";
|
||||
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 Forums from '@/Apps/Forums.vue'
|
||||
import Payments from "@/Apps/Inscription/PaymentInfo.vue";
|
||||
import ManageRequests from "@/Apps/Inscription/ManageRequests.vue";
|
||||
import ManageResearcherProfile from "@/Apps/ScientificPublications/ManageResearcherProfile.vue";
|
||||
import ListResearches from "@/Apps/ScientificPublications/ListResearches.vue";
|
||||
@ -18,6 +22,8 @@ import ResearcherProfile from "@/Apps/ScientificPublications/ResearcherProfile.v
|
||||
import CreateUser from "@/Apps/CreateUser.vue";
|
||||
|
||||
const apps = {
|
||||
'/schedule': Schedule,
|
||||
'/manage-schedule': ManageSchedule,
|
||||
'/login': LoginPage,
|
||||
'/requests': ManageRequests,
|
||||
'/profil': Profil,
|
||||
@ -29,21 +35,29 @@ const apps = {
|
||||
'/researches' : ListResearches,
|
||||
'/researcher-profile': ResearcherProfile,
|
||||
'/create-user': CreateUser
|
||||
'/manage-owned-lessons': ManageOwnedLessons,
|
||||
'/manage-schedule-requests' : LessonRequests,
|
||||
'/msg' : Msg,
|
||||
'/forums': Forums,
|
||||
'/payments': Payments
|
||||
}
|
||||
|
||||
const appsList = {
|
||||
'ListResearches': {path:'#/researches', icon:'fa-book-bookmark',text:i18n("app.list.researches")},
|
||||
'Msg': { path: '#/msg', icon: 'fa-comment', text: i18n("app.messages") },
|
||||
'Notification': { path: '#/notifs', icon: 'fa-bell', text: i18n("app.notifications") },
|
||||
'Forum': { path: '#/forum', icon: 'fa-envelope', text: i18n("app.forum") },
|
||||
'Forum': { path: '#/forums', icon: 'fa-envelope', text: i18n("app.forum") },
|
||||
'Schedule': { path: '#/schedule', icon: 'fa-calendar-days', text: i18n("app.schedules") },
|
||||
'Requests': { path: '#/requests', icon: 'fa-users', text: "Requests" },
|
||||
'ManageSchedules': { path: '#/manage-schedule', icon: 'fa-calendar-days', text: i18n("app.manageSchedules")},
|
||||
'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")},
|
||||
'ManageResearcherProfile':{path:'#/manage-researcher-profile',icon:'fa-book-bookmark',text:i18n("app.manage.researcherProfile")},
|
||||
'CreateUser':{path:'#/create-user',icon:'fa-plus', text:i18n("app.Create.User")}
|
||||
|
||||
'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)
|
||||
|
103
frontend/src/rest/apps.js.orig
Normal file
103
frontend/src/rest/apps.js.orig
Normal file
@ -0,0 +1,103 @@
|
||||
import { restGet } from './restConsumer.js'
|
||||
import { ref, computed } from 'vue'
|
||||
import i18n from '@/i18n.js'
|
||||
|
||||
// Liste des apps
|
||||
import LoginPage from '@/Apps/Login.vue'
|
||||
import Profil from "@/Apps/Profil.vue"
|
||||
import Courses from "@/Apps/ManageCourses.vue"
|
||||
import Users from "@/Apps/UsersList.vue"
|
||||
import Students from "@/Apps/StudentsList.vue"
|
||||
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 Forums from '@/Apps/Forums.vue'
|
||||
import Payments from "@/Apps/Inscription/PaymentInfo.vue";
|
||||
import ManageRequests from "@/Apps/Inscription/ManageRequests.vue";
|
||||
import ManageResearcherProfile from "@/Apps/ScientificPublications/ManageResearcherProfile.vue";
|
||||
import ListResearches from "@/Apps/ScientificPublications/ListResearches.vue";
|
||||
import ResearcherProfile from "@/Apps/ScientificPublications/ResearcherProfile.vue";
|
||||
import CreateUser from "@/Apps/CreateUser.vue";
|
||||
|
||||
const apps = {
|
||||
'/schedule': Schedule,
|
||||
'/manage-schedule': ManageSchedule,
|
||||
'/login': LoginPage,
|
||||
'/requests': ManageRequests,
|
||||
'/profil': Profil,
|
||||
'/manage-courses' : Courses,
|
||||
'/users-list' : Users,
|
||||
'/students-list' : Students,
|
||||
<<<<<<< HEAD
|
||||
'/manage-researcher-profile' : ManageResearcherProfile,
|
||||
'/msg' : Msg,
|
||||
'/researches' : ListResearches,
|
||||
'/researcher-profile': ResearcherProfile,
|
||||
'/create-user': CreateUser
|
||||
=======
|
||||
'/manage-owned-lessons': ManageOwnedLessons,
|
||||
'/manage-schedule-requests' : LessonRequests,
|
||||
'/msg' : Msg,
|
||||
'/forums': Forums,
|
||||
'/payments': Payments
|
||||
>>>>>>> origin/master
|
||||
}
|
||||
|
||||
const appsList = {
|
||||
'ListResearches': {path:'#/researches', icon:'fa-book-bookmark',text:i18n("app.list.researches")},
|
||||
'Msg': { path: '#/msg', icon: 'fa-comment', text: i18n("app.messages") },
|
||||
'Notification': { path: '#/notifs', icon: 'fa-bell', text: i18n("app.notifications") },
|
||||
'Forum': { path: '#/forums', 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")},
|
||||
'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")},
|
||||
<<<<<<< HEAD
|
||||
'ManageResearcherProfile':{path:'#/manage-researcher-profile',icon:'fa-book-bookmark',text:i18n("app.manage.researcherProfile")},
|
||||
'CreateUser':{path:'#/create-user',icon:'fa-plus', text:i18n("app.Create.User")}
|
||||
|
||||
=======
|
||||
'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")}
|
||||
>>>>>>> origin/master
|
||||
}
|
||||
|
||||
const currentPath = ref(window.location.hash)
|
||||
|
||||
export const currentView = computed(() => {
|
||||
return apps[currentPath.value.split("?")[0].slice(1) || '/']
|
||||
})
|
||||
|
||||
/**
|
||||
* Return the list of app accesible by a logged (or not)
|
||||
* user.
|
||||
*/
|
||||
export async function appList(){
|
||||
let ret = [];
|
||||
let userAppList = await restGet("/apps");
|
||||
for (let userapp in userAppList) {
|
||||
if(appsList[userAppList[userapp]] != null){
|
||||
ret.push(appsList[userAppList[userapp]])
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the specified page is authorized for the
|
||||
* user
|
||||
*/
|
||||
export async function checkPage(page){
|
||||
return restGet("/apps/" + page)
|
||||
}
|
||||
|
||||
window.addEventListener('hashchange', () => {
|
||||
currentPath.value = window.location.hash
|
||||
})
|
||||
|
||||
// vim:set noet sts=0 sw=4 ts=2 tw=2:
|
@ -7,9 +7,8 @@ import { restGet, restPost, restDelete, restPatch } from './restConsumer.js'
|
||||
/**
|
||||
* Create a new course
|
||||
*/
|
||||
export async function createCourse(name, credits, owner){
|
||||
|
||||
return restPost("/course", {title: name, credits: credits, owner} )
|
||||
export async function createCourse(id,name, credits, owner){
|
||||
return restPost("/course/curriculum/" + id, {title: name, credits: credits, owner} )
|
||||
}
|
||||
|
||||
/**
|
||||
@ -20,7 +19,7 @@ export async function deleteCourse(id){
|
||||
}
|
||||
|
||||
/**
|
||||
* Get informations on a particular course
|
||||
* Get information on a particular course
|
||||
*
|
||||
* @param id identification of the course
|
||||
*
|
||||
@ -70,3 +69,11 @@ export async function getCourses(role){
|
||||
export async function alterCourse(id, changes){
|
||||
return restPatch("/course/" + id, changes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list containing all the actual courses of a user
|
||||
*/
|
||||
|
||||
export async function getUserActualCourses(){
|
||||
return restGet("/usercourses")
|
||||
}
|
||||
|
85
frontend/src/rest/courses.js.orig
Normal file
85
frontend/src/rest/courses.js.orig
Normal file
@ -0,0 +1,85 @@
|
||||
/**
|
||||
* Courses API
|
||||
*/
|
||||
|
||||
import { restGet, restPost, restDelete, restPatch } from './restConsumer.js'
|
||||
|
||||
/**
|
||||
* Create a new course
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
export async function createCourse(name, credits, owner){
|
||||
|
||||
return restPost("/course", {title: name, credits: credits, owner} )
|
||||
=======
|
||||
export async function createCourse(id,name, credits, owner){
|
||||
return restPost("/course/curriculum/" + id, {title: name, credits: credits, owner} )
|
||||
>>>>>>> origin/master
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the specified course
|
||||
*/
|
||||
export async function deleteCourse(id){
|
||||
return restDelete("/course/" + id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get information on a particular course
|
||||
*
|
||||
* @param id identification of the course
|
||||
*
|
||||
* @return all atribute of the specified course
|
||||
* - name
|
||||
* - credits
|
||||
* - faculty
|
||||
* - teacher
|
||||
* - assistants : list
|
||||
*/
|
||||
export async function getCourse(id){
|
||||
return restGet("/course/" + id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of courses to display on secretary's option
|
||||
*
|
||||
* @return list of courses of the form
|
||||
* - id
|
||||
* - name
|
||||
* - credits
|
||||
* - facutly
|
||||
* - teacher
|
||||
* - Assistants
|
||||
*/
|
||||
export async function getCourses(role){
|
||||
if(role==="Teacher"){
|
||||
return restGet("/courses/owned")
|
||||
}
|
||||
return restGet("/courses")
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Change the options of a course
|
||||
*
|
||||
* @param id the id of the course
|
||||
* @param changes Object with value to changes
|
||||
*
|
||||
* The changes object can contain:
|
||||
* - name
|
||||
* - credits
|
||||
* - faculty
|
||||
* - teacher
|
||||
* - assistants: should be a list and will replace all assistants
|
||||
*/
|
||||
export async function alterCourse(id, changes){
|
||||
return restPatch("/course/" + id, changes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list containing all the actual courses of a user
|
||||
*/
|
||||
|
||||
export async function getUserActualCourses(){
|
||||
return restGet("/usercourses")
|
||||
}
|
@ -23,6 +23,9 @@ export async function getAllCurriculums(){
|
||||
return restGet("/curriculums");
|
||||
}
|
||||
|
||||
export async function getCurriculumsByCourse(id){
|
||||
return restGet("/course/curriculum/"+ id);
|
||||
}
|
||||
/**
|
||||
* Get informations on a particular curriculum
|
||||
*
|
||||
@ -53,4 +56,7 @@ export async function getSomeonesCurriculumList(user){
|
||||
return restGet("/onescurriculum/"+user)
|
||||
}
|
||||
|
||||
export async function addCourseToCurriculum(id,courseID){
|
||||
return restPost("/curriculum/"+id, courseID);
|
||||
}
|
||||
|
||||
|
@ -1,15 +1,16 @@
|
||||
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){
|
||||
export async function createExternalCurriculum(inscriptionRequestId,school, formation, completion, startYear, endYear, justifdocUrl, userRegNo){
|
||||
return restPost("/externalcurriculum", {
|
||||
inscriptionRequestId: inscriptionRequestId,
|
||||
school:school,
|
||||
formation :formation,
|
||||
completion : completion,
|
||||
startYear : parseInteger(startYear),
|
||||
endYear: parseInteger(endYear),
|
||||
justifdocUrl : justifdocUrl
|
||||
startYear : startYear,
|
||||
endYear: endYear,
|
||||
justifdocUrl : justifdocUrl,
|
||||
userRegNo : userRegNo
|
||||
})
|
||||
}
|
||||
|
||||
|
50
frontend/src/rest/forum.js
Normal file
50
frontend/src/rest/forum.js
Normal file
@ -0,0 +1,50 @@
|
||||
/*******************************************************
|
||||
* File: forum.js
|
||||
* Author: Anthony Debucquoy
|
||||
* Scope: Extension messagerie
|
||||
* Description: Forum related functions and calls
|
||||
*******************************************************/
|
||||
|
||||
import { ref } from 'vue'
|
||||
import { restGet, restPost, restDelete, restPatch } from './restConsumer.js'
|
||||
|
||||
/**
|
||||
* List forums of a course
|
||||
*/
|
||||
export async function getForumsOfCourse(id){
|
||||
ForumsOfCurrentCourse.value = await restGet("/forums/" + id)
|
||||
}
|
||||
|
||||
export const ForumsOfCurrentCourse = ref();
|
||||
|
||||
export function createForum(id, name){
|
||||
restPost("/forums/" + id, {name: name}).then(_ => getForumsOfCourse(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* List post of a specified forum
|
||||
*/
|
||||
export async function getPostsOfForum(id){
|
||||
if(id != null){
|
||||
PostsOfCurrentForum.value = await restGet("/forum/" + id);
|
||||
}
|
||||
}
|
||||
|
||||
export function createPost(id, subject, content){
|
||||
restPost("/forum/" + id, {subject: subject, content: content}).then(_ => getPostsOfForum(id));
|
||||
}
|
||||
|
||||
export const PostsOfCurrentForum = ref();
|
||||
|
||||
/**
|
||||
* Get a post and its responses
|
||||
*/
|
||||
export async function fetchPost(id){
|
||||
fetchedPost.value = await restGet("/forum/post/" + id);
|
||||
}
|
||||
|
||||
export function sendAnswer(id, content){
|
||||
restPost("/forum/post/" + id, {content: content}).then(_ => fetchPost(id))
|
||||
}
|
||||
|
||||
export const fetchedPost = ref();
|
69
frontend/src/rest/lessonSchedule.js
Normal file
69
frontend/src/rest/lessonSchedule.js
Normal file
@ -0,0 +1,69 @@
|
||||
import {restGet,restPatch,restPost,restDelete} from "@/rest/restConsumer.js";
|
||||
|
||||
/**
|
||||
* Create a new lesson
|
||||
*/
|
||||
export async function createLesson(datas){
|
||||
return restPost("/lesson", datas )
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a lesson
|
||||
*/
|
||||
export async function deleteLesson(id){
|
||||
return restDelete("/lesson/" + id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get information on a particular course
|
||||
*
|
||||
* @return all attribute of the lesson
|
||||
* - course
|
||||
* - start
|
||||
* - end
|
||||
* - color
|
||||
* - local
|
||||
*/
|
||||
export async function getLesson(id){
|
||||
return restGet("/lesson/" + id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of courses to display on secretary's option
|
||||
*
|
||||
* @return list of courses of the form
|
||||
* - id
|
||||
* - name
|
||||
* - credits
|
||||
* - facutly
|
||||
* - teacher
|
||||
* - Assistants
|
||||
*/
|
||||
export async function getLessons(){
|
||||
return restGet("/lessons")
|
||||
}
|
||||
|
||||
export async function getOwnedLessons(){
|
||||
return restGet("/lessons/owned")
|
||||
}
|
||||
|
||||
export async function getOnesLessons(){
|
||||
return restGet("/lessons/OwnCurriculum");
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the options of a course
|
||||
*
|
||||
* @param id the id of the course
|
||||
* @param changes Object with value to changes
|
||||
*
|
||||
* The changes object can contain:
|
||||
* - name
|
||||
* - credits
|
||||
* - faculty
|
||||
* - teacher
|
||||
* - assistants: should be a list and will replace all assistants
|
||||
*/
|
||||
export async function alterLesson(id, changes){
|
||||
return restPatch("/lesson/" + id, changes);
|
||||
}
|
12
frontend/src/rest/notifications.js
Normal file
12
frontend/src/rest/notifications.js
Normal file
@ -0,0 +1,12 @@
|
||||
import { ref } from 'vue'
|
||||
import { restGet, restPost } from '@/rest/restConsumer.js'
|
||||
|
||||
export const notifications = ref([]);
|
||||
|
||||
export function fetchNotifications(){
|
||||
restGet("/notifications").then( e => notifications.value = e );
|
||||
}
|
||||
|
||||
export function archiveNotification(id){
|
||||
restPost("/notifications/" + id).then( e => fetchNotifications() );
|
||||
}
|
@ -20,6 +20,66 @@ export async function editEquivalenceState(id, newstate){
|
||||
return restPatch("/request/registerequiv/"+id+"/"+newstate)
|
||||
}
|
||||
|
||||
export async function addUninscReq(userId, reason){
|
||||
return restPost("/uninscriptionreq", {"userId" : userId, "reason" : reason})
|
||||
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)
|
||||
}
|
||||
|
||||
export async function getExempByUser(userId){
|
||||
return restGet("/exemptionreq/"+userId)
|
||||
}
|
||||
|
||||
export async function imposeCurriculum(id, cursusid){
|
||||
return restPatch("/request/registerequivimpose/"+id+"/"+cursusid)
|
||||
}
|
@ -3,25 +3,28 @@ import { toast } from 'vue3-toastify'
|
||||
|
||||
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"});
|
||||
export function restGet(endPoint) {
|
||||
return _rest(endPoint, {method: "GET"});
|
||||
}
|
||||
|
||||
export async function restPost(endPoint, data) {
|
||||
return await _rest(endPoint, {method: "POST", credentials: 'include', body: JSON.stringify(data)});
|
||||
export function restPost(endPoint, data) {
|
||||
return _rest(endPoint, {method: "POST", credentials: 'include', body: JSON.stringify(data)});
|
||||
}
|
||||
|
||||
export async function restPostFile(endPoint, file){
|
||||
export function restPostFile(endPoint, file){
|
||||
let headers = new Headers();
|
||||
return await _rest(endPoint, {method: "POST", credentials: 'include', body: file, headers: headers });
|
||||
return _rest(endPoint, {method: "POST", credentials: 'include', body: file, headers: headers });
|
||||
}
|
||||
|
||||
export async function restDelete(endPoint) {
|
||||
return await _rest(endPoint, {method: "DELETE"});
|
||||
export function restDelete(endPoint) {
|
||||
return _rest(endPoint, {method: "DELETE"});
|
||||
}
|
||||
|
||||
export async function restPatch(endPoint, data) {
|
||||
return await _rest(endPoint, {method: "PATCH", credentials: 'include', body: JSON.stringify(data)});
|
||||
export function restDeleteItem(endPoint, data){
|
||||
return _rest(endPoint, {method: "DELETE", credentials: 'include', body: JSON.stringify(data)});
|
||||
}
|
||||
export function restPatch(endPoint, data) {
|
||||
return _rest(endPoint, {method: "PATCH", credentials: 'include', body: JSON.stringify(data)});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -33,7 +36,7 @@ export async function restPatch(endPoint, data) {
|
||||
*
|
||||
* @Example _rest("/ping", {user: data}) -> {id:0, txt:"pong"}
|
||||
*/
|
||||
async function _rest(endPoint, config){
|
||||
function _rest(endPoint, config){
|
||||
endPoint.at(0) != "/" ? console.error("Carefull, you certainly should put a / at the begenning of your endPoint ") : true;
|
||||
let session_token = getCookie("session_token");
|
||||
let headers = new Headers({
|
||||
@ -41,13 +44,16 @@ async function _rest(endPoint, config){
|
||||
'Content-Type': 'application/json',
|
||||
});
|
||||
config['headers'] = config['headers'] == null ? headers : config['headers'];
|
||||
return toast.promise(fetch(restURL + endPoint, config),
|
||||
|
||||
let ret = fetch(restURL + endPoint, config);
|
||||
if(config['toast']){
|
||||
ret = toast.promise(ret,
|
||||
{
|
||||
pending: config['pending'] != null ? config['pending'] : 'pending',
|
||||
error: config['error'] != null ? config['error'] : 'Network Failure...',
|
||||
success: config['success'] != null ? config['success'] : {render(res){
|
||||
return res.data.ok ? "Success" : "error";
|
||||
}},
|
||||
})
|
||||
.then( e => e.json()).catch( e => e );
|
||||
}}})
|
||||
}
|
||||
return ret.then( e => e.json()).catch( e => e );
|
||||
}
|
||||
|
30
frontend/src/rest/scheduleRest.js
Normal file
30
frontend/src/rest/scheduleRest.js
Normal file
@ -0,0 +1,30 @@
|
||||
import {restGet, restPost, restPatch, restDelete, restDeleteItem} from "@/rest/restConsumer.js";
|
||||
|
||||
export async function getAllSchedule(){
|
||||
return restGet('/schedules');
|
||||
}
|
||||
|
||||
export async function getOwnSchedule(){
|
||||
return restGet('/schedule')
|
||||
}
|
||||
|
||||
export async function createSchedule(curriculum) {
|
||||
return restPost('/schedule',{curriculum : curriculum})
|
||||
}
|
||||
|
||||
export async function getCurriculumSchedule(id){
|
||||
return restGet('/schedule/curriculum/' + id)
|
||||
}
|
||||
|
||||
export async function addLessonToSchedule(id,lessonId){
|
||||
return restPost('/schedule/' + id, lessonId)
|
||||
}
|
||||
|
||||
export async function getSchedule(id){
|
||||
return restGet('/schedule/' + id);
|
||||
|
||||
}
|
||||
|
||||
export async function deleteLessonFromSchedule(id,lessonId){
|
||||
return restDeleteItem('/schedule/lesson/'+ id, lessonId)
|
||||
}
|
@ -13,11 +13,11 @@ export async function uploadProfilePicture(file){
|
||||
|
||||
|
||||
/**
|
||||
* More generic version of the upload method
|
||||
* More generic version of the uploadProfilePicture method
|
||||
*/
|
||||
|
||||
export async function uploadFile(file, type){
|
||||
const formData = new FormData();
|
||||
formData.append("file", file[0]);
|
||||
return restPostFile("/upload/"+type, formData)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user