refactor Student type definitions to deprecate obsolete fields, standardize structure, and update billing address format
```
This commit is contained in:
louiscklaw
2025-05-15 11:12:56 +08:00
parent d0215cf23f
commit af15a6bce0

View File

@@ -1,17 +1,71 @@
// src/db/Students/type.d.ts
//
// RULES
// PURPOSE
// type for student record
//
// RULES: sorting direction for user meta lists
import type { BillingAddress } from '../billingAddress/type';
// Student type definitions
export interface Student {
id: string;
export interface DBStudentOld {
//
name: string;
avatar: string;
//
// NOTE: obslete "avatar" and use "avatar_file"
avatar?: string;
avatar_file?: string;
//
email: string;
phone: string;
quota: number;
status: 'active' | 'blocked' | 'pending';
company: string;
//
// billingAddress: BillingAddress[] | [];
expand: { billingAddress?: BillingAddress[] };
// status is obsoleted, replace by state
status: 'pending' | 'active' | 'blocked';
state: 'pending' | 'active' | 'blocked';
//
timezone: string;
language: string;
currency: string;
//
id: string;
created: string;
updated?: string;
collectionId: string;
}
// RULES: core user meta data structure
export interface Student {
id: string;
name: string;
//
// NOTE: obslete "avatar" and use "avatar_file"
avatar?: string;
avatar_file?: string;
//
email: string;
phone?: string;
quota: number;
company?: string;
//
billingAddress: BillingAddress | Record<string, never>;
// status is obsoleted, replace by state
status: 'pending' | 'active' | 'blocked';
state: 'pending' | 'active' | 'blocked';
//
timezone: string;
language: string;
currency: string;
//
id: string;
createdAt: Date;
updatedAt?: Date;
collectionId: string;
}
export interface UpdateStudent {
@@ -36,6 +90,7 @@ export interface UpdateStudent {
timezone?: string;
language?: string;
currency?: string;
//
taxId?: string;
}