This commit is contained in:
louiscklaw
2025-04-21 06:39:13 +08:00
parent 72bc7a67e2
commit 3e73668a3f
27 changed files with 298 additions and 142 deletions

View File

@@ -1,8 +1,7 @@
import { COL_LISTENINGS_PRACTICE_CATEGORIES } from '@/constants';
import type { RecordModel } from 'pocketbase';
import { COL_QUIZ_LP_CATEGORIES } from '@/constants';
import { pb } from '@/lib/pb';
export default function deleteQuizListening(id: string): Promise<boolean> {
return pb.collection(COL_LISTENINGS_PRACTICE_CATEGORIES).delete(id);
export default function deleteQuizLPCategories(id: string): Promise<boolean> {
return pb.collection(COL_QUIZ_LP_CATEGORIES).delete(id);
}

View File

@@ -1,8 +1,8 @@
import { COL_LISTENINGS_PRACTICE_CATEGORIES } from '@/constants';
import { COL_QUIZ_LP_CATEGORIES } from '@/constants';
import type { RecordModel } from 'pocketbase';
import { pb } from '@/lib/pb';
export default function getAllQuizListenings(): Promise<RecordModel[]> {
return pb.collection(COL_LISTENINGS_PRACTICE_CATEGORIES).getFullList();
return pb.collection(COL_QUIZ_LP_CATEGORIES).getFullList();
}

View File

@@ -1,9 +1,9 @@
// REQ0006
import { COL_LISTENINGS_PRACTICE_CATEGORIES } from '@/constants';
import { COL_QUIZ_LP_CATEGORIES } from '@/constants';
import { pb } from '@/lib/pb';
export default async function GetAllCount(): Promise<number> {
const { totalItems: count } = await pb.collection(COL_LISTENINGS_PRACTICE_CATEGORIES).getList(1, 9999, {});
const { totalItems: count } = await pb.collection(COL_QUIZ_LP_CATEGORIES).getList(1, 9999, {});
return count;
}

View File

@@ -1,8 +1,8 @@
import { COL_LISTENINGS_PRACTICE_CATEGORIES } from '@/constants';
import { COL_QUIZ_LP_CATEGORIES } from '@/constants';
import type { RecordModel } from 'pocketbase';
import { pb } from '@/lib/pb';
export default function getQuizListeningById(id: string): Promise<RecordModel> {
return pb.collection(COL_LISTENINGS_PRACTICE_CATEGORIES).getOne(id);
return pb.collection(COL_QUIZ_LP_CATEGORIES).getOne(id);
}

View File

@@ -1,13 +1,11 @@
// REQ0006
import { COL_LISTENINGS_PRACTICE_CATEGORIES } from '@/constants';
import { COL_QUIZ_LP_CATEGORIES } from '@/constants';
import { pb } from '@/lib/pb';
export default async function GetHiddenCount(): Promise<number> {
try {
const result = await pb
.collection(COL_LISTENINGS_PRACTICE_CATEGORIES)
.getList(1, 9999, { filter: 'visible = "hidden"' });
const result = await pb.collection(COL_QUIZ_LP_CATEGORIES).getList(1, 9999, { filter: 'visible = "hidden"' });
const { totalItems: count } = result;
return count;
} catch (error) {

View File

@@ -1,13 +1,11 @@
// REQ0006
import { COL_LISTENINGS_PRACTICE_CATEGORIES } from '@/constants';
import { COL_QUIZ_LP_CATEGORIES } from '@/constants';
import { pb } from '@/lib/pb';
export default async function GetVisibleCount(): Promise<number> {
try {
const result = await pb
.collection(COL_LISTENINGS_PRACTICE_CATEGORIES)
.getList(1, 9999, { filter: 'visible = "visible"' });
const result = await pb.collection(COL_QUIZ_LP_CATEGORIES).getList(1, 9999, { filter: 'visible = "visible"' });
const { totalItems: count } = result;
return count;
} catch (error) {

View File

@@ -1,4 +1,4 @@
import { COL_LISTENINGS_PRACTICE_CATEGORIES } from '@/constants';
import { COL_QUIZ_LP_CATEGORIES } from '@/constants';
import type { ListResult, RecordModel } from 'pocketbase';
import { pb } from '@/lib/pb';
@@ -18,5 +18,5 @@ export default function listWithOption({
rowsPerPage,
listOption = {},
}: ListWithOptionParams): Promise<ListResult<RecordModel>> {
return pb.collection(COL_LISTENINGS_PRACTICE_CATEGORIES).getList(currentPage + 1, rowsPerPage, listOption);
return pb.collection(COL_QUIZ_LP_CATEGORIES).getList(currentPage + 1, rowsPerPage, listOption);
}

View File

@@ -0,0 +1,7 @@
import { COL_QUIZ_MF_CATEGORIES } from '@/constants';
import { pb } from '@/lib/pb';
export default function deleteQuizMFCategories(id: string): Promise<boolean> {
return pb.collection(COL_QUIZ_MF_CATEGORIES).delete(id);
}

View File

@@ -0,0 +1,9 @@
// REQ0006
import { COL_QUIZ_MF_CATEGORIES } from '@/constants';
import { pb } from '@/lib/pb';
export default async function GetAllCount(): Promise<number> {
const { totalItems: count } = await pb.collection(COL_QUIZ_MF_CATEGORIES).getList(1, 9999, {});
return count;
}

View File

@@ -0,0 +1,14 @@
// REQ0006
import { COL_QUIZ_MF_CATEGORIES } from '@/constants';
import { pb } from '@/lib/pb';
export default async function GetHiddenCount(): Promise<number> {
try {
const result = await pb.collection(COL_QUIZ_MF_CATEGORIES).getList(1, 9999, { filter: 'visible = "hidden"' });
const { totalItems: count } = result;
return count;
} catch (error) {
return 0;
}
}

View File

@@ -0,0 +1,14 @@
// REQ0006
import { COL_QUIZ_MF_CATEGORIES } from '@/constants';
import { pb } from '@/lib/pb';
export default async function GetVisibleCount(): Promise<number> {
try {
const result = await pb.collection(COL_QUIZ_MF_CATEGORIES).getList(1, 9999, { filter: 'visible = "visible"' });
const { totalItems: count } = result;
return count;
} catch (error) {
return 0;
}
}