update,
This commit is contained in:
37
002_source/cms/src/db/DB_AI_GUIDELINE.MD
Normal file
37
002_source/cms/src/db/DB_AI_GUIDELINE.MD
Normal 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
|
11
002_source/cms/src/db/LessonCategories/GetAllCount.tsx
Normal file
11
002_source/cms/src/db/LessonCategories/GetAllCount.tsx
Normal 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;
|
||||
}
|
@@ -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);
|
||||
|
14
002_source/cms/src/db/LessonTypes/GetAllCount.tsx
Normal file
14
002_source/cms/src/db/LessonTypes/GetAllCount.tsx
Normal 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;
|
||||
}
|
||||
}
|
13
002_source/cms/src/db/UserMetas/GetAllCount.tsx
Normal file
13
002_source/cms/src/db/UserMetas/GetAllCount.tsx
Normal 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;
|
||||
}
|
||||
}
|
15
002_source/cms/src/db/Users/GetAllCount.tsx
Normal file
15
002_source/cms/src/db/Users/GetAllCount.tsx
Normal 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;
|
||||
}
|
||||
}
|
@@ -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
|
Reference in New Issue
Block a user