feat: mock exercise template api (#613)
* feat: move mock exercise template to api * feat: add template migration file * chore: - remove exercise templates form api - rework api to pull exercise templates from db - add exercise template seed to seed file - declutter seed file * chore: - refactor template fetch to be dependent on the selected tag - add tag to schema, remote db and template's seed file - clear remote db's template table and replace data and their respective tags * chore: add number of questions and center loading screen on the frontend * chore: pr fixes * chore: type fixes * chore: - move seed functionality to /seed folder - add typing for individual seed functions - pr fixes * chore: pr fixes v2 * update output css * refactor: update seeding script and schema definitions - Renamed `seedTypes` to `seedQuestionTypes` for clarity in the seeding process. - Enhanced the seeding script to include a command-line interface for better usability, allowing specific seed functions to be executed based on flags. - Removed redundant unique constraints in the schema definitions for `courseNewsfeedComment` and `exerciseTemplate` to streamline database structure. * feat: add email verification error handling page and update session management - Introduced a new page for handling email verification errors, providing user-friendly messages based on error types. - Updated session management logic to improve handling of public routes and session states. - Enhanced security policies in the Svelte configuration to include additional sources for styles and scripts. - Removed the old email verification error page to streamline the codebase. * move the exercise template to cloudflare cdn --------- Co-authored-by: Rotimi Best <best@classroomio.com>
This commit is contained in:
co-authored by
Rotimi Best
parent
ac3f35a97f
commit
50d6ee3111
@@ -898,8 +898,7 @@ export const courseNewsfeedComment = pgTable(
|
||||
columns: [table.courseNewsfeedId],
|
||||
foreignColumns: [courseNewsfeed.id],
|
||||
name: 'course_newsfeed_comment_course_newsfeed_id_fkey'
|
||||
}),
|
||||
unique('course_newsfeed_comment_id_key').on(table.id)
|
||||
})
|
||||
]
|
||||
);
|
||||
|
||||
@@ -1312,3 +1311,45 @@ export const lessonVersions = pgView('lesson_versions', {
|
||||
}).as(
|
||||
sql`SELECT llh.old_content, llh.new_content, llh."timestamp", ll.locale, ll.lesson_id FROM lesson_language_history llh JOIN lesson_language ll ON ll.id = llh.lesson_language_id`
|
||||
);
|
||||
|
||||
export const exerciseTemplate = pgTable('exercise_template', {
|
||||
id: bigint({ mode: 'number' }).primaryKey().generatedByDefaultAsIdentity({
|
||||
name: 'exercise_template_id_seq',
|
||||
startWith: 1,
|
||||
increment: 1,
|
||||
minValue: 1,
|
||||
cache: 1
|
||||
}),
|
||||
createdAt: timestamp('created_at', { withTimezone: true, mode: 'string' }).defaultNow().notNull(),
|
||||
title: text(),
|
||||
description: text(),
|
||||
tag: text(),
|
||||
questionnaire: jsonb().default({}).$type<{
|
||||
questions: [
|
||||
{
|
||||
title: string;
|
||||
name: string;
|
||||
points: number;
|
||||
order: number;
|
||||
question_type: {
|
||||
id: number;
|
||||
label: string;
|
||||
};
|
||||
options: [
|
||||
{
|
||||
label: string;
|
||||
is_correct: boolean;
|
||||
},
|
||||
{
|
||||
label: string;
|
||||
is_correct: boolean;
|
||||
},
|
||||
{
|
||||
label: string;
|
||||
is_correct: boolean;
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}>()
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user