```
refactor GetById APIs for Students, Teachers, and UserMetas to use consistent type definitions and expand parameters ```
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
// src/db/Students/GetById.tsx
|
||||
//
|
||||
import { COL_USER_METAS } from '@/constants';
|
||||
|
||||
import { pb } from '@/lib/pb';
|
||||
import type { DBUserMeta, UserMeta } from '@/components/dashboard/user_meta/type.d';
|
||||
import type { DBStudent, Student } from '@/components/dashboard/student/type';
|
||||
|
||||
export async function getStudentById(id: string): Promise<UserMeta> {
|
||||
const record = await pb.collection(COL_USER_METAS).getOne<DBUserMeta>(id, { expand: 'billingAddress, helloworld' });
|
||||
export async function getStudentById(id: string): Promise<Student> {
|
||||
const record = await pb
|
||||
.collection(COL_USER_METAS)
|
||||
.getOne<DBStudent>(id, { expand: 'billingAddress, helloworld', requestKey: null });
|
||||
|
||||
const temp: UserMeta = {
|
||||
const temp: Student = {
|
||||
id: record.id,
|
||||
name: record.name,
|
||||
email: record.email,
|
||||
|
Reference in New Issue
Block a user