make admin approve api
This commit is contained in:
parent
6acb536aef
commit
5d6cab229f
7 changed files with 616 additions and 1 deletions
136
Backend/src/types/AdminCourseApproval.types.ts
Normal file
136
Backend/src/types/AdminCourseApproval.types.ts
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
import { Course, CourseApproval, User } from '@prisma/client';
|
||||
import { MultiLanguageText } from './index';
|
||||
|
||||
// ============================================
|
||||
// Admin Course Approval Types
|
||||
// ============================================
|
||||
|
||||
export interface PendingCourseData {
|
||||
id: number;
|
||||
title: MultiLanguageText;
|
||||
slug: string;
|
||||
description: MultiLanguageText;
|
||||
thumbnail_url: string | null;
|
||||
status: string;
|
||||
created_at: Date;
|
||||
updated_at: Date | null;
|
||||
created_by: number;
|
||||
creator: {
|
||||
id: number;
|
||||
username: string;
|
||||
email: string;
|
||||
};
|
||||
instructors: {
|
||||
user_id: number;
|
||||
is_primary: boolean;
|
||||
user: {
|
||||
id: number;
|
||||
username: string;
|
||||
email: string;
|
||||
};
|
||||
}[];
|
||||
chapters_count: number;
|
||||
lessons_count: number;
|
||||
latest_submission: {
|
||||
id: number;
|
||||
submitted_by: number;
|
||||
created_at: Date;
|
||||
submitter: {
|
||||
id: number;
|
||||
username: string;
|
||||
email: string;
|
||||
};
|
||||
} | null;
|
||||
}
|
||||
|
||||
export interface ListPendingCoursesResponse {
|
||||
code: number;
|
||||
message: string;
|
||||
data: PendingCourseData[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
export interface CourseDetailForAdmin {
|
||||
id: number;
|
||||
title: MultiLanguageText;
|
||||
slug: string;
|
||||
description: MultiLanguageText;
|
||||
thumbnail_url: string | null;
|
||||
price: number;
|
||||
is_free: boolean;
|
||||
have_certificate: boolean;
|
||||
status: string;
|
||||
created_at: Date;
|
||||
updated_at: Date | null;
|
||||
category: {
|
||||
id: number;
|
||||
name: MultiLanguageText;
|
||||
} | null;
|
||||
creator: {
|
||||
id: number;
|
||||
username: string;
|
||||
email: string;
|
||||
};
|
||||
instructors: {
|
||||
user_id: number;
|
||||
is_primary: boolean;
|
||||
user: {
|
||||
id: number;
|
||||
username: string;
|
||||
email: string;
|
||||
};
|
||||
}[];
|
||||
chapters: {
|
||||
id: number;
|
||||
title: MultiLanguageText;
|
||||
sort_order: number;
|
||||
is_published: boolean;
|
||||
lessons: {
|
||||
id: number;
|
||||
title: MultiLanguageText;
|
||||
type: string;
|
||||
sort_order: number;
|
||||
is_published: boolean;
|
||||
}[];
|
||||
}[];
|
||||
approval_history: {
|
||||
id: number;
|
||||
action: string;
|
||||
comment: string | null;
|
||||
created_at: Date;
|
||||
submitter: {
|
||||
id: number;
|
||||
username: string;
|
||||
email: string;
|
||||
};
|
||||
reviewer: {
|
||||
id: number;
|
||||
username: string;
|
||||
email: string;
|
||||
} | null;
|
||||
}[];
|
||||
}
|
||||
|
||||
export interface GetCourseDetailForAdminResponse {
|
||||
code: number;
|
||||
message: string;
|
||||
data: CourseDetailForAdmin;
|
||||
}
|
||||
|
||||
export interface ApproveCourseBody {
|
||||
comment?: string;
|
||||
}
|
||||
|
||||
export interface ApproveCourseResponse {
|
||||
code: number;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface RejectCourseBody {
|
||||
comment: string;
|
||||
}
|
||||
|
||||
export interface RejectCourseResponse {
|
||||
code: number;
|
||||
message: string;
|
||||
}
|
||||
|
|
@ -140,3 +140,32 @@ export interface sendCourseForReview {
|
|||
token: string;
|
||||
course_id: number;
|
||||
}
|
||||
|
||||
export interface CourseApprovalData {
|
||||
id: number;
|
||||
course_id: number;
|
||||
submitted_by: number;
|
||||
reviewed_by: number | null;
|
||||
action: 'SUBMITTED' | 'APPROVED' | 'REJECTED' | 'REVISION_REQUESTED';
|
||||
previous_status: string | null;
|
||||
new_status: string | null;
|
||||
comment: string | null;
|
||||
created_at: Date;
|
||||
submitter: {
|
||||
id: number;
|
||||
username: string;
|
||||
email: string;
|
||||
};
|
||||
reviewer: {
|
||||
id: number;
|
||||
username: string;
|
||||
email: string;
|
||||
} | null;
|
||||
}
|
||||
|
||||
export interface GetCourseApprovalsResponse {
|
||||
code: number;
|
||||
message: string;
|
||||
data: CourseApprovalData[];
|
||||
total: number;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue