This commit is contained in:
louiscklaw
2025-05-08 17:19:43 +08:00
parent 7105bc85e3
commit 5640d4d4f6
46 changed files with 520 additions and 268 deletions

View File

@@ -1,6 +1,6 @@
import { pb } from '@/lib/pb';
import { COL_STUDENTS } from '@/constants';
import { COL_STUDENTS, COL_USER_METAS } from '@/constants';
export async function deleteStudent(id: string): Promise<boolean> {
return pb.collection(COL_STUDENTS).delete(id);
return pb.collection(COL_USER_METAS).delete(id);
}

View File

@@ -1,9 +1,9 @@
import { COL_STUDENTS } from '@/constants';
import { COL_STUDENTS, COL_USER_METAS } from '@/constants';
import { pb } from '@/lib/pb';
export default async function GetActiveCount(): Promise<number> {
const { totalItems: count } = await pb.collection(COL_STUDENTS).getList(1, 1, {
filter: 'status = "active"',
const { totalItems: count } = await pb.collection(COL_USER_METAS).getList(1, 1, {
filter: 'status = "active" && role = "student"',
});
return count;
}

View File

@@ -1,7 +1,10 @@
import { pb } from '@/lib/pb';
import { COL_STUDENTS } from '@/constants';
import { COL_USER_METAS } from '@/constants';
export async function getAllStudentsCount(): Promise<number> {
const result = await pb.collection(COL_STUDENTS).getList(1, 1);
const result = await pb.collection(COL_USER_METAS).getList(1, 1, {
filter: `role = "student"`,
//
});
return result.totalItems;
}

View File

@@ -1,9 +1,9 @@
import { COL_STUDENTS } from '@/constants';
import { COL_USER_METAS } from '@/constants';
import { pb } from '@/lib/pb';
export default async function GetBlockedCount(): Promise<number> {
const { totalItems: count } = await pb.collection(COL_STUDENTS).getList(1, 1, {
filter: 'status = "blocked"',
const { totalItems: count } = await pb.collection(COL_USER_METAS).getList(1, 1, {
filter: 'status = "blocked" && role = "student"',
});
return count;
}

View File

@@ -1,9 +1,9 @@
import { COL_STUDENTS } from '@/constants';
import { COL_USER_METAS } from '@/constants';
import { pb } from '@/lib/pb';
export default async function GetPendingCount(): Promise<number> {
const { totalItems: count } = await pb.collection(COL_STUDENTS).getList(1, 1, {
filter: 'status = "pending"',
const { totalItems: count } = await pb.collection(COL_USER_METAS).getList(1, 1, {
filter: 'status = "pending" && role = "student"',
});
return count;
}