From 04ac1a88816fa446f246d61a9b051ad6f886db3e Mon Sep 17 00:00:00 2001 From: louiscklaw Date: Tue, 22 Apr 2025 23:03:15 +0800 Subject: [PATCH] update ai prompt, --- .../001_update_dbml_from_schema_json.md | 45 ++++ .../Requirements/REQ0006/schema.dbml | 213 ++++++++++------- .../Requirements/REQ0006/schema.dbml.ai_draft | 215 ++++++++++++++++++ 3 files changed, 392 insertions(+), 81 deletions(-) create mode 100644 001_documentation/Requirements/REQ0006/_ai_workspace/001_update_dbml_from_schema_json.md create mode 100644 001_documentation/Requirements/REQ0006/schema.dbml.ai_draft diff --git a/001_documentation/Requirements/REQ0006/_ai_workspace/001_update_dbml_from_schema_json.md b/001_documentation/Requirements/REQ0006/_ai_workspace/001_update_dbml_from_schema_json.md new file mode 100644 index 0000000..0728853 --- /dev/null +++ b/001_documentation/Requirements/REQ0006/_ai_workspace/001_update_dbml_from_schema_json.md @@ -0,0 +1,45 @@ +# AI GUIDELINE + +## getting started + +Imagine there is a software developer and a QA engineer to solve the problems together + +They will: + +no need to reply me what you are going on and your digest in this phase. +just reply me "OK" when done + +base_dir=`/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project` + +- `schema.dbml` + + - read `/001_documentation/Requirements/REQ0006/schema.dbml` + this is file in dbml syntax state the main database + +- `schema.json` + + - read `/002_source/cms/src/db/schema.json` + this is the file of live pocketbase schema output + +- read `/002_source/cms/src/constants.ts` + this is the content of `@/constants` + +- look into the md files in folder `/002_source/cms/_AI_WORKSPACE/001_guideline` + +- read, remember and link up the ideas in file stated above, + i will tell them the task afterwards + +--- + +Hi, i have 2 files +`schema.json` is a export from pocketbase (e.g. collections and fields) +`schema.dbml` is schema file for presentation of the database (e.g. tables) + +please take a look in `schema.dbml` and `schema.json`, +associate the existing `collection` from json file to the `table` in dbml file + +keep `schema.json` remain unchanged and update `schema.dbml` to match it. + +please modify the `schema.dbml` to align with `schema.json` + +to the collection `QuizLPCategories` align the dbml file in the previous prompt diff --git a/001_documentation/Requirements/REQ0006/schema.dbml b/001_documentation/Requirements/REQ0006/schema.dbml index 7d0409e..ae116e6 100644 --- a/001_documentation/Requirements/REQ0006/schema.dbml +++ b/001_documentation/Requirements/REQ0006/schema.dbml @@ -1,215 +1,266 @@ +// Users table with auth fields +Table Users { + // system field + id text [pk] + tokenKey text [not null] + created datetime [default: `now()`] + updated datetime + password text [not null] + + // value field + email text [not null] + emailVisibility boolean + verified boolean + name text + avatar file +} + // LessonTypes stores different types of lessons // lesson_types, lesson_type Table LessonTypes { // system field - id int [pk, increment] // unique identifier for the lesson type + id text [pk] // changed from int to text created datetime [default: `now()`] // timestamp when the lesson type was created updated datetime // timestamp when the lesson type was last updated // value field - name varchar // name of the lesson type - type varchar // type category + name text // changed from varchar to text + type text // changed from varchar to text + pos integer + visible text + field date } + // LessonCategories stores categories of lessons // lesson_categories, lesson_category Table LessonCategories { // system field - id int [pk, increment] // unique identifier for the lesson category + id text [pk] // changed from int to text created datetime [default: `now()`] // timestamp when the category was created updated datetime // timestamp when the category was last updated // value field - cat_name varchar // image file name - cat_image varchar // image representing the category - lesson_type_id integer [ref: > LessonTypes.id] // foreign key referencing LessonTypes.id + cat_name text // changed from varchar to text + cat_image_url text // new field + cat_image file // changed from varchar to file + pos integer + lesson_id integer [ref: > LessonTypes.id] // foreign key referencing LessonTypes.id + description text // new field + remarks text // changed from varchar to text + visible text // new field } Table Helloworlds { // system field - id int [pk, increment] // id field, increment + id text [pk] // changed from int to text created datetime [default: `now()`] // record create time updated datetime // record update time -} - -Table Users { - // system field - id int [pk, increment] - created datetime [default: `now()`] - updated datetime - - // value field - email varchar - emailVisibility boolean - verified boolean - name varchar - avatar blob + hello text // new field } Table UserMetas { // system field - id int [pk, increment] + id text [pk] // changed from int to text created datetime [default: `now()`] updated datetime // value field - helloworld varchar - app_on_time_s integer - user_id integer [ref: > Users.id] + helloworld text // changed from varchar to text + meta json // new field + user_id text [ref: > Users.id] // changed type and reference + state text // new field + avatar file // changed from blob to file + role text // new field } Table QuizCategories { // system field - id int [pk, increment] + id text [pk] // changed from int to text created datetime [default: `now()`] updated datetime // value field - cat_name varchar // category name - cat_image varchar // category image + cat_name text // changed from varchar to text + cat_image text // changed from varchar to text + init_answer json // new field } + // stores all questions of matching frenzy Table QuizMatchings { // system field - id int [pk, increment] // id field, increment + id text [pk] // changed from int to text created datetime [default: `now()`] // record create time updated datetime // record update time // value field - word varchar // modal answer - word_c varchar // question - cat_id integer [ref: > QuizCategories.id] // foreign key to QuizCategories.id + word text // changed from varchar to text + word_c text // changed from varchar to text + cat_id text [ref: > QuizCategories.id] // changed type and reference } // QuizListening stores all listening quiz data Table QuizListenings { // system field - id int [pk, increment] // id field, increment + id text [pk] // changed from int to text created datetime [default: `now()`] // record create time updated datetime // record update time // value field - sound varchar // URL to the sound file - word varchar // The word in the quiz - cat_id integer [ref: > QuizCategories.id] + sound file // changed from varchar to file + word text // changed from varchar to text + cat_id text [ref: > QuizCategories.id] // changed type and reference } + // stores all categories of connectives revision quiz Table QuizConnectivesCategories { // system field - id int [pk, increment] // id field, increment + id text [pk] // changed from int to text created datetime [default: `now()`] // record create time updated datetime // record update time // value field - cat_name varchar // category name - cat_image varchar // category image + cat_name text // changed from varchar to text + cat_image file // changed from varchar to file } // stores all questions of connectives revision quiz Table QuizConnectives { // system field - id int [pk, increment] // id field, increment + id text [pk] // changed from int to text created datetime [default: `now()`] // record create time updated datetime // record update time // value field - question_fh varchar // first half - question_sh varchar // second half - modal_ans varchar // modal ans - cat_id integer [ref: > QuizConnectivesCategories.id] // foreign key to QuizConnectivesCategories.id + question_fh text // changed from varchar to text + question_sh text // changed from varchar to text + modal_ans text // changed from varchar to text + cat_id text [ref: > QuizConnectivesCategories.id] // changed type and reference } // Lessons stores all lessons in the database Table Vocabularies { // system field - id int [pk, increment] // unique identifier for the lesson + id text [pk] // changed from int to text created datetime [default: `now()`] // timestamp when the lesson was created updated datetime // timestamp when the lesson was last updated // value field - image varchar // URL to the image associated with the lesson - sound varchar // URL to the sound file associated with the lesson - word varchar // The word in English - word_c varchar // The word in Chinese - sample_e varchar // Sample sentence in English using the word - sample_c varchar // Sample sentence in Chinese using the word - cat_id integer [ref: > LessonCategories.id] // foreign key referring to LessonCategories.id - category varchar // The category to which the lesson belongs - lesson_type_id integer [ref: > LessonTypes.id] // foreign key referring to LessonTypes.id + image file // changed from varchar to file + sound file // changed from varchar to file + word text // changed from varchar to text + word_c text // changed from varchar to text + sample_e text // changed from varchar to text + sample_c text // changed from varchar to text + cat_id text [ref: > LessonCategories.id] // changed type and reference + category text // changed from varchar to text + lesson_type_id text [ref: > LessonTypes.id] // changed type and reference } // Listening Practice Quiz Categories // store listening practice category, (LpCategories, LpCategory) Table QuizLPCategories { // system fields - id text [pk] // changed from int to text to match PocketBase + id text [pk] created datetime [default: `now()`] updated datetime // value fields - cat_name varchar [presentable: true] // added presentable flag - cat_image file // changed from blob to file type - pos number // changed from integer to number + cat_name text + cat_image file + pos number init_answer json + visible text + slug text + remarks text + description text } // Listening Practice Quiz Questions Table QuizLPQuestions { - id int [pk, increment] + id text [pk] // changed from int to text created datetime [default: `now()`] updated datetime - word varchar - sound blob - cat_id integer [ref: > QuizLPCategories.id] + word text // changed from varchar to text + sound file // changed from blob to file + cat_id text [ref: > QuizLPCategories.id] // changed type and reference + cat_name text // new field + cat_image file // new field + pos number // new field + init_answer json // new field + visible text // new field + slug text // new field + remarks text // new field + description text // new field } // Matching Frenzy Quiz Categories Table QuizMFCategories { - id int [pk, increment] + id text [pk] // changed from int to text created datetime [default: `now()`] updated datetime - cat_name varchar - cat_image blob - pos integer + cat_name text // changed from varchar to text + cat_image file // changed from blob to file + pos number // changed from integer to number init_answer json + visible text // new field } // Matching Frenzy Quiz Questions Table QuizMFQuestions { - id int [pk, increment] + id text [pk] // changed from int to text created datetime [default: `now()`] updated datetime - word varchar - word_c varchar - cat_id integer [ref: > QuizMFCategories.id] + word text // changed from varchar to text + word_c text // changed from varchar to text + cat_id text [ref: > QuizMFCategories.id] // changed type and reference + visible text // new field + sound file // new field + cat_image file // new field } // Connectives Revision Quiz Categories Table QuizCRCategories { - id int [pk, increment] + id text [pk] // changed from int to text created datetime [default: `now()`] updated datetime - cat_name varchar - cat_image blob + cat_name text // changed from varchar to text + cat_image file // changed from blob to file pos integer init_answer json } // Connectives Revision Quiz Questions Table QuizCRQuestions { - id int [pk, increment] + id text [pk] // changed from int to text created datetime [default: `now()`] updated datetime - question_fh varchar - question_sh varchar - modal_ans varchar - cat_id integer [ref: > QuizCRCategories.id] + question_fh text // changed from varchar to text + question_sh text // changed from varchar to text + modal_ans text // changed from varchar to text + cat_id text [ref: > QuizCRCategories.id] // changed type and reference + options json // new field } // Test table Table t1 { - id int [pk, increment] + id text [pk] // changed from int to text created datetime [default: `now()`] updated datetime - name varchar + hello text // changed from name to hello + test_file file // new field +} + +// Customers table +Table Customers { + id text [pk] // new table + created datetime [default: `now()`] + updated datetime + name text + email text + phone text + quota number + status text + avatar_file file + cat_id text [ref: > QuizMFCategories.id] // refer to a single user in `Users` table } diff --git a/001_documentation/Requirements/REQ0006/schema.dbml.ai_draft b/001_documentation/Requirements/REQ0006/schema.dbml.ai_draft new file mode 100644 index 0000000..7d0409e --- /dev/null +++ b/001_documentation/Requirements/REQ0006/schema.dbml.ai_draft @@ -0,0 +1,215 @@ +// LessonTypes stores different types of lessons +// lesson_types, lesson_type +Table LessonTypes { + // system field + id int [pk, increment] // unique identifier for the lesson type + created datetime [default: `now()`] // timestamp when the lesson type was created + updated datetime // timestamp when the lesson type was last updated + // value field + name varchar // name of the lesson type + type varchar // type category +} + +// LessonCategories stores categories of lessons +// lesson_categories, lesson_category +Table LessonCategories { + // system field + id int [pk, increment] // unique identifier for the lesson category + created datetime [default: `now()`] // timestamp when the category was created + updated datetime // timestamp when the category was last updated + // value field + cat_name varchar // image file name + cat_image varchar // image representing the category + lesson_type_id integer [ref: > LessonTypes.id] // foreign key referencing LessonTypes.id +} + +Table Helloworlds { + // system field + id int [pk, increment] // id field, increment + created datetime [default: `now()`] // record create time + updated datetime // record update time +} + +Table Users { + // system field + id int [pk, increment] + created datetime [default: `now()`] + updated datetime + + // value field + email varchar + emailVisibility boolean + verified boolean + name varchar + avatar blob +} + +Table UserMetas { + // system field + id int [pk, increment] + created datetime [default: `now()`] + updated datetime + + // value field + helloworld varchar + app_on_time_s integer + user_id integer [ref: > Users.id] +} + +Table QuizCategories { + // system field + id int [pk, increment] + created datetime [default: `now()`] + updated datetime + + // value field + cat_name varchar // category name + cat_image varchar // category image +} + +// stores all questions of matching frenzy +Table QuizMatchings { + // system field + id int [pk, increment] // id field, increment + created datetime [default: `now()`] // record create time + updated datetime // record update time + + // value field + word varchar // modal answer + word_c varchar // question + cat_id integer [ref: > QuizCategories.id] // foreign key to QuizCategories.id +} + +// QuizListening stores all listening quiz data +Table QuizListenings { + // system field + id int [pk, increment] // id field, increment + created datetime [default: `now()`] // record create time + updated datetime // record update time + + // value field + sound varchar // URL to the sound file + word varchar // The word in the quiz + cat_id integer [ref: > QuizCategories.id] +} + +// stores all categories of connectives revision quiz +Table QuizConnectivesCategories { + // system field + id int [pk, increment] // id field, increment + created datetime [default: `now()`] // record create time + updated datetime // record update time + + // value field + cat_name varchar // category name + cat_image varchar // category image +} + +// stores all questions of connectives revision quiz +Table QuizConnectives { + // system field + id int [pk, increment] // id field, increment + created datetime [default: `now()`] // record create time + updated datetime // record update time + + // value field + question_fh varchar // first half + question_sh varchar // second half + modal_ans varchar // modal ans + cat_id integer [ref: > QuizConnectivesCategories.id] // foreign key to QuizConnectivesCategories.id +} + +// Lessons stores all lessons in the database +Table Vocabularies { + // system field + id int [pk, increment] // unique identifier for the lesson + created datetime [default: `now()`] // timestamp when the lesson was created + updated datetime // timestamp when the lesson was last updated + + // value field + image varchar // URL to the image associated with the lesson + sound varchar // URL to the sound file associated with the lesson + word varchar // The word in English + word_c varchar // The word in Chinese + sample_e varchar // Sample sentence in English using the word + sample_c varchar // Sample sentence in Chinese using the word + cat_id integer [ref: > LessonCategories.id] // foreign key referring to LessonCategories.id + category varchar // The category to which the lesson belongs + lesson_type_id integer [ref: > LessonTypes.id] // foreign key referring to LessonTypes.id +} + +// Listening Practice Quiz Categories +// store listening practice category, (LpCategories, LpCategory) +Table QuizLPCategories { + // system fields + id text [pk] // changed from int to text to match PocketBase + created datetime [default: `now()`] + updated datetime + + // value fields + cat_name varchar [presentable: true] // added presentable flag + cat_image file // changed from blob to file type + pos number // changed from integer to number + init_answer json +} + +// Listening Practice Quiz Questions +Table QuizLPQuestions { + id int [pk, increment] + created datetime [default: `now()`] + updated datetime + word varchar + sound blob + cat_id integer [ref: > QuizLPCategories.id] +} + +// Matching Frenzy Quiz Categories +Table QuizMFCategories { + id int [pk, increment] + created datetime [default: `now()`] + updated datetime + cat_name varchar + cat_image blob + pos integer + init_answer json +} + +// Matching Frenzy Quiz Questions +Table QuizMFQuestions { + id int [pk, increment] + created datetime [default: `now()`] + updated datetime + word varchar + word_c varchar + cat_id integer [ref: > QuizMFCategories.id] +} + +// Connectives Revision Quiz Categories +Table QuizCRCategories { + id int [pk, increment] + created datetime [default: `now()`] + updated datetime + cat_name varchar + cat_image blob + pos integer + init_answer json +} + +// Connectives Revision Quiz Questions +Table QuizCRQuestions { + id int [pk, increment] + created datetime [default: `now()`] + updated datetime + question_fh varchar + question_sh varchar + modal_ans varchar + cat_id integer [ref: > QuizCRCategories.id] +} + +// Test table +Table t1 { + id int [pk, increment] + created datetime [default: `now()`] + updated datetime + name varchar +}