update,
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user