update init db api,
This commit is contained in:
9
002_source/cms/src/db/LessonCategories/Create.tsx
Normal file
9
002_source/cms/src/db/LessonCategories/Create.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
import { COL_LESSON_CATEGORIES } from '@/constants';
|
||||
import type { RecordModel } from 'pocketbase';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
import type { CreateForm } from '@/components/dashboard/lesson_category/types';
|
||||
|
||||
export default function createLessonCategory(data: CreateForm): Promise<RecordModel> {
|
||||
return pb.collection(COL_LESSON_CATEGORIES).create(data);
|
||||
}
|
7
002_source/cms/src/db/LessonCategories/Delete.tsx
Normal file
7
002_source/cms/src/db/LessonCategories/Delete.tsx
Normal file
@@ -0,0 +1,7 @@
|
||||
import { COL_LESSON_CATEGORIES } from '@/constants';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export default function deleteLessonCategory(id: string): Promise<boolean> {
|
||||
return pb.collection(COL_LESSON_CATEGORIES).delete(id);
|
||||
}
|
8
002_source/cms/src/db/LessonCategories/GetAll.tsx
Normal file
8
002_source/cms/src/db/LessonCategories/GetAll.tsx
Normal file
@@ -0,0 +1,8 @@
|
||||
import { COL_LESSON_CATEGORIES } from '@/constants';
|
||||
import type { RecordModel } from 'pocketbase';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export default function getAllLessonCategories(): Promise<RecordModel[]> {
|
||||
return pb.collection(COL_LESSON_CATEGORIES).getFullList();
|
||||
}
|
8
002_source/cms/src/db/LessonCategories/GetById.tsx
Normal file
8
002_source/cms/src/db/LessonCategories/GetById.tsx
Normal file
@@ -0,0 +1,8 @@
|
||||
import { COL_LESSON_CATEGORIES } from '@/constants';
|
||||
import type { RecordModel } from 'pocketbase';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export default function getLessonCategoryById(id: string): Promise<RecordModel> {
|
||||
return pb.collection(COL_LESSON_CATEGORIES).getOne(id);
|
||||
}
|
5
002_source/cms/src/db/LessonCategories/Helloworld.tsx
Normal file
5
002_source/cms/src/db/LessonCategories/Helloworld.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
function Helloworld(): string {
|
||||
return 'helloworld';
|
||||
}
|
||||
|
||||
export { Helloworld };
|
9
002_source/cms/src/db/LessonCategories/Update.tsx
Normal file
9
002_source/cms/src/db/LessonCategories/Update.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
import { COL_LESSON_CATEGORIES } from '@/constants';
|
||||
import type { RecordModel } from 'pocketbase';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
import type { CreateForm } from '@/components/dashboard/lesson_category/types';
|
||||
|
||||
export default function updateLessonCategory(id: string, data: CreateForm): Promise<RecordModel> {
|
||||
return pb.collection(COL_LESSON_CATEGORIES).update(id, data);
|
||||
}
|
Reference in New Issue
Block a user