This commit is contained in:
louiscklaw
2025-04-19 02:11:44 +08:00
parent 50b69d3ce8
commit 60a0cdc11d
30 changed files with 391 additions and 184 deletions

View File

@@ -12,6 +12,10 @@ 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`
clone `GetVisibleCount.tsx` and `GetHiddenCount.tsx` from `LessonTypes` to `LessonCategories` and update it
please draft `GetHiddenCount.tsx` for COL_LESSON_TYPES and `status = hidden`
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`

View File

View File

@@ -4,8 +4,6 @@ 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"' });
const { totalItems: count } = await pb.collection(COL_LESSON_CATEGORIES).getList(1, 9999, {});
return count;
}

View File

@@ -0,0 +1,14 @@
// REQ0006
import { COL_LESSON_CATEGORIES } from '@/constants';
import { pb } from '@/lib/pb';
export default async function GetHiddenCount(): Promise<number> {
try {
const result = await pb.collection(COL_LESSON_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_LESSON_CATEGORIES } from '@/constants';
import { pb } from '@/lib/pb';
export default async function GetVisibleCount(): Promise<number> {
try {
const result = await pb.collection(COL_LESSON_CATEGORIES).getList(1, 9999, { filter: 'visible = "visible"' });
const { totalItems: count } = result;
return count;
} catch (error) {
return 0;
}
}

View File

@@ -5,7 +5,7 @@ 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 result = await pb.collection(COL_LESSON_TYPES).getList(1, 9999, {});
const { totalItems: count } = result;
return count;
} catch (error) {

View File

@@ -0,0 +1,14 @@
// REQ0006
import { COL_LESSON_TYPES } from '@/constants';
import { pb } from '@/lib/pb';
export default async function GetHiddenCount(): Promise<number> {
try {
const result = await pb.collection(COL_LESSON_TYPES).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_LESSON_TYPES } from '@/constants';
import { pb } from '@/lib/pb';
export default async function GetVisibleCount(): 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;
}
}