refactor student and teacher APIs to use COL_USER_METAS collection, standardize role assignment, and update type definitions
```
This commit is contained in:
louiscklaw
2025-05-15 09:27:38 +08:00
parent ecab41abbf
commit 2aa96eec62
7 changed files with 89 additions and 13 deletions

View File

@@ -1,12 +1,12 @@
// api method for crate student record
// RULES:
// TBA
import { COL_STUDENTS, COL_USER_METAS } from '@/constants';
import { COL_USER_METAS } from '@/constants';
import type { RecordModel } from 'pocketbase';
import { pb } from '@/lib/pb';
import type { CreateFormProps } from '@/components/dashboard/student/type.d';
export async function createStudent(data: CreateFormProps): Promise<RecordModel> {
return pb.collection(COL_USER_METAS).create(data);
return pb.collection(COL_USER_METAS).create({ ...data, role: 'student' });
}

View File

@@ -1,4 +1,6 @@
import type { BillingAddress } from '@/components/dashboard/user_meta/type.d';
//
// RULES
// type for student record
// Student type definitions
export interface Student {