File size: 791 Bytes
6aa6081
 
 
 
 
 
 
 
 
 
 
fc9e304
 
6aa6081
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import api from './api';

export interface SectionSchedule {
  id: number;
  section_id: number;
  account_id: number;
  day_of_week: number;
  entry_time: string;
  exit_time: string;
  subject_id: number | null;
  subject_name: string | null;
  teacher_id?: number | null;
  teacher_name?: string | null;
}

export async function listSectionSchedules(sectionId: number): Promise<SectionSchedule[]> {
  const { data } = await api.get(`/sections/${sectionId}/schedules`);
  return data;
}

export async function updateSectionSchedules(sectionId: number, schedules: { day_of_week: number; entry_time: string; exit_time: string; subject_id?: number | null }[]): Promise<SectionSchedule[]> {
  const { data } = await api.put(`/sections/${sectionId}/schedules`, { schedules });
  return data;
}