update,
This commit is contained in:
12
002_source/cms/src/db/QuizLPQuestions/Create.tsx
Normal file
12
002_source/cms/src/db/QuizLPQuestions/Create.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import { COL_QUIZ_LP_QUESTIONS } from '@/constants';
|
||||
import type { RecordModel } from 'pocketbase';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
interface CreateForm {
|
||||
// TODO: Add QuizLPQuestions fields
|
||||
}
|
||||
|
||||
export default function createQuizLPQuestion(data: CreateForm): Promise<RecordModel> {
|
||||
return pb.collection(COL_QUIZ_LP_QUESTIONS).create(data);
|
||||
}
|
7
002_source/cms/src/db/QuizLPQuestions/Delete.tsx
Normal file
7
002_source/cms/src/db/QuizLPQuestions/Delete.tsx
Normal file
@@ -0,0 +1,7 @@
|
||||
import { COL_QUIZ_LP_QUESTIONS } from '@/constants';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export default function deleteQuizLPQuestions(id: string): Promise<boolean> {
|
||||
return pb.collection(COL_QUIZ_LP_QUESTIONS).delete(id);
|
||||
}
|
8
002_source/cms/src/db/QuizLPQuestions/GetAll.tsx
Normal file
8
002_source/cms/src/db/QuizLPQuestions/GetAll.tsx
Normal file
@@ -0,0 +1,8 @@
|
||||
import { COL_QUIZ_LP_QUESTIONS } from '@/constants';
|
||||
import type { RecordModel } from 'pocketbase';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export default function getAllQuizLPQuestions(): Promise<RecordModel[]> {
|
||||
return pb.collection(COL_QUIZ_LP_QUESTIONS).getFullList();
|
||||
}
|
9
002_source/cms/src/db/QuizLPQuestions/GetAllCount.tsx
Normal file
9
002_source/cms/src/db/QuizLPQuestions/GetAllCount.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
// REQ0006
|
||||
import { COL_QUIZ_LP_QUESTIONS } from '@/constants';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export default async function GetAllCount(): Promise<number> {
|
||||
const { totalItems: count } = await pb.collection(COL_QUIZ_LP_QUESTIONS).getList(1, 9999, {});
|
||||
return count;
|
||||
}
|
8
002_source/cms/src/db/QuizLPQuestions/GetById.tsx
Normal file
8
002_source/cms/src/db/QuizLPQuestions/GetById.tsx
Normal file
@@ -0,0 +1,8 @@
|
||||
import { COL_QUIZ_LP_QUESTIONS } from '@/constants';
|
||||
import type { RecordModel } from 'pocketbase';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export default function getQuizLPQuestionById(id: string): Promise<RecordModel> {
|
||||
return pb.collection(COL_QUIZ_LP_QUESTIONS).getOne(id);
|
||||
}
|
14
002_source/cms/src/db/QuizLPQuestions/GetHiddenCount.tsx
Normal file
14
002_source/cms/src/db/QuizLPQuestions/GetHiddenCount.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
// REQ0006
|
||||
import { COL_QUIZ_LP_QUESTIONS } from '@/constants';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export default async function getHiddenQuizLPQuestionsCount(): Promise<number> {
|
||||
try {
|
||||
const result = await pb.collection(COL_QUIZ_LP_QUESTIONS).getList(1, 9999, { filter: 'visible = "hidden"' });
|
||||
const { totalItems: count } = result;
|
||||
return count;
|
||||
} catch (error) {
|
||||
return 0;
|
||||
}
|
||||
}
|
14
002_source/cms/src/db/QuizLPQuestions/GetVisibleCount.tsx
Normal file
14
002_source/cms/src/db/QuizLPQuestions/GetVisibleCount.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
// REQ0006
|
||||
import { COL_QUIZ_LP_QUESTIONS } from '@/constants';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export default async function getVisibleQuizLPQuestionsCount(): Promise<number> {
|
||||
try {
|
||||
const result = await pb.collection(COL_QUIZ_LP_QUESTIONS).getList(1, 9999, { filter: 'visible = "visible"' });
|
||||
const { totalItems: count } = result;
|
||||
return count;
|
||||
} catch (error) {
|
||||
return 0;
|
||||
}
|
||||
}
|
9
002_source/cms/src/db/QuizLPQuestions/Update.tsx
Normal file
9
002_source/cms/src/db/QuizLPQuestions/Update.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
import { COL_QUIZ_LP_CATEGORIES } from '@/constants';
|
||||
import type { RecordModel } from 'pocketbase';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
import type { CreateFormProps } from '@/components/dashboard/lp_categories/type';
|
||||
|
||||
export default function updateQuizLPCategory(id: string, data: CreateFormProps): Promise<RecordModel> {
|
||||
return pb.collection(COL_QUIZ_LP_CATEGORIES).update(id, data);
|
||||
}
|
18
002_source/cms/src/db/QuizLPQuestions/_PROMPT.md
Normal file
18
002_source/cms/src/db/QuizLPQuestions/_PROMPT.md
Normal file
@@ -0,0 +1,18 @@
|
||||
please help to review the `tsx` file in this folder
|
||||
`/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db/QuizLPQuestions`
|
||||
|
||||
it was clone from
|
||||
`LPCategories`
|
||||
please help to modify to
|
||||
`LPQuestions`
|
||||
|
||||
please also help to modify the name of
|
||||
`variables`, `constants`, `functions`, `classes`, components's name, paths
|
||||
|
||||
the db fields structures between them are the same
|
||||
|
||||
do not move the files
|
||||
do not create directories
|
||||
keep current folder structure is important
|
||||
|
||||
thanks
|
Reference in New Issue
Block a user