update build ok,
This commit is contained in:
13
002_source/cms/src/db/QuizCRQuestions/Create.tsx
Normal file
13
002_source/cms/src/db/QuizCRQuestions/Create.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
import { COL_QUIZ_CR_QUESTIONS } from '@/constants';
|
||||
import type { RecordModel } from 'pocketbase';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
import type { CreateFormProps } from '@/components/dashboard/cr/questions/type';
|
||||
|
||||
// interface CreateForm {
|
||||
// // TODO: Add QuizCRQuestions fields
|
||||
// }
|
||||
|
||||
export default function createQuizCRQuestion(data: CreateFormProps): Promise<RecordModel> {
|
||||
return pb.collection(COL_QUIZ_CR_QUESTIONS).create(data);
|
||||
}
|
7
002_source/cms/src/db/QuizCRQuestions/Delete.tsx
Normal file
7
002_source/cms/src/db/QuizCRQuestions/Delete.tsx
Normal file
@@ -0,0 +1,7 @@
|
||||
import { COL_QUIZ_CR_QUESTIONS } from '@/constants';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export default function deleteQuizCRQuestions(id: string): Promise<boolean> {
|
||||
return pb.collection(COL_QUIZ_CR_QUESTIONS).delete(id);
|
||||
}
|
8
002_source/cms/src/db/QuizCRQuestions/GetAll.tsx
Normal file
8
002_source/cms/src/db/QuizCRQuestions/GetAll.tsx
Normal file
@@ -0,0 +1,8 @@
|
||||
import { COL_QUIZ_CR_QUESTIONS } from '@/constants';
|
||||
import type { RecordModel } from 'pocketbase';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export default function getAllQuizCRQuestions(): Promise<RecordModel[]> {
|
||||
return pb.collection(COL_QUIZ_CR_QUESTIONS).getFullList();
|
||||
}
|
9
002_source/cms/src/db/QuizCRQuestions/GetAllCount.tsx
Normal file
9
002_source/cms/src/db/QuizCRQuestions/GetAllCount.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
// REQ0006
|
||||
import { COL_QUIZ_CR_QUESTIONS } from '@/constants';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export default async function GetAllCount(): Promise<number> {
|
||||
const { totalItems: count } = await pb.collection(COL_QUIZ_CR_QUESTIONS).getList(1, 9999, {});
|
||||
return count;
|
||||
}
|
14
002_source/cms/src/db/QuizCRQuestions/GetHiddenCount.tsx
Normal file
14
002_source/cms/src/db/QuizCRQuestions/GetHiddenCount.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
// REQ0006
|
||||
import { COL_QUIZ_CR_QUESTIONS } from '@/constants';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export default async function getHiddenQuizCRQuestionsCount(): Promise<number> {
|
||||
try {
|
||||
const result = await pb.collection(COL_QUIZ_CR_QUESTIONS).getList(1, 9999, { filter: 'visible = "hidden"' });
|
||||
const { totalItems: count } = result;
|
||||
return count;
|
||||
} catch (error) {
|
||||
return 0;
|
||||
}
|
||||
}
|
14
002_source/cms/src/db/QuizCRQuestions/GetVisibleCount.tsx
Normal file
14
002_source/cms/src/db/QuizCRQuestions/GetVisibleCount.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
// REQ0006
|
||||
import { COL_QUIZ_CR_QUESTIONS } from '@/constants';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export default async function getVisibleQuizCRQuestionsCount(): Promise<number> {
|
||||
try {
|
||||
const result = await pb.collection(COL_QUIZ_CR_QUESTIONS).getList(1, 9999, { filter: 'visible = "visible"' });
|
||||
const { totalItems: count } = result;
|
||||
return count;
|
||||
} catch (error) {
|
||||
return 0;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user