update for lp_categories,
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user