This commit is contained in:
louiscklaw
2025-04-21 07:09:46 +08:00
parent 8082afd711
commit 954a42aaa7
41 changed files with 2630 additions and 1394 deletions

View File

@@ -13,6 +13,9 @@ this is file in dbml syntax state the main database
please 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`
this is the content of `@/constants`
please look into the md files in folder `<base_dir>/002_source/cms/_AI_GUIDELINE`
please read, remember and link up the ideas in file stated above,
@@ -84,3 +87,13 @@ to the collection `QuizLPCategories` align the dbml file in the previous prompt
please modify `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/components/dashboard/lp_categories/_constants.tsx`
to follow the type definition in `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/types/LpCategory.tsx`, the constant `defaultLpCategory`
---
the constants file (`@/constants`) was `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/constants.ts`
please help to fix the `tsx` files in folder `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db/QuizMFCategories`,
the `COL` constants is wrongly used, it should refer to `COL_QUIZ_MF_CATEGORIES`. thanks
please update the `COL_XXXX` TO COL_MF_CATEGORIES

View File

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

View File

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

View File

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

View File

@@ -3,7 +3,7 @@ import { COL_QUIZ_MF_CATEGORIES } from '@/constants';
import { pb } from '@/lib/pb';
export default async function GetHiddenCount(): Promise<number> {
export default async function getHiddenQuizMFCategoriesCount(): Promise<number> {
try {
const result = await pb.collection(COL_QUIZ_MF_CATEGORIES).getList(1, 9999, { filter: 'visible = "hidden"' });
const { totalItems: count } = result;

View File

@@ -3,7 +3,7 @@ import { COL_QUIZ_MF_CATEGORIES } from '@/constants';
import { pb } from '@/lib/pb';
export default async function GetVisibleCount(): Promise<number> {
export default async function getVisibleQuizMFCategoriesCount(): Promise<number> {
try {
const result = await pb.collection(COL_QUIZ_MF_CATEGORIES).getList(1, 9999, { filter: 'visible = "visible"' });
const { totalItems: count } = result;

View File

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