update build ok,
This commit is contained in:
@@ -22,8 +22,8 @@
|
|||||||
"test": "jest --watch",
|
"test": "jest --watch",
|
||||||
"update_doc": "cd 001_documentation/Requirements && node update_req_index.js",
|
"update_doc": "cd 001_documentation/Requirements && node update_req_index.js",
|
||||||
"update_doc:w": "pnpx nodemon --ext md --exec \"pnpm run update_doc\"",
|
"update_doc:w": "pnpx nodemon --ext md --exec \"pnpm run update_doc\"",
|
||||||
"update_repomix": "npx repomix",
|
"update_repomix": "node ./scripts/update_repomix.js",
|
||||||
"update_repomix:w": "pnpx nodemon --delay 3 --exec \"pnpx repomix\"",
|
"update_repomix:w": "pnpx nodemon --delay 3 --exec \"npm run update_repomix\"",
|
||||||
"clean": "rm -rf node_modules && rm -rf .next"
|
"clean": "rm -rf node_modules && rm -rf .next"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -116,4 +116,4 @@
|
|||||||
"protobufjs"
|
"protobufjs"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -28,7 +28,9 @@ const config = {
|
|||||||
'',
|
'',
|
||||||
'^[./]',
|
'^[./]',
|
||||||
],
|
],
|
||||||
plugins: ['@ianvs/prettier-plugin-sort-imports'],
|
plugins: [
|
||||||
|
// '@ianvs/prettier-plugin-sort-imports'
|
||||||
|
],
|
||||||
overrides: [
|
overrides: [
|
||||||
{
|
{
|
||||||
files: ['*.tsx'],
|
files: ['*.tsx'],
|
||||||
|
7
002_source/cms/scripts/005_update_repomix.sh
Executable file
7
002_source/cms/scripts/005_update_repomix.sh
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
node ./scripts/update_repomix.js
|
||||||
|
|
||||||
|
echo "done"
|
@@ -1,19 +1,23 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -ex
|
set -x
|
||||||
|
|
||||||
# ls **/.next
|
# ls **/.next
|
||||||
# ls **/.pnpm
|
# ls **/.pnpm
|
||||||
# ls **/node_modules
|
# ls **/node_modules
|
||||||
|
ls **/*.bak
|
||||||
|
ls **/*draft
|
||||||
|
ls **/*.del
|
||||||
|
ls **/*.plan
|
||||||
ls **/*Zone*
|
ls **/*Zone*
|
||||||
|
|
||||||
set -e
|
# set -e
|
||||||
|
|
||||||
read -p "Press [Enter] key to clean directories..."
|
# read -p "Press [Enter] key to clean directories..."
|
||||||
|
|
||||||
# rm -rf **/.next
|
# # rm -rf **/.next
|
||||||
# rm -rf **/.pnpm
|
# # rm -rf **/.pnpm
|
||||||
# rm -rf **/node_modules
|
# # rm -rf **/node_modules
|
||||||
rm -rf **/*Zone*
|
# rm -rf **/*Zone*
|
||||||
|
|
||||||
echo "clean done"
|
echo "clean done"
|
||||||
|
37
002_source/cms/scripts/update_repomix.js
Normal file
37
002_source/cms/scripts/update_repomix.js
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
const exec = require('child_process').exec;
|
||||||
|
|
||||||
|
let directories = [
|
||||||
|
//
|
||||||
|
'./src/db',
|
||||||
|
'src/app/dashboard/lp',
|
||||||
|
'src/app/dashboard/mf',
|
||||||
|
'src/app/dashboard/cr',
|
||||||
|
'src/components/dashboard/lp',
|
||||||
|
'src/components/dashboard/mf',
|
||||||
|
'src/components/dashboard/cr',
|
||||||
|
'src/app/dashboard/Sample',
|
||||||
|
].map((directory) => {
|
||||||
|
return `cd ${directory} && pnpx repomix`;
|
||||||
|
});
|
||||||
|
|
||||||
|
Promise.all(
|
||||||
|
directories.map(
|
||||||
|
(directory) =>
|
||||||
|
new Promise((resolve, reject) => {
|
||||||
|
exec(directory, (error, stdout, stderr) => {
|
||||||
|
if (error) {
|
||||||
|
reject(error);
|
||||||
|
} else {
|
||||||
|
console.log(stdout);
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.then(() => {
|
||||||
|
console.log('done');
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
@@ -5,10 +5,9 @@ import { useRouter } from 'next/navigation';
|
|||||||
// import { COL_LESSON_CATEGORIES } from '@/constants';
|
// import { COL_LESSON_CATEGORIES } from '@/constants';
|
||||||
|
|
||||||
// RULES: Quiz
|
// RULES: Quiz
|
||||||
import GetAllCount from '@/db/QuizListenings/GetAllCount';
|
import GetAllCount from '@/db/QuizMFCategories/GetAllCount';
|
||||||
import GetHiddenCount from '@/db/QuizListenings/GetHiddenCount';
|
import GetHiddenCount from '@/db/QuizMFCategories/GetHiddenCount';
|
||||||
// import GetVisibleCount from '@/db/QuizListenings/GetVisibleCount';
|
import GetVisibleCount from '@/db/QuizMFCategories/GetVisibleCount';
|
||||||
// import GetVisibleCount from '@/db/Q';
|
|
||||||
//
|
//
|
||||||
import Button from '@mui/material/Button';
|
import Button from '@mui/material/Button';
|
||||||
import Chip from '@mui/material/Chip';
|
import Chip from '@mui/material/Chip';
|
||||||
@@ -28,7 +27,7 @@ import { FilterButton, FilterPopover, useFilterContext } from '@/components/core
|
|||||||
import { Option } from '@/components/core/option';
|
import { Option } from '@/components/core/option';
|
||||||
|
|
||||||
import { useCrCategoriesSelection } from './cr-categories-selection-context';
|
import { useCrCategoriesSelection } from './cr-categories-selection-context';
|
||||||
import { CrCategory } from './type';
|
import type { CrCategory } from './type';
|
||||||
|
|
||||||
export interface Filters {
|
export interface Filters {
|
||||||
email?: string;
|
email?: string;
|
||||||
|
@@ -23,7 +23,7 @@ import { paths } from '@/paths';
|
|||||||
import { FilterButton, FilterPopover, useFilterContext } from '@/components/core/filter-button';
|
import { FilterButton, FilterPopover, useFilterContext } from '@/components/core/filter-button';
|
||||||
import { Option } from '@/components/core/option';
|
import { Option } from '@/components/core/option';
|
||||||
|
|
||||||
import { useLpQuestionsSelection } from './cr-questions-selection-context';
|
import { useCrQuestionsSelection } from './cr-questions-selection-context';
|
||||||
import { CrQuestion } from './type';
|
import { CrQuestion } from './type';
|
||||||
|
|
||||||
export interface Filters {
|
export interface Filters {
|
||||||
@@ -57,7 +57,7 @@ export function CrQuestionsFilters({
|
|||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const selection = useLpQuestionsSelection();
|
const selection = useCrQuestionsSelection();
|
||||||
|
|
||||||
function getVisible(): number {
|
function getVisible(): number {
|
||||||
return fullData.reduce((count, item: CrQuestion) => {
|
return fullData.reduce((count, item: CrQuestion) => {
|
||||||
|
@@ -12,9 +12,9 @@ function noop(): void {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface LpQuestionsSelectionContextValue extends Selection {}
|
export interface CrQuestionsSelectionContextValue extends Selection {}
|
||||||
|
|
||||||
export const LpQuestionsSelectionContext = React.createContext<LpQuestionsSelectionContextValue>({
|
export const CrQuestionsSelectionContext = React.createContext<CrQuestionsSelectionContextValue>({
|
||||||
deselectAll: noop,
|
deselectAll: noop,
|
||||||
deselectOne: noop,
|
deselectOne: noop,
|
||||||
selectAll: noop,
|
selectAll: noop,
|
||||||
@@ -24,7 +24,7 @@ export const LpQuestionsSelectionContext = React.createContext<LpQuestionsSelect
|
|||||||
selectedAll: false,
|
selectedAll: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
interface LpQuestionsSelectionProviderProps {
|
interface CrQuestionsSelectionProviderProps {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
lessonQuestions: CrQuestion[];
|
lessonQuestions: CrQuestion[];
|
||||||
}
|
}
|
||||||
@@ -32,15 +32,15 @@ interface LpQuestionsSelectionProviderProps {
|
|||||||
export function CrQuestionsSelectionProvider({
|
export function CrQuestionsSelectionProvider({
|
||||||
children,
|
children,
|
||||||
lessonQuestions = [],
|
lessonQuestions = [],
|
||||||
}: LpQuestionsSelectionProviderProps): React.JSX.Element {
|
}: CrQuestionsSelectionProviderProps): React.JSX.Element {
|
||||||
const customerIds = React.useMemo(() => lessonQuestions.map((customer) => customer.id), [lessonQuestions]);
|
const customerIds = React.useMemo(() => lessonQuestions.map((customer) => customer.id), [lessonQuestions]);
|
||||||
const selection = useSelection(customerIds);
|
const selection = useSelection(customerIds);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LpQuestionsSelectionContext.Provider value={{ ...selection }}>{children}</LpQuestionsSelectionContext.Provider>
|
<CrQuestionsSelectionContext.Provider value={{ ...selection }}>{children}</CrQuestionsSelectionContext.Provider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useLpQuestionsSelection(): LpQuestionsSelectionContextValue {
|
export function useCrQuestionsSelection(): CrQuestionsSelectionContextValue {
|
||||||
return React.useContext(LpQuestionsSelectionContext);
|
return React.useContext(CrQuestionsSelectionContext);
|
||||||
}
|
}
|
||||||
|
@@ -25,7 +25,7 @@ import { DataTable } from '@/components/core/data-table';
|
|||||||
import type { ColumnDef } from '@/components/core/data-table';
|
import type { ColumnDef } from '@/components/core/data-table';
|
||||||
|
|
||||||
import ConfirmDeleteModal from './confirm-delete-modal';
|
import ConfirmDeleteModal from './confirm-delete-modal';
|
||||||
import { useLpQuestionsSelection } from './cr-questions-selection-context';
|
import { useCrQuestionsSelection } from './cr-questions-selection-context';
|
||||||
import type { CrQuestion } from './type';
|
import type { CrQuestion } from './type';
|
||||||
|
|
||||||
function columns(handleDeleteClick: (testId: string) => void): ColumnDef<CrQuestion>[] {
|
function columns(handleDeleteClick: (testId: string) => void): ColumnDef<CrQuestion>[] {
|
||||||
@@ -40,7 +40,7 @@ function columns(handleDeleteClick: (testId: string) => void): ColumnDef<CrQuest
|
|||||||
<Link
|
<Link
|
||||||
color="inherit"
|
color="inherit"
|
||||||
component={RouterLink}
|
component={RouterLink}
|
||||||
href={paths.dashboard.lp_categories.details(row.id)}
|
href={paths.dashboard.cr_questions.details(row.id)}
|
||||||
sx={{ whiteSpace: 'nowrap' }}
|
sx={{ whiteSpace: 'nowrap' }}
|
||||||
variant="subtitle2"
|
variant="subtitle2"
|
||||||
>
|
>
|
||||||
@@ -163,7 +163,7 @@ function columns(handleDeleteClick: (testId: string) => void): ColumnDef<CrQuest
|
|||||||
//
|
//
|
||||||
color="secondary"
|
color="secondary"
|
||||||
component={RouterLink}
|
component={RouterLink}
|
||||||
href={paths.dashboard.lp_categories.details(row.id)}
|
href={paths.dashboard.cr_questions.details(row.id)}
|
||||||
>
|
>
|
||||||
<PencilSimpleIcon size={24} />
|
<PencilSimpleIcon size={24} />
|
||||||
</LoadingButton>
|
</LoadingButton>
|
||||||
@@ -193,7 +193,7 @@ export interface LessonQuestionsTableProps {
|
|||||||
|
|
||||||
export function CrQuestionsTable({ rows, reloadRows }: LessonQuestionsTableProps): React.JSX.Element {
|
export function CrQuestionsTable({ rows, reloadRows }: LessonQuestionsTableProps): React.JSX.Element {
|
||||||
const { t } = useTranslation(['lp_categories']);
|
const { t } = useTranslation(['lp_categories']);
|
||||||
const { deselectAll, deselectOne, selectAll, selectOne, selected } = useLpQuestionsSelection();
|
const { deselectAll, deselectOne, selectAll, selectOne, selected } = useCrQuestionsSelection();
|
||||||
|
|
||||||
const [idToDelete, setIdToDelete] = React.useState('');
|
const [idToDelete, setIdToDelete] = React.useState('');
|
||||||
const [open, setOpen] = React.useState(false);
|
const [open, setOpen] = React.useState(false);
|
||||||
|
@@ -17,6 +17,10 @@ const COL_QUIZ_LP_QUESTIONS = 'QuizLPQuestions';
|
|||||||
const COL_QUIZ_MF_CATEGORIES = 'QuizMFCategories';
|
const COL_QUIZ_MF_CATEGORIES = 'QuizMFCategories';
|
||||||
const COL_QUIZ_MF_QUESTIONS = 'QuizMFQuestions';
|
const COL_QUIZ_MF_QUESTIONS = 'QuizMFQuestions';
|
||||||
|
|
||||||
|
// New CR versions
|
||||||
|
const COL_QUIZ_CR_CATEGORIES = 'QuizCRCategories';
|
||||||
|
const COL_QUIZ_CR_QUESTIONS = 'QuizCRQuestions';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
COL_LESSON_TYPES,
|
COL_LESSON_TYPES,
|
||||||
NO_VALUE,
|
NO_VALUE,
|
||||||
@@ -32,4 +36,7 @@ export {
|
|||||||
COL_QUIZ_MF_CATEGORIES,
|
COL_QUIZ_MF_CATEGORIES,
|
||||||
COL_QUIZ_MF_QUESTIONS,
|
COL_QUIZ_MF_QUESTIONS,
|
||||||
//
|
//
|
||||||
|
COL_QUIZ_CR_CATEGORIES,
|
||||||
|
COL_QUIZ_CR_QUESTIONS,
|
||||||
|
//
|
||||||
};
|
};
|
||||||
|
@@ -2,7 +2,7 @@ import { COL_LESSON_CATEGORIES } from '@/constants';
|
|||||||
import type { RecordModel } from 'pocketbase';
|
import type { RecordModel } from 'pocketbase';
|
||||||
|
|
||||||
import { pb } from '@/lib/pb';
|
import { pb } from '@/lib/pb';
|
||||||
import type { CreateFormProps } from '@/components/dashboard/lp_categories/type';
|
import type { CreateFormProps } from '@/components/dashboard/lp/categories/type';
|
||||||
|
|
||||||
export default function createLessonCategory(data: CreateFormProps): Promise<RecordModel> {
|
export default function createLessonCategory(data: CreateFormProps): Promise<RecordModel> {
|
||||||
return pb.collection(COL_LESSON_CATEGORIES).create(data);
|
return pb.collection(COL_LESSON_CATEGORIES).create(data);
|
||||||
|
@@ -2,7 +2,7 @@ import { COL_LESSON_CATEGORIES } from '@/constants';
|
|||||||
import type { RecordModel } from 'pocketbase';
|
import type { RecordModel } from 'pocketbase';
|
||||||
|
|
||||||
import { pb } from '@/lib/pb';
|
import { pb } from '@/lib/pb';
|
||||||
import type { CreateFormProps } from '@/components/dashboard/lp_categories/type';
|
import type { CreateFormProps } from '@/components/dashboard/lp/categories/type';
|
||||||
|
|
||||||
export default function updateLessonCategory(id: string, data: CreateFormProps): Promise<RecordModel> {
|
export default function updateLessonCategory(id: string, data: CreateFormProps): Promise<RecordModel> {
|
||||||
return pb.collection(COL_LESSON_CATEGORIES).update(id, data);
|
return pb.collection(COL_LESSON_CATEGORIES).update(id, data);
|
||||||
|
9
002_source/cms/src/db/QuizCRCategories/Create.tsx
Normal file
9
002_source/cms/src/db/QuizCRCategories/Create.tsx
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import { COL_QUIZ_CR_CATEGORIES } from '@/constants';
|
||||||
|
import type { RecordModel } from 'pocketbase';
|
||||||
|
|
||||||
|
import { pb } from '@/lib/pb';
|
||||||
|
import { CreateFormProps } from '@/components/dashboard/cr/categories/type';
|
||||||
|
|
||||||
|
export default function createQuizCRCategory(data: CreateFormProps): Promise<RecordModel> {
|
||||||
|
return pb.collection(COL_QUIZ_CR_CATEGORIES).create(data);
|
||||||
|
}
|
7
002_source/cms/src/db/QuizCRCategories/Delete.tsx
Normal file
7
002_source/cms/src/db/QuizCRCategories/Delete.tsx
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import { COL_QUIZ_CR_CATEGORIES } from '@/constants';
|
||||||
|
|
||||||
|
import { pb } from '@/lib/pb';
|
||||||
|
|
||||||
|
export default function deleteQuizCRCategories(id: string): Promise<boolean> {
|
||||||
|
return pb.collection(COL_QUIZ_CR_CATEGORIES).delete(id);
|
||||||
|
}
|
7
002_source/cms/src/db/QuizCRCategories/GetAll.tsx
Normal file
7
002_source/cms/src/db/QuizCRCategories/GetAll.tsx
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import { COL_QUIZ_CR_CATEGORIES } from '@/constants';
|
||||||
|
import type { RecordModel } from 'pocketbase';
|
||||||
|
import { pb } from '@/lib/pb';
|
||||||
|
|
||||||
|
export default function getAllQuizCRCategories(): Promise<RecordModel[]> {
|
||||||
|
return pb.collection(COL_QUIZ_CR_CATEGORIES).getFullList();
|
||||||
|
}
|
9
002_source/cms/src/db/QuizCRCategories/GetAllCount.tsx
Normal file
9
002_source/cms/src/db/QuizCRCategories/GetAllCount.tsx
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
// REQ0006
|
||||||
|
import { COL_QUIZ_CR_CATEGORIES } from '@/constants';
|
||||||
|
|
||||||
|
import { pb } from '@/lib/pb';
|
||||||
|
|
||||||
|
export default async function GetAllCount(): Promise<number> {
|
||||||
|
const { totalItems: count } = await pb.collection(COL_QUIZ_CR_CATEGORIES).getList(1, 9999, {});
|
||||||
|
return count;
|
||||||
|
}
|
8
002_source/cms/src/db/QuizCRCategories/GetById.tsx
Normal file
8
002_source/cms/src/db/QuizCRCategories/GetById.tsx
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import { COL_QUIZ_CR_CATEGORIES } from '@/constants';
|
||||||
|
import type { RecordModel } from 'pocketbase';
|
||||||
|
|
||||||
|
import { pb } from '@/lib/pb';
|
||||||
|
|
||||||
|
export default function getQuizCRCategoryById(id: string): Promise<RecordModel> {
|
||||||
|
return pb.collection(COL_QUIZ_CR_CATEGORIES).getOne(id);
|
||||||
|
}
|
13
002_source/cms/src/db/QuizCRCategories/GetHiddenCount.tsx
Normal file
13
002_source/cms/src/db/QuizCRCategories/GetHiddenCount.tsx
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
// REQ0006
|
||||||
|
import { COL_QUIZ_CR_CATEGORIES } from '@/constants';
|
||||||
|
import { pb } from '@/lib/pb';
|
||||||
|
|
||||||
|
export default async function getHiddenQuizCRCategoriesCount(): Promise<number> {
|
||||||
|
try {
|
||||||
|
const result = await pb.collection(COL_QUIZ_CR_CATEGORIES).getList(1, 9999, { filter: 'visible = "hidden"' });
|
||||||
|
const { totalItems: count } = result;
|
||||||
|
return count;
|
||||||
|
} catch (error) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
14
002_source/cms/src/db/QuizCRCategories/GetVisibleCount.tsx
Normal file
14
002_source/cms/src/db/QuizCRCategories/GetVisibleCount.tsx
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
// REQ0006
|
||||||
|
import { COL_QUIZ_CR_CATEGORIES } from '@/constants';
|
||||||
|
|
||||||
|
import { pb } from '@/lib/pb';
|
||||||
|
|
||||||
|
export default async function getVisibleQuizCRCategoriesCount(): Promise<number> {
|
||||||
|
try {
|
||||||
|
const result = await pb.collection(COL_QUIZ_CR_CATEGORIES).getList(1, 9999, { filter: 'visible = "visible"' });
|
||||||
|
const { totalItems: count } = result;
|
||||||
|
return count;
|
||||||
|
} catch (error) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
9
002_source/cms/src/db/QuizCRCategories/Update.tsx
Normal file
9
002_source/cms/src/db/QuizCRCategories/Update.tsx
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import { COL_QUIZ_CR_CATEGORIES } from '@/constants';
|
||||||
|
import type { RecordModel } from 'pocketbase';
|
||||||
|
|
||||||
|
import { pb } from '@/lib/pb';
|
||||||
|
import type { CreateFormProps } from '@/components/dashboard/cr/categories/type';
|
||||||
|
|
||||||
|
export default function updateQuizCRCategory(id: string, data: CreateFormProps): Promise<RecordModel> {
|
||||||
|
return pb.collection(COL_QUIZ_CR_CATEGORIES).update(id, data);
|
||||||
|
}
|
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;
|
||||||
|
}
|
||||||
|
}
|
@@ -2,7 +2,7 @@ import { COL_QUIZ_LP_CATEGORIES } from '@/constants';
|
|||||||
import type { RecordModel } from 'pocketbase';
|
import type { RecordModel } from 'pocketbase';
|
||||||
|
|
||||||
import { pb } from '@/lib/pb';
|
import { pb } from '@/lib/pb';
|
||||||
import type { CreateFormProps } from '@/components/dashboard/lp_categories/type';
|
import type { CreateFormProps } from '@/components/dashboard/lp/categories/type';
|
||||||
|
|
||||||
export default function updateQuizLPCategory(id: string, data: CreateFormProps): Promise<RecordModel> {
|
export default function updateQuizLPCategory(id: string, data: CreateFormProps): Promise<RecordModel> {
|
||||||
return pb.collection(COL_QUIZ_LP_CATEGORIES).update(id, data);
|
return pb.collection(COL_QUIZ_LP_CATEGORIES).update(id, data);
|
||||||
|
@@ -2,7 +2,7 @@ import { COL_QUIZ_LP_CATEGORIES } from '@/constants';
|
|||||||
import type { RecordModel } from 'pocketbase';
|
import type { RecordModel } from 'pocketbase';
|
||||||
|
|
||||||
import { pb } from '@/lib/pb';
|
import { pb } from '@/lib/pb';
|
||||||
import type { CreateFormProps } from '@/components/dashboard/lp_categories/type';
|
import type { CreateFormProps } from '@/components/dashboard/lp/categories/type';
|
||||||
|
|
||||||
export default function updateQuizLPCategory(id: string, data: CreateFormProps): Promise<RecordModel> {
|
export default function updateQuizLPCategory(id: string, data: CreateFormProps): Promise<RecordModel> {
|
||||||
return pb.collection(COL_QUIZ_LP_CATEGORIES).update(id, data);
|
return pb.collection(COL_QUIZ_LP_CATEGORIES).update(id, data);
|
||||||
|
@@ -2,7 +2,7 @@ import { COL_QUIZ_MF_CATEGORIES } from '@/constants';
|
|||||||
import type { RecordModel } from 'pocketbase';
|
import type { RecordModel } from 'pocketbase';
|
||||||
|
|
||||||
import { pb } from '@/lib/pb';
|
import { pb } from '@/lib/pb';
|
||||||
import type { CreateFormProps } from '@/components/dashboard/mf_categories/type';
|
import type { CreateFormProps } from '@/components/dashboard/mf/categories/type';
|
||||||
|
|
||||||
export default function createQuizMFCategory(data: CreateFormProps): Promise<RecordModel> {
|
export default function createQuizMFCategory(data: CreateFormProps): Promise<RecordModel> {
|
||||||
return pb.collection(COL_QUIZ_MF_CATEGORIES).create(data);
|
return pb.collection(COL_QUIZ_MF_CATEGORIES).create(data);
|
||||||
|
@@ -2,7 +2,7 @@ import { COL_QUIZ_MF_CATEGORIES } from '@/constants';
|
|||||||
import type { RecordModel } from 'pocketbase';
|
import type { RecordModel } from 'pocketbase';
|
||||||
|
|
||||||
import { pb } from '@/lib/pb';
|
import { pb } from '@/lib/pb';
|
||||||
import type { CreateFormProps } from '@/components/dashboard/mf_categories/type';
|
import type { CreateFormProps } from '@/components/dashboard/mf/categories/type';
|
||||||
|
|
||||||
export default function updateQuizMFCategory(id: string, data: CreateFormProps): Promise<RecordModel> {
|
export default function updateQuizMFCategory(id: string, data: CreateFormProps): Promise<RecordModel> {
|
||||||
return pb.collection(COL_QUIZ_MF_CATEGORIES).update(id, data);
|
return pb.collection(COL_QUIZ_MF_CATEGORIES).update(id, data);
|
||||||
|
Reference in New Issue
Block a user