Skip to content

Instantly share code, notes, and snippets.

@emmanuelekopimo
Created July 8, 2025 13:04
Show Gist options
  • Select an option

  • Save emmanuelekopimo/fd75aad608cdb4b64d519e0a330a797b to your computer and use it in GitHub Desktop.

Select an option

Save emmanuelekopimo/fd75aad608cdb4b64d519e0a330a797b to your computer and use it in GitHub Desktop.
All the types and response formats to the client for the schedule side
interface UserDetails {
uid: string;
username: string;
displayName: string;
}
interface MinAgendaItem {
id: string;
name: string;
}
interface ScheduleReminder {
id: string;
minutes: number;
}
interface CommitHash {
hash: string;
Timestamp: string;
}
interface UserComment {
user: UserDetails;
content: string;
}
interface ScheduleUpdate {
id: string;
date: string;
time: string;
type: "info" | "reminder" | "critical";
content: string;
comments: UserComment[];
}
interface SchedulePeriod {
id: string;
start_time: string;
end_time: string;
day: number;
date: string;
type: "one-time" | "weekly" | "monthly";
location: string;
campus_id: string;
location_id: string;
onsite: boolean;
}
// Types for schedule items
export interface TimetableItem {
id: string;
uid: string;
author: string;
visibility: "public" | "private";
description: string;
cover_pic: string;
tag: string;
name: string;
modified: string;
agendas: string[];
updates: ScheduleUpdate[];
username: string;
created: string;
commit_hash: CommitHash;
collaborators: UserDetails[];
invited: UserDetails[];
unjoined_agendas: MinAgendaItem[];
}
export interface AgendaItem {
id: string;
uid: string;
visibility: "public" | "private";
name: string;
code: string;
description: string;
cover_pic: string;
periods: SchedulePeriod[];
updates: ScheduleUpdate[];
tag: string;
author: string;
username: string;
created: string;
commit_hash: CommitHash;
collaborators: UserDetails[];
invited: UserDetails[];
}
export interface UserTimetableItem {
id: string;
is_muted: boolean;
muted_agendas: string[];
custom_update_reminders: ScheduleReminder[];
custom_cover_pic: string;
commit_hash: CommitHash;
}
export interface UserAgendaItem {
id: string;
is_muted: string;
muted_periods: string;
color: number;
custom_update_reminders: ScheduleReminder[];
custom_period_reminders: ScheduleReminder[];
custom_cover_pic: string;
commit_hash: CommitHash;
}
export interface ScheduleResponse {
success: boolean;
message: {
joined_agendas: UserAgendaItem[];
joined_timetables: UserTimetableItem[];
owned_timetables: UserTimetableItem[];
owned_agendas: UserAgendaItem[];
timetables: TimetableItem[];
agendas: AgendaItem[];
};
}
@emmanuelekopimo
Copy link
Author

emmanuelekopimo commented Jul 8, 2025

There are two routes for updating the Agenda and Timetable
PUT http://{{api}}/schedule/timetables/create?id={id}
PUT http://{{api}}/schedule/agendas/create?id={id}

4 more routes needed to just update these document particularly
PUT http://{{api}}/schedule/agendas/own/update?id={id}
PUT http://{{api}}/schedule/timetables/own/update?id={id}
PUT http://{{api}}/schedule/agendas/joined/update?id={id}
PUT http://{{api}}/schedule/timetables/joined/update?id={id}

Note

A new field custom_cover_pic and commit_hash has been added to the owned and joined documents

@wiseman-umanah
Copy link

done, review and merge PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment