146 lines
4.1 KiB
JavaScript
146 lines
4.1 KiB
JavaScript
const SESSION_TYPE_TO_SPEC = {
|
|
in_person: 'offline',
|
|
online: 'online',
|
|
video: 'content',
|
|
audio: 'content',
|
|
text: 'content',
|
|
slide: 'content',
|
|
pdf: 'content',
|
|
}
|
|
|
|
const makeSession = (overrides) => {
|
|
const sessionType = overrides.sessionType ?? ''
|
|
const sessionConfig = overrides.sessionConfig ?? {}
|
|
const startsAt = overrides.startsAt ?? sessionConfig.startTime ?? null
|
|
const endsAt = overrides.endsAt ?? sessionConfig.endTime ?? null
|
|
const link = overrides.link ?? sessionConfig.meetingLink ?? null
|
|
return {
|
|
id: overrides.id,
|
|
courseId: overrides.courseId ?? null,
|
|
title: overrides.title ?? '',
|
|
description: overrides.description ?? '',
|
|
type: overrides.type ?? SESSION_TYPE_TO_SPEC[sessionType] ?? null,
|
|
startsAt,
|
|
endsAt,
|
|
link,
|
|
media: overrides.media ?? [],
|
|
image: overrides.image ?? '',
|
|
course: overrides.course ?? null,
|
|
sessionType,
|
|
sessionTypeFa: overrides.sessionTypeFa ?? '',
|
|
contentType: overrides.contentType ?? '',
|
|
contentMediaId: overrides.contentMediaId ?? null,
|
|
durationMinutes: overrides.durationMinutes ?? 0,
|
|
sessionConfig,
|
|
usedInTerms: overrides.usedInTerms ?? [],
|
|
createdAt: overrides.createdAt ?? '',
|
|
}
|
|
}
|
|
|
|
export const adminSessions = [
|
|
makeSession({
|
|
id: 101,
|
|
courseId: 11,
|
|
title: 'مقدمهای بر اخلاق اسلامی',
|
|
description: 'جلسه نخست؛ تعاریف و چارچوب دوره.',
|
|
image: 'https://picsum.photos/seed/session1/200/200',
|
|
course: { id: 11, title: 'اصول اخلاق اسلامی - پاییز' },
|
|
sessionType: 'in_person',
|
|
sessionTypeFa: 'حضوری',
|
|
durationMinutes: 90,
|
|
order: 1,
|
|
sessionConfig: {
|
|
startTime: '2025-09-25T16:00:00.000Z',
|
|
location: 'سالن آمفیتئاتر ۲ - مدرسه قم',
|
|
},
|
|
usedInTerms: [{ termId: 1 }],
|
|
createdAt: '2025-09-10T08:00:00.000Z',
|
|
}),
|
|
makeSession({
|
|
id: 102,
|
|
courseId: 12,
|
|
title: 'تفسیر سوره حمد',
|
|
description: 'تحلیل آیات سوره حمد.',
|
|
course: { id: 12, title: 'مفاهیم قرآنی - پاییز' },
|
|
sessionType: 'online',
|
|
sessionTypeFa: 'آنلاین',
|
|
durationMinutes: 75,
|
|
order: 1,
|
|
sessionConfig: {
|
|
meetingLink: 'https://meet.example.com/quran-1',
|
|
platform: 'google_meet',
|
|
startTime: '2025-10-04T19:00:00.000Z',
|
|
},
|
|
usedInTerms: [{ termId: 1 }],
|
|
createdAt: '2025-09-25T08:00:00.000Z',
|
|
}),
|
|
makeSession({
|
|
id: 103,
|
|
courseId: 13,
|
|
title: 'احکام نماز جماعت',
|
|
description: 'مرور احکام و شرایط نماز جماعت.',
|
|
course: { id: 13, title: 'فقه عبادات - زمستان' },
|
|
sessionType: 'video',
|
|
sessionTypeFa: 'ویدئو',
|
|
durationMinutes: 50,
|
|
order: 2,
|
|
sessionConfig: {
|
|
minWatchedPercent: 80,
|
|
mustCompleteBeforeNext: true,
|
|
},
|
|
createdAt: '2026-01-12T08:00:00.000Z',
|
|
}),
|
|
]
|
|
|
|
export { makeSession, SESSION_TYPE_TO_SPEC }
|
|
|
|
export const sessionAttendance = new Map([
|
|
[
|
|
101,
|
|
[
|
|
{
|
|
id: 1,
|
|
userId: 100,
|
|
sessionId: 101,
|
|
status: 'present',
|
|
user: {
|
|
id: 100,
|
|
firstName: 'فاطمه',
|
|
lastName: 'رضایی',
|
|
fullName: 'فاطمه رضایی',
|
|
avatarUrl: '',
|
|
address: { province: { name: 'تهران' }, city: { name: 'تهران' } },
|
|
},
|
|
},
|
|
{
|
|
id: 2,
|
|
userId: 102,
|
|
sessionId: 101,
|
|
status: 'absent',
|
|
user: {
|
|
id: 102,
|
|
firstName: 'مریم',
|
|
lastName: 'احمدی',
|
|
fullName: 'مریم احمدی',
|
|
avatarUrl: '',
|
|
address: { province: { name: 'اصفهان' }, city: { name: 'اصفهان' } },
|
|
},
|
|
},
|
|
{
|
|
id: 3,
|
|
userId: 103,
|
|
sessionId: 101,
|
|
status: 'late',
|
|
user: {
|
|
id: 103,
|
|
firstName: 'علی',
|
|
lastName: 'علوی',
|
|
fullName: 'علی علوی',
|
|
avatarUrl: '',
|
|
address: { province: { name: 'تهران' }, city: { name: 'تهران' } },
|
|
},
|
|
},
|
|
],
|
|
],
|
|
])
|