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);
|
||||
}
|
11
002_source/cms/src/db/LessonTypes/Create.tsx
Normal file
11
002_source/cms/src/db/LessonTypes/Create.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import { COL_LESSON_TYPES } from '@/constants';
|
||||
import type { RecordModel } from 'pocketbase';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
import type { CreateForm } from '@/components/dashboard/lesson_type/types';
|
||||
|
||||
// import type { CreateForm } from '@/components/dashboard/lesson_type/interfaces.ts.del';
|
||||
|
||||
export default function createLessonType(data: CreateForm): Promise<RecordModel> {
|
||||
return pb.collection(COL_LESSON_TYPES).create(data);
|
||||
}
|
7
002_source/cms/src/db/LessonTypes/Delete.tsx
Normal file
7
002_source/cms/src/db/LessonTypes/Delete.tsx
Normal file
@@ -0,0 +1,7 @@
|
||||
import { COL_LESSON_TYPES } from '@/constants';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export default function deleteLessonType(id: string): Promise<boolean> {
|
||||
return pb.collection(COL_LESSON_TYPES).delete(id);
|
||||
}
|
8
002_source/cms/src/db/LessonTypes/GetAll.tsx
Normal file
8
002_source/cms/src/db/LessonTypes/GetAll.tsx
Normal file
@@ -0,0 +1,8 @@
|
||||
import { COL_LESSON_TYPES } from '@/constants';
|
||||
import type { RecordModel } from 'pocketbase';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export default function getAllLessonTypes(): Promise<RecordModel[]> {
|
||||
return pb.collection(COL_LESSON_TYPES).getFullList();
|
||||
}
|
8
002_source/cms/src/db/LessonTypes/GetById.tsx
Normal file
8
002_source/cms/src/db/LessonTypes/GetById.tsx
Normal file
@@ -0,0 +1,8 @@
|
||||
import { COL_LESSON_TYPES } from '@/constants';
|
||||
import type { RecordModel } from 'pocketbase';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export default function getLessonTypeById(id: string): Promise<RecordModel> {
|
||||
return pb.collection(COL_LESSON_TYPES).getOne(id);
|
||||
}
|
9
002_source/cms/src/db/LessonTypes/Update.tsx
Normal file
9
002_source/cms/src/db/LessonTypes/Update.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
import { COL_LESSON_TYPES } from '@/constants';
|
||||
import type { RecordModel } from 'pocketbase';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
import type { CreateForm } from '@/components/dashboard/lesson_type/types';
|
||||
|
||||
export default function updateLessonType(id: string, data: CreateForm): Promise<RecordModel> {
|
||||
return pb.collection(COL_LESSON_TYPES).update(id, data);
|
||||
}
|
19
002_source/cms/src/db/_PROMPT.MD
Normal file
19
002_source/cms/src/db/_PROMPT.MD
Normal file
@@ -0,0 +1,19 @@
|
||||
# PROMPT
|
||||
|
||||
with reference to `src/db/LessonTypes/DBLessonTypes.tsx`, clone and modify to fit `DBLessonCategories.tsx` thanks.
|
||||
|
||||
---
|
||||
|
||||
# PROMPT
|
||||
|
||||
from `LessonTypes`, clone and modify to fit `LessonCategories` (e.g. CRUD) thanks.
|
||||
|
||||
---
|
||||
|
||||
# PROMPT
|
||||
|
||||
with reference to
|
||||
- `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/001_documentation/Requirements/REQ0006/schema.dbml`
|
||||
- `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db/LessonTypes`
|
||||
|
||||
draft `UserMeta` thanks
|
Reference in New Issue
Block a user