* feat: export schedule function to be added to handler * feat: use UserScheduleStore and return json * feat: download functionality * feat: oh wow we already have a blob download util that is very very nice * feat: return empty json if none found * feat: import function completion * feat: file uploading done * feat: new input component-stories made-settings input replaced with component * feat: attempt 1 to hook settings.tsx to importSchedule * feat: it works horray aka using right Course constructor it works * chore: fix jsdoc * chore: comments and debug style * docs: extra comment * feat: name of schedule more user friendly * feat: reworked how schedule is passed and check for file being schedule * feat: color is kept on import * fix: add sendResponse to exportSchedule --------- Co-authored-by: doprz <52579214+doprz@users.noreply.github.com>
75 lines
2.2 KiB
TypeScript
75 lines
2.2 KiB
TypeScript
import type { Course } from '@shared/types/Course';
|
|
|
|
/**
|
|
* Represents a collection of user schedule messages.
|
|
*/
|
|
export interface UserScheduleMessages {
|
|
/**
|
|
* Add a course to a schedule
|
|
*
|
|
* @param data - The schedule id and course to add
|
|
*/
|
|
addCourse: (data: { scheduleId: string; course: Course }) => void;
|
|
|
|
/**
|
|
* Adds a course by URL
|
|
*
|
|
* @param data - The URL of the course to add
|
|
* @returns Response of the requested course URL
|
|
*/
|
|
addCourseByURL: (data: { url: string; method: string; body?: string; response: 'json' | 'text' }) => string;
|
|
|
|
/**
|
|
* Remove a course from a schedule
|
|
*
|
|
* @param data - The schedule id and course to remove
|
|
*/
|
|
removeCourse: (data: { scheduleId: string; course: Course }) => void;
|
|
|
|
/**
|
|
* Clears all courses from a schedule
|
|
*
|
|
* @param data - The id of the schedule to clear
|
|
*/
|
|
clearCourses: (data: { scheduleId: string }) => void;
|
|
|
|
/**
|
|
* Switches the active schedule to the one specified
|
|
*
|
|
* @param data - The id of the schedule to switch to
|
|
*/
|
|
switchSchedule: (data: { scheduleId: string }) => void;
|
|
|
|
/**
|
|
* Creates a new schedule with the specified name
|
|
*
|
|
* @param data - The name of the schedule to create
|
|
* @returns Undefined if successful, otherwise an error message
|
|
*/
|
|
createSchedule: (data: { scheduleName: string }) => string | undefined;
|
|
|
|
/**
|
|
* Deletes a schedule with the specified name
|
|
*
|
|
* @param data - The id of the schedule to delete
|
|
* @returns Undefined if successful, otherwise an error message
|
|
*/
|
|
deleteSchedule: (data: { scheduleId: string }) => string | undefined;
|
|
|
|
/**
|
|
* Renames a schedule with the specified name
|
|
*
|
|
* @param data - The id of the schedule to rename and the new name
|
|
* @returns Undefined if successful, otherwise an error message
|
|
*/
|
|
renameSchedule: (data: { scheduleId: string; newName: string }) => string | undefined;
|
|
|
|
/**
|
|
* Exports the current schedule to a JSON file for backing up and sharing
|
|
*
|
|
* @param data - Id of schedule that will be exported
|
|
* @returns
|
|
*/
|
|
exportSchedule: (data: { scheduleId: string }) => string | undefined;
|
|
}
|