mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: various improvements
wip: frontend feat: enable cascade on foreign keys wip1 wip2 fix chapters issues wip4
This commit is contained in:
parent
2bf80030d7
commit
187f75e583
71 changed files with 879 additions and 568 deletions
|
|
@ -14,19 +14,18 @@ export async function createActivity(data: any, chapter_id: any, org_id: any) {
|
|||
export async function createFileActivity(file: File, type: string, data: any, chapter_id: any) {
|
||||
// Send file thumbnail as form data
|
||||
const formData = new FormData();
|
||||
formData.append("coursechapter_id", chapter_id);
|
||||
formData.append("chapter_id", chapter_id);
|
||||
|
||||
let org_id = "test";
|
||||
let endpoint = "";
|
||||
|
||||
if (type === "video") {
|
||||
formData.append("name", data.name);
|
||||
formData.append("video_file", file);
|
||||
endpoint = `${getAPIUrl()}activities/video?org_id=${org_id}`;
|
||||
endpoint = `${getAPIUrl()}activities/video`;
|
||||
} else if (type === "documentpdf") {
|
||||
formData.append("pdf_file", file);
|
||||
formData.append("name", data.name);
|
||||
endpoint = `${getAPIUrl()}activities/documentpdf?org_id=${org_id}`;
|
||||
endpoint = `${getAPIUrl()}activities/documentpdf`;
|
||||
} else {
|
||||
// Handle other file types here
|
||||
}
|
||||
|
|
@ -38,7 +37,7 @@ export async function createFileActivity(file: File, type: string, data: any, ch
|
|||
|
||||
export async function createExternalVideoActivity(data: any, activity: any, chapter_id: any) {
|
||||
// add coursechapter_id to data
|
||||
data.coursechapter_id = chapter_id;
|
||||
data.chapter_id = chapter_id;
|
||||
data.activity_id = activity.id;
|
||||
|
||||
const result = await fetch(`${getAPIUrl()}activities/external_video?coursechapter_id=${chapter_id}`, RequestBody("POST", data, null));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue