This commit is contained in:
louiscklaw
2025-04-18 23:41:37 +08:00
parent b1a7d9f7fa
commit eb94c3d596
16 changed files with 418 additions and 137 deletions

View File

@@ -0,0 +1,37 @@
# AI GUIDELINE
## Background information and References
please read `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/001_documentation/Requirements/REQ0006/schema.dbml`
please look into the md files in `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/_AI_GUIDELINE`
please read, remember and link up the ideas, i will tell you the task afterwards
---
working directory: `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db`
pleaes clone the `tsx` files from `LessonTypes` and `LessonCategories` to `UserMetas` and update the content
when you draft coding, review file and append with `.tsx.draft`
---
- this is part of react typescript project, with pocketbase
- `schema.dbml`, describe the collections(tables)
- folder `LessonCategories`, the correct references
- folder `LessonTypes`, the correct references
- you can find the `schema.dbml` and schema information from `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/001_documentation/Requirements/REQ0006`
- do not read root directory, assume it is a fresh copy of nextjs project is ok
## instruction
- break the questions into smaller parts
- review file append with `.draft`, see if the content aligned with the correct references
- read and understand `dbml` file
- lookup the every folder
## tasks
Thanks

View File

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

View File

@@ -4,7 +4,6 @@ import type { RecordModel } from 'pocketbase';
import { pb } from '@/lib/pb';
import type { CreateForm } from '@/components/dashboard/lesson_type/types';
// import type { CreateForm } from '@/components/dashboard/lesson_type/interfaces.ts.del';
export default function createLessonType(data: CreateForm): Promise<RecordModel> {
return pb.collection(COL_LESSON_TYPES).create(data);

View File

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

View File

@@ -0,0 +1,13 @@
import { COL_USER_METAS } from '@/constants';
import { pb } from '@/lib/pb';
export default async function getAllUserMetasCount(): Promise<number> {
try {
const result = await pb.collection(COL_USER_METAS).getList(1, 9998);
return result.totalItems;
} catch (error) {
console.error(error);
return -99;
}
}

View File

@@ -0,0 +1,15 @@
// REQ0006
import { COL_USERS } from '@/constants';
import { pb } from '@/lib/pb';
export default async function GetAllCount(): Promise<number> {
try {
const result = await pb.collection(`users`).getList(1, 9999, { filter: 'email != ""' });
const { totalItems: count } = result;
return count;
} catch (error) {
console.error(error);
return -99;
}
}

View File

@@ -1,19 +0,0 @@
# PROMPT
with reference to `src/db/LessonTypes/DBLessonTypes.tsx`, clone and modify to fit `DBLessonCategories.tsx` thanks.
---
# PROMPT
from `LessonTypes`, clone and modify to fit `LessonCategories` (e.g. CRUD) thanks.
---
# PROMPT
with reference to
- `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/001_documentation/Requirements/REQ0006/schema.dbml`
- `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db/LessonTypes`
draft `UserMeta` thanks