This commit is contained in:
louiscklaw
2025-04-21 12:15:25 +08:00
parent ac7d3883fd
commit 00a978e55a
67 changed files with 3423 additions and 136 deletions

View File

@@ -2,27 +2,34 @@
## 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`
please read `<base_dir>/001_documentation/Requirements/REQ0006/schema.dbml`
- read `<base_dir>/001_documentation/Requirements/REQ0006/schema.dbml`
this is file in dbml syntax state the main database
please read `<base_dir>/002_source/cms/src/db/schema.json`
- read `<base_dir>/002_source/cms/src/db/schema.json`
this is the file of live pocketbase schema output
please read `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/constants.ts`
- read `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/constants.ts`
this is the content of `@/constants`
please look into the md files in folder `<base_dir>/002_source/cms/_AI_GUIDELINE`
- look into the md files in folder `<base_dir>/002_source/cms/_AI_GUIDELINE`
- read, remember and link up the ideas in file stated above,
i will tell them the task afterwards
The software engineer will provide solutions, while QA engineer will feedback the opinion.
please read, remember and link up the ideas in file stated above,
i will tell you the task afterwards
this is now not in debug phase,
so, no need to reply me what you are going on or your insight throught the prompt.
so, no need to reply me what they are going on or their insight throught the prompt.
just reply me "OK" when done
---

View File

@@ -0,0 +1,12 @@
import { COL_QUIZ_LP_CATEGORIES } from '@/constants';
import type { RecordModel } from 'pocketbase';
import { pb } from '@/lib/pb';
interface CreateForm {
// TODO: Add QuizLPCategories fields
}
export default function createQuizLPCategory(data: CreateForm): Promise<RecordModel> {
return pb.collection(COL_QUIZ_LP_CATEGORIES).create(data);
}

View File

@@ -0,0 +1,7 @@
import { COL_QUIZ_LP_CATEGORIES } from '@/constants';
import { pb } from '@/lib/pb';
export default function deleteQuizLPCategories(id: string): Promise<boolean> {
return pb.collection(COL_QUIZ_LP_CATEGORIES).delete(id);
}

View File

@@ -0,0 +1,8 @@
import { COL_QUIZ_LP_CATEGORIES } from '@/constants';
import type { RecordModel } from 'pocketbase';
import { pb } from '@/lib/pb';
export default function getAllQuizLPCategories(): Promise<RecordModel[]> {
return pb.collection(COL_QUIZ_LP_CATEGORIES).getFullList();
}

View File

@@ -0,0 +1,9 @@
// REQ0006
import { COL_QUIZ_LP_CATEGORIES } from '@/constants';
import { pb } from '@/lib/pb';
export default async function GetAllCount(): Promise<number> {
const { totalItems: count } = await pb.collection(COL_QUIZ_LP_CATEGORIES).getList(1, 9999, {});
return count;
}

View File

@@ -0,0 +1,8 @@
import { COL_QUIZ_LP_CATEGORIES } from '@/constants';
import type { RecordModel } from 'pocketbase';
import { pb } from '@/lib/pb';
export default function getQuizLPCategoryById(id: string): Promise<RecordModel> {
return pb.collection(COL_QUIZ_LP_CATEGORIES).getOne(id);
}

View File

@@ -0,0 +1,14 @@
// REQ0006
import { COL_QUIZ_LP_CATEGORIES } from '@/constants';
import { pb } from '@/lib/pb';
export default async function getHiddenQuizLPCategoriesCount(): Promise<number> {
try {
const result = await pb.collection(COL_QUIZ_LP_CATEGORIES).getList(1, 9999, { filter: 'visible = "hidden"' });
const { totalItems: count } = result;
return count;
} catch (error) {
return 0;
}
}

View File

@@ -0,0 +1,14 @@
// REQ0006
import { COL_QUIZ_LP_CATEGORIES } from '@/constants';
import { pb } from '@/lib/pb';
export default async function getVisibleQuizLPCategoriesCount(): Promise<number> {
try {
const result = await pb.collection(COL_QUIZ_LP_CATEGORIES).getList(1, 9999, { filter: 'visible = "visible"' });
const { totalItems: count } = result;
return count;
} catch (error) {
return 0;
}
}

View File

@@ -0,0 +1,9 @@
import { COL_QUIZ_LP_CATEGORIES } from '@/constants';
import type { RecordModel } from 'pocketbase';
import { pb } from '@/lib/pb';
import type { CreateFormProps } from '@/components/dashboard/lp_categories/type';
export default function updateQuizLPCategory(id: string, data: CreateFormProps): Promise<RecordModel> {
return pb.collection(COL_QUIZ_LP_CATEGORIES).update(id, data);
}

View File

@@ -0,0 +1,18 @@
please help to review the `tsx` file in this folder
`/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db/QuizLPCategories`
it was clone from
`MFCategories`
please help to modify to
`LPCategories`
please also help to modify the name of
`variables`, `constants`, `functions`, `classes`, components's name, paths
the db fields structures between them are the same
do not move the files
do not create directories
keep current folder structure is important
thanks

View File

@@ -0,0 +1,12 @@
import { COL_QUIZ_LP_QUESTIONS } from '@/constants';
import type { RecordModel } from 'pocketbase';
import { pb } from '@/lib/pb';
interface CreateForm {
// TODO: Add QuizLPQuestions fields
}
export default function createQuizLPQuestion(data: CreateForm): Promise<RecordModel> {
return pb.collection(COL_QUIZ_LP_QUESTIONS).create(data);
}

