update for lp_categories,
This commit is contained in:
@@ -79,3 +79,8 @@ please revise
|
||||
`/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/types/LpCategory.tsx` `interface LpCategory`
|
||||
|
||||
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`
|
||||
|
@@ -2,8 +2,8 @@ import { COL_LESSON_CATEGORIES } from '@/constants';
|
||||
import type { RecordModel } from 'pocketbase';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
import type { CreateForm } from '@/components/dashboard/lp_categories/type';
|
||||
import type { CreateFormProps } from '@/components/dashboard/lp_categories/type';
|
||||
|
||||
export default function createLessonCategory(data: CreateForm): Promise<RecordModel> {
|
||||
export default function createLessonCategory(data: CreateFormProps): Promise<RecordModel> {
|
||||
return pb.collection(COL_LESSON_CATEGORIES).create(data);
|
||||
}
|
||||
|
@@ -1,9 +1,14 @@
|
||||
// REQ0006
|
||||
// RULES:
|
||||
// error handled by caller
|
||||
// contain definition to collection only
|
||||
|
||||
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, {});
|
||||
return count;
|
||||
export default function getAllLessonCategoriesCount(): Promise<number> {
|
||||
return pb
|
||||
.collection(COL_LESSON_CATEGORIES)
|
||||
.getList(1, 9999)
|
||||
.then((res) => res.totalItems);
|
||||
}
|
||||
|
@@ -2,8 +2,8 @@ import { COL_LESSON_CATEGORIES } from '@/constants';
|
||||
import type { RecordModel } from 'pocketbase';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
import type { CreateForm } from '@/components/dashboard/lp_categories/type';
|
||||
import type { CreateFormProps } from '@/components/dashboard/lp_categories/type';
|
||||
|
||||
export default function updateLessonCategory(id: string, data: CreateForm): Promise<RecordModel> {
|
||||
export default function updateLessonCategory(id: string, data: CreateFormProps): Promise<RecordModel> {
|
||||
return pb.collection(COL_LESSON_CATEGORIES).update(id, data);
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { COL_QUIZ_LISTENINGS } from '@/constants';
|
||||
import { COL_LISTENINGS_PRACTICE_CATEGORIES } from '@/constants';
|
||||
import type { RecordModel } from 'pocketbase';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export default function deleteQuizListening(id: string): Promise<boolean> {
|
||||
return pb.collection(COL_QUIZ_LISTENINGS).delete(id);
|
||||
return pb.collection(COL_LISTENINGS_PRACTICE_CATEGORIES).delete(id);
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { COL_QUIZ_LISTENINGS } from '@/constants';
|
||||
import { COL_LISTENINGS_PRACTICE_CATEGORIES } from '@/constants';
|
||||
import type { RecordModel } from 'pocketbase';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export default function getAllQuizListenings(): Promise<RecordModel[]> {
|
||||
return pb.collection(COL_QUIZ_LISTENINGS).getFullList();
|
||||
return pb.collection(COL_LISTENINGS_PRACTICE_CATEGORIES).getFullList();
|
||||
}
|
||||
|
@@ -1,9 +1,9 @@
|
||||
// REQ0006
|
||||
import { COL_QUIZ_LISTENINGS } from '@/constants';
|
||||
import { COL_LISTENINGS_PRACTICE_CATEGORIES } from '@/constants';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export default async function GetAllCount(): Promise<number> {
|
||||
const { totalItems: count } = await pb.collection(COL_QUIZ_LISTENINGS).getList(1, 9999, {});
|
||||
const { totalItems: count } = await pb.collection(COL_LISTENINGS_PRACTICE_CATEGORIES).getList(1, 9999, {});
|
||||
return count;
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { COL_QUIZ_LISTENINGS } from '@/constants';
|
||||
import { COL_LISTENINGS_PRACTICE_CATEGORIES } from '@/constants';
|
||||
import type { RecordModel } from 'pocketbase';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export default function getQuizListeningById(id: string): Promise<RecordModel> {
|
||||
return pb.collection(COL_QUIZ_LISTENINGS).getOne(id);
|
||||
return pb.collection(COL_LISTENINGS_PRACTICE_CATEGORIES).getOne(id);
|
||||
}
|
||||
|
@@ -1,11 +1,13 @@
|
||||
// REQ0006
|
||||
import { COL_QUIZ_LISTENINGS } from '@/constants';
|
||||
import { COL_LISTENINGS_PRACTICE_CATEGORIES } from '@/constants';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export default async function GetHiddenCount(): Promise<number> {
|
||||
try {
|
||||
const result = await pb.collection(COL_QUIZ_LISTENINGS).getList(1, 9999, { filter: 'visible = "hidden"' });
|
||||
const result = await pb
|
||||
.collection(COL_LISTENINGS_PRACTICE_CATEGORIES)
|
||||
.getList(1, 9999, { filter: 'visible = "hidden"' });
|
||||
const { totalItems: count } = result;
|
||||
return count;
|
||||
} catch (error) {
|
||||
|
@@ -1,11 +1,13 @@
|
||||
// REQ0006
|
||||
import { COL_QUIZ_LISTENINGS } from '@/constants';
|
||||
import { COL_LISTENINGS_PRACTICE_CATEGORIES } from '@/constants';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export default async function GetVisibleCount(): Promise<number> {
|
||||
try {
|
||||
const result = await pb.collection(COL_QUIZ_LISTENINGS).getList(1, 9999, { filter: 'visible = "visible"' });
|
||||
const result = await pb
|
||||
.collection(COL_LISTENINGS_PRACTICE_CATEGORIES)
|
||||
.getList(1, 9999, { filter: 'visible = "visible"' });
|
||||
const { totalItems: count } = result;
|
||||
return count;
|
||||
} catch (error) {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { COL_QUIZ_LISTENINGS } from '@/constants';
|
||||
import { COL_LISTENINGS_PRACTICE_CATEGORIES } from '@/constants';
|
||||
import type { ListResult, RecordModel } from 'pocketbase';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
@@ -18,5 +18,5 @@ export default function listWithOption({
|
||||
rowsPerPage,
|
||||
listOption = {},
|
||||
}: ListWithOptionParams): Promise<ListResult<RecordModel>> {
|
||||
return pb.collection(COL_QUIZ_LISTENINGS).getList(currentPage + 1, rowsPerPage, listOption);
|
||||
return pb.collection(COL_LISTENINGS_PRACTICE_CATEGORIES).getList(currentPage + 1, rowsPerPage, listOption);
|
||||
}
|
||||
|
@@ -1,13 +1,14 @@
|
||||
// RULES:
|
||||
// error handled by caller
|
||||
// contain definition to collection only
|
||||
|
||||
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;
|
||||
}
|
||||
export default function getAllUserMetasCount(): Promise<number> {
|
||||
return pb
|
||||
.collection(COL_USER_METAS)
|
||||
.getList(1, 9998)
|
||||
.then((res) => res.totalItems);
|
||||
}
|
||||
|
23
002_source/cms/src/db/_PROMPT/1.MD
Normal file
23
002_source/cms/src/db/_PROMPT/1.MD
Normal file
@@ -0,0 +1,23 @@
|
||||
Hi, please study the documentation below,
|
||||
i will send you the task afterwards,
|
||||
|
||||
please read and understand the documentation below and link up the ideas
|
||||
reply `OK` when you done
|
||||
no need to state me any other things, thanks
|
||||
|
||||
1. `schema.dbml`
|
||||
|
||||
- this describe the database schema in dbml format
|
||||
- filepath: `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/001_documentation/Requirements/REQ0006/schema.dbml`
|
||||
|
||||
2. `schema.json`
|
||||
|
||||
- this is the schema export in pocketbase format
|
||||
- filepath: `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db/schema.json`
|
||||
|
||||
3. `_AI_GUIDELINE`:
|
||||
|
||||
- there are the markdown files that help you better understand the implementation
|
||||
- directory: `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/_AI_GUIDELINE`
|
||||
|
||||
thanks
|
35
002_source/cms/src/db/_PROMPT/2.MD
Normal file
35
002_source/cms/src/db/_PROMPT/2.MD
Normal file
@@ -0,0 +1,35 @@
|
||||
update `LpCategoryDefaultValue`
|
||||
in file `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/components/dashboard/lp_categories/_constants.ts`
|
||||
|
||||
thanks
|
||||
|
||||
you can find the type def in `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/types/LpCategory.tsx`
|
||||
|
||||
please help to draft code file:
|
||||
|
||||
base_dir=`/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db`
|
||||
|
||||
using
|
||||
`$base_dir/QuizListenings/GetHiddenCount.tsx`,
|
||||
`$base_dir/QuizListenings/GetVisibleCount.tsx`,
|
||||
`$base_dir/LessonTypes/GetHiddenCount.tsx`,
|
||||
`$base_dir/LessonTypes/GetVisibleCount.tsx`,
|
||||
as reference,
|
||||
|
||||
look into the all directories under base_dir e.g. `QuizCategories`.
|
||||
propergate `GetHiddenCount.tsx` and `GetVisibleCount.tsx` if missing, do the change to suit the collection.
|
||||
use `<filename>.draft.tsx` instead when you write file
|
||||
|
||||
---
|
||||
|
||||
rewrite `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db/LessonCategories/GetAllCount.tsx` to match `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db/UserMetas/GetAllCount.tsx` style
|
||||
|
||||
---
|
||||
|
||||
style rewrite
|
||||
|
||||
study
|
||||
`/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/components/dashboard/overview/summary/ActiveUserCount/index.tsx`
|
||||
`/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/components/dashboard/overview/summary/LessonCategoriesCount/index.tsx`
|
||||
|
||||
and rewrite `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/components/dashboard/overview/summary/LessonTypeCount/index.tsx` to match style above thanks
|
47
002_source/cms/src/db/_PROMPT/3.MD
Normal file
47
002_source/cms/src/db/_PROMPT/3.MD
Normal file
@@ -0,0 +1,47 @@
|
||||
please draft with idea:
|
||||
|
||||
```
|
||||
await pb
|
||||
.collection(COL_LESSON_TYPES)
|
||||
.getList(currentPage + 1, rowsPerPage, listOption);
|
||||
```
|
||||
|
||||
for Listening Practice
|
||||
|
||||
thanks
|
||||
|
||||
I want you to clone
|
||||
from `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db/LessonTypes/GetVisibleCount.tsx` (source file)
|
||||
|
||||
to `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db/QuizListenings/GetVisibleCount.tsx` (dest file)
|
||||
|
||||
please extract , link up and remember the document properties
|
||||
(e.g. types, functions, variables, constants, etc)
|
||||
from source file
|
||||
draft dest file
|
||||
|
||||
update the variables and properties of dest file to reflect `listening practice categories`/`lp_categories`
|
||||
|
||||
---
|
||||
|
||||
## task
|
||||
|
||||
update `schema.dbml` to reflect `schema.json`
|
||||
|
||||
## details
|
||||
|
||||
Hi,
|
||||
I have a pocketbase export json file:
|
||||
`/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/pocketbase/pb_hooks/seed/schema.json`
|
||||
|
||||
and a dbml file:
|
||||
`/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/001_documentation/Requirements/REQ0006/schema.dbml`
|
||||
|
||||
the collection name in pocketbase should be reflected by a table in dbml,
|
||||
|
||||
## steps
|
||||
|
||||
compare `schema.json` and `schema.dbml`
|
||||
please keep `schema.json` remain unchanged
|
||||
update `schema.dbml` to reflect `schema.json`
|
||||
do check again when finished
|
57
002_source/cms/src/db/_PROMPT/4.md
Normal file
57
002_source/cms/src/db/_PROMPT/4.md
Normal file
@@ -0,0 +1,57 @@
|
||||
---
|
||||
|
||||
clone `GetVisibleCount.tsx` and `GetHiddenCount.tsx` from `LessonTypes` to `LessonCategories` and update it
|
||||
|
||||
please draft `GetHiddenCount.tsx` for COL_LESSON_TYPES and `status = hidden`
|
||||
|
||||
well done !, please proceed to another request
|
||||
|
||||
working directory: `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db`
|
||||
|
||||
according information from `schema.json`, get the collection of `Students`
|
||||
|
||||
pleaes clone the `tsx` files from `LessonTypes` and `LessonCategories` to `Students` 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
|
||||
|
||||
---
|
||||
|
||||
please take a look in `schema.dbml` and `schema.json`,
|
||||
associate the collection from json file to the table in dbml file
|
||||
|
||||
please modify the `schema.dbml` to align with `schema.json`
|
||||
|
||||
to the collection `QuizLPCategories` align the dbml file in the previous prompt
|
||||
|
||||
---
|
||||
|
||||
please revise
|
||||
|
||||
please revise
|
||||
`/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/types/LpCategory.tsx` `interface LpCategory`
|
||||
|
||||
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`
|
6
002_source/cms/src/db/_PROMPT/temp.md
Normal file
6
002_source/cms/src/db/_PROMPT/temp.md
Normal file
@@ -0,0 +1,6 @@
|
||||
`/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/components/dashboard/lp_categories/lp-categories-filters.tsx`
|
||||
|
||||
this file is original for `lesson_category` model,
|
||||
please modify it to fit `lp_category` (listening practice category)
|
||||
|
||||
thanks
|
@@ -1356,6 +1356,59 @@
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"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"
|
||||
}
|
||||
],
|
||||
"indexes": [],
|
||||
@@ -2648,4 +2701,4 @@
|
||||
"indexes": [],
|
||||
"system": false
|
||||
}
|
||||
]
|
||||
]
|
||||
|
Reference in New Issue
Block a user