CLASSROOMIO-T-214: Add comments feature in lesson

This commit is contained in:
Rotimi Best
2023-10-08 15:34:37 +01:00
parent 0f01e8e574
commit 4f783cbc7c
28 changed files with 411 additions and 398 deletions
+2 -2
View File
@@ -48,7 +48,7 @@ export async function fetchCourse(courseId?: Course['id'], slug?: Course['slug']
certificate_theme,
lessons:lesson(
id, title,public, lesson_at, call_url, is_unlocked, order, created_at,
note, videos, slide_url, call_url, totalExercises:exercise(count),
note, videos, slide_url, call_url, totalExercises:exercise(count), totalComments:lesson_comment(count),
profile:teacher_id(id, avatar_url, fullname),
lesson_completion(id, profile_id, is_complete)
),
@@ -154,7 +154,7 @@ export function fetchLesson(lessonId: Lesson['id']) {
return supabase
.from('lesson')
.select(
`id, note, videos, slide_url, call_url, totalExercises:exercise(count), lesson_completion(id, profile_id, is_complete)`
`id, note, videos, slide_url, call_url, totalExercises:exercise(count), totalComments:lesson_comment(count), lesson_completion(id, profile_id, is_complete)`
)
.eq('id', lessonId)
.single();
+20 -3
View File
@@ -62,6 +62,21 @@ interface CourseMetadata {
lessonDownload?: boolean;
}
export interface LessonCommentInsertPayload {
id: number;
created_at: string;
updated_at: string;
lesson_id: string;
groupmember_id: string;
comment: string;
}
export interface LessonComment {
name: string;
avatar: string;
comment: string;
commentAt: string;
}
// Generated from https://supabase-schema.vercel.app/
export interface Organization {
id: string /* primary key */;
@@ -195,8 +210,8 @@ export enum VideoType {
export interface LessonPage {
id?: string | null;
totalExercises: Number;
comments: Number;
totalExercises: number;
totalComments: number;
isSaving: Boolean;
materials: {
note: string;
@@ -204,7 +219,9 @@ export interface LessonPage {
videos: Array<{
type: string;
link: string;
metadata?: {};
metadata?: {
svid?: string;
};
}>;
};
exercises: [];