View File

@@ -0,0 +1,7 @@
import { COL_QUIZ_LP_QUESTIONS } from '@/constants';
import { pb } from '@/lib/pb';
export default function deleteQuizLPQuestions(id: string): Promise<boolean> {
return pb.collection(COL_QUIZ_LP_QUESTIONS).delete(id);
}

View File

@@ -0,0 +1,8 @@
import { COL_QUIZ_LP_QUESTIONS } from '@/constants';
import type { RecordModel } from 'pocketbase';
import { pb } from '@/lib/pb';
export default function getAllQuizLPQuestions(): Promise<RecordModel[]> {
return pb.collection(COL_QUIZ_LP_QUESTIONS).getFullList();
}

View File

@@ -0,0 +1,9 @@
// REQ0006
import { COL_QUIZ_LP_QUESTIONS } from '@/constants';
import { pb } from '@/lib/pb';
export default async function GetAllCount(): Promise<number> {
const { totalItems: count } = await pb.collection(COL_QUIZ_LP_QUESTIONS).getList(1, 9999, {});
return count;
}

View File

@@ -0,0 +1,8 @@
import { COL_QUIZ_LP_QUESTIONS } from '@/constants';
import type { RecordModel } from 'pocketbase';
import { pb } from '@/lib/pb';
export default function getQuizLPQuestionById(id: string): Promise<RecordModel> {
return pb.collection(COL_QUIZ_LP_QUESTIONS).getOne(id);
}

View File

@@ -0,0 +1,14 @@
// REQ0006
import { COL_QUIZ_LP_QUESTIONS } from '@/constants';
import { pb } from '@/lib/pb';
export default async function getHiddenQuizLPQuestionsCount(): Promise<number> {
try {
const result = await pb.collection(COL_QUIZ_LP_QUESTIONS).getList(1, 9999, { filter: 'visible = "hidden"' });
const { totalItems: count } = result;
return count;
} catch (error) {
return 0;
}
}

View File

@@ -0,0 +1,14 @@
// REQ0006
import { COL_QUIZ_LP_QUESTIONS } from '@/constants';
import { pb } from '@/lib/pb';
export default async function getVisibleQuizLPQuestionsCount(): Promise<number> {
try {
const result = await pb.collection(COL_QUIZ_LP_QUESTIONS).getList(1, 9999, { filter: 'visible = "visible"' });
const { totalItems: count } = result;
return count;
} catch (error) {
return 0;
}
}

View File

@@ -0,0 +1,9 @@
import { COL_QUIZ_LP_CATEGORIES } from '@/constants';
import type { RecordModel } from 'pocketbase';
import { pb } from '@/lib/pb';
import type { CreateFormProps } from '@/components/dashboard/lp_categories/type';
export default function updateQuizLPCategory(id: string, data: CreateFormProps): Promise<RecordModel> {
return pb.collection(COL_QUIZ_LP_CATEGORIES).update(id, data);
}

View File

@@ -0,0 +1,18 @@
please help to review the `tsx` file in this folder
`/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db/QuizLPQuestions`
it was clone from
`LPCategories`
please help to modify to
`LPQuestions`
please also help to modify the name of
`variables`, `constants`, `functions`, `classes`, components's name, paths
the db fields structures between them are the same
do not move the files
do not create directories
keep current folder structure is important
thanks

View File

@@ -1479,6 +1479,109 @@
"system": false,
"type": "relation"
},
{
"autogeneratePattern": "",
"hidden": false,
"id": "text1125157303",
"max": 0,
"min": 0,
"name": "cat_name",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
},
{
"hidden": false,
"id": "file2034676914",
"maxSelect": 1,
"maxSize": 0,
"mimeTypes": [],
"name": "cat_image",
"presentable": false,
"protected": false,
"required": false,
"system": false,
"thumbs": [],
"type": "file"
},
{
"hidden": false,
"id": "number2161764012",
"max": null,
"min": null,
"name": "pos",
"onlyInt": false,
"presentable": false,
"required": false,
"system": false,
"type": "number"
},
{
"hidden": false,
"id": "json3915970527",
"maxSize": 0,
"name": "init_answer",
"presentable": false,
"required": false,
"system": false,
"type": "json"
},
{
"autogeneratePattern": "",
"hidden": false,
"id": "text2058414169",
"max": 0,
"min": 0,
"name": "visible",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
},
{
"autogeneratePattern": "",
"hidden": false,
"id": "text2560465762",
"max": 0,
"min": 0,
"name": "slug",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
},
{
"autogeneratePattern": "",
"hidden": false,
"id": "text1156222427",
"max": 0,
"min": 0,
"name": "remarks",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
},
{
"convertURLs": false,
"hidden": false,
"id": "editor1843675174",
"maxSize": 0,
"name": "description",
"presentable": false,
"required": false,
"system": false,
"type": "editor"
},
{
"hidden": false,
"id": "autodate2990389176",
@@ -1685,6 +1788,20 @@
"presentable": false,
"system": false,
"type": "autodate"
},
{
"autogeneratePattern": "",
"hidden": false,
"id": "text2058414169",
"max": 0,
"min": 0,
"name": "visible",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
}
],
"indexes": [],
@@ -2701,4 +2818,4 @@
"indexes": [],
"system": false
}
]
]