1
0
forked from PGL/Clyde

backend Schedule

This commit is contained in:
2024-04-07 14:33:51 +02:00
parent 9937a7db39
commit aa3e1cb868
19 changed files with 662 additions and 8 deletions

View File

@ -1,7 +1,12 @@
<script setup>
import { ref } from 'vue'
import {getDifferenceTime,lastDateOfMonth,formatDate,getFirstDay,sortByDate,matrixFromList,sundayToTheEnd,getMarginTop,getHoursMinutes, monthFromList} from '../schedule.js'
import {getDifferenceTime,lastDateOfMonth,formatDate,getFirstDay,sortByDate,matrixFromList,sundayToTheEnd,getMarginTop,getHoursMinutes, monthFromList} from '../scheduleFunctions.js'
import {getAllSchedule} from "@/rest/scheduleRest.js";
const test = await getAllSchedule();
console.log(test);
const schedule = [
{
course:{

View File

@ -8,8 +8,6 @@ import { restGet, restPost, restDelete, restPatch } from './restConsumer.js'
* Create a new course
*/
export async function createCourse(name, credits, owner){
console.log(owner);
return restPost("/course", {title: name, credits: credits, owner} )
}

View File

@ -0,0 +1,65 @@
import {restGet,restPatch,restPost,restDelete} from "@/rest/restConsumer.js";
/**
* Create a new lesson
*/
export async function createLesson(course, start, end, color, local){
return restPost("/lesson", {course: course , start: start, end: end, color : color , local : local} )
}
/**
* 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(role){
if(role==="Teacher"){
return restGet("/lessons/owned")
}
return restGet("/lessons")
}
/**
* 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("/course/" + id, changes);
}

View File

@ -0,0 +1,13 @@
import {restGet,restPost,restPatch} 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})
}