update for lp_categories,

This commit is contained in:
louiscklaw
2025-04-21 05:16:30 +08:00
parent 3679924a6a
commit f65f6df660
60 changed files with 1919 additions and 1047 deletions

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}