refactor: remove obsolete member management API module
This commit is contained in:
@@ -29,9 +29,9 @@ export default async function AttendancePage({
|
||||
const t = await getTranslations('courses');
|
||||
|
||||
const [course, sessions, participants] = await Promise.all([
|
||||
api.getCourse(courseId),
|
||||
api.getSessions(courseId),
|
||||
api.getParticipants(courseId),
|
||||
api.courses.getById(courseId),
|
||||
api.sessions.list(courseId),
|
||||
api.enrollment.listParticipants(courseId),
|
||||
]);
|
||||
|
||||
if (!course) return <AccountNotFound />;
|
||||
@@ -43,7 +43,7 @@ export default async function AttendancePage({
|
||||
: null);
|
||||
|
||||
const attendance = selectedSessionId
|
||||
? await api.getAttendance(selectedSessionId)
|
||||
? await api.attendance.getBySession(selectedSessionId)
|
||||
: [];
|
||||
|
||||
const attendanceMap = new Map(
|
||||
|
||||
@@ -25,7 +25,7 @@ export default async function EditCoursePage({ params }: PageProps) {
|
||||
if (!acct) return <AccountNotFound />;
|
||||
|
||||
const api = createCourseManagementApi(client);
|
||||
const course = await api.getCourse(courseId);
|
||||
const course = await api.courses.getById(courseId);
|
||||
if (!course) return <AccountNotFound />;
|
||||
|
||||
const c = course as Record<string, unknown>;
|
||||
|
||||
@@ -39,9 +39,9 @@ export default async function CourseDetailPage({ params }: PageProps) {
|
||||
const t = await getTranslations('courses');
|
||||
|
||||
const [course, participants, sessions] = await Promise.all([
|
||||
api.getCourse(courseId),
|
||||
api.getParticipants(courseId),
|
||||
api.getSessions(courseId),
|
||||
api.courses.getById(courseId),
|
||||
api.enrollment.listParticipants(courseId),
|
||||
api.sessions.list(courseId),
|
||||
]);
|
||||
|
||||
if (!course) return <AccountNotFound />;
|
||||
|
||||
@@ -40,8 +40,8 @@ export default async function ParticipantsPage({ params }: PageProps) {
|
||||
const t = await getTranslations('courses');
|
||||
|
||||
const [course, participants] = await Promise.all([
|
||||
api.getCourse(courseId),
|
||||
api.getParticipants(courseId),
|
||||
api.courses.getById(courseId),
|
||||
api.enrollment.listParticipants(courseId),
|
||||
]);
|
||||
|
||||
if (!course) return <AccountNotFound />;
|
||||
|
||||
@@ -45,7 +45,7 @@ export default async function CourseCalendarPage({
|
||||
if (!acct) return <AccountNotFound />;
|
||||
|
||||
const api = createCourseManagementApi(client);
|
||||
const courses = await api.listCourses(acct.id, { page: 1, pageSize: 100 });
|
||||
const courses = await api.courses.list(acct.id, { page: 1, pageSize: 100 });
|
||||
|
||||
const now = new Date();
|
||||
const monthParam = search.month as string | undefined;
|
||||
|
||||
@@ -29,7 +29,7 @@ export default async function CategoriesPage({ params }: PageProps) {
|
||||
if (!acct) return <AccountNotFound />;
|
||||
|
||||
const api = createCourseManagementApi(client);
|
||||
const categories = await api.listCategories(acct.id);
|
||||
const categories = await api.referenceData.listCategories(acct.id);
|
||||
|
||||
return (
|
||||
<CmsPageShell account={account} title={t('pages.categoriesTitle')}>
|
||||
|
||||
@@ -30,7 +30,7 @@ export default async function InstructorsPage({ params }: PageProps) {
|
||||
if (!acct) return <AccountNotFound />;
|
||||
|
||||
const api = createCourseManagementApi(client);
|
||||
const instructors = await api.listInstructors(acct.id);
|
||||
const instructors = await api.referenceData.listInstructors(acct.id);
|
||||
|
||||
return (
|
||||
<CmsPageShell account={account} title={t('pages.instructorsTitle')}>
|
||||
|
||||
@@ -29,7 +29,7 @@ export default async function LocationsPage({ params }: PageProps) {
|
||||
if (!acct) return <AccountNotFound />;
|
||||
|
||||
const api = createCourseManagementApi(client);
|
||||
const locations = await api.listLocations(acct.id);
|
||||
const locations = await api.referenceData.listLocations(acct.id);
|
||||
|
||||
return (
|
||||
<CmsPageShell account={account} title={t('pages.locationsTitle')}>
|
||||
|
||||
@@ -52,13 +52,13 @@ export default async function CoursesPage({ params, searchParams }: PageProps) {
|
||||
const page = Number(search.page) || 1;
|
||||
|
||||
const [courses, stats] = await Promise.all([
|
||||
api.listCourses(acct.id, {
|
||||
api.courses.list(acct.id, {
|
||||
search: search.q as string,
|
||||
status: search.status as string,
|
||||
page,
|
||||
pageSize: PAGE_SIZE,
|
||||
}),
|
||||
api.getStatistics(acct.id),
|
||||
api.statistics.getQuickStats(acct.id),
|
||||
]);
|
||||
|
||||
const totalPages = Math.ceil(courses.total / PAGE_SIZE);
|
||||
|
||||
@@ -33,7 +33,7 @@ export default async function CourseStatisticsPage({ params }: PageProps) {
|
||||
if (!acct) return <AccountNotFound />;
|
||||
|
||||
const api = createCourseManagementApi(client);
|
||||
const stats = await api.getStatistics(acct.id);
|
||||
const stats = await api.statistics.getQuickStats(acct.id);
|
||||
|
||||
const statusChartData = [
|
||||
{ name: t('stats.active'), value: stats.openCourses },
|
||||
|
||||
Reference in New Issue
Block a user