```
refactor Student and UserMeta type definitions to deprecate obsolete fields, standardize structure, and update billing address format ```
This commit is contained in:
@@ -1,20 +1,67 @@
|
|||||||
'use client';
|
// src/components/dashboard/student/type.d.tsx
|
||||||
|
|
||||||
// RULES: sorting direction for student lists
|
// RULES: sorting direction for student lists
|
||||||
|
import type { BillingAddress } from '@/db/billingAddress/type';
|
||||||
|
|
||||||
|
// RULES: sorting direction for teacher lists
|
||||||
export type SortDir = 'asc' | 'desc';
|
export type SortDir = 'asc' | 'desc';
|
||||||
|
|
||||||
|
export interface DBStudent {
|
||||||
|
name: string;
|
||||||
|
//
|
||||||
|
// NOTE: obslete "avatar" and use "avatar_file"
|
||||||
|
avatar?: string;
|
||||||
|
avatar_file?: string;
|
||||||
|
//
|
||||||
|
email: string;
|
||||||
|
phone: string;
|
||||||
|
quota: number;
|
||||||
|
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 student data structure
|
// RULES: core student data structure
|
||||||
export interface Student {
|
export interface Student {
|
||||||
id: string;
|
|
||||||
collectionId: string;
|
|
||||||
name: string;
|
name: string;
|
||||||
|
//
|
||||||
|
// NOTE: obslete "avatar" and use "avatar_file"
|
||||||
avatar?: string;
|
avatar?: string;
|
||||||
|
avatar_file?: string;
|
||||||
|
//
|
||||||
email: string;
|
email: string;
|
||||||
phone?: string;
|
phone?: string;
|
||||||
quota: number;
|
quota: number;
|
||||||
|
company?: string;
|
||||||
|
//
|
||||||
|
billingAddress: BillingAddress | Record<string, never>;
|
||||||
|
|
||||||
|
// status is obsoleted, replace by state
|
||||||
status: 'pending' | 'active' | 'blocked';
|
status: 'pending' | 'active' | 'blocked';
|
||||||
|
state: 'pending' | 'active' | 'blocked';
|
||||||
|
//
|
||||||
|
timezone: string;
|
||||||
|
language: string;
|
||||||
|
currency: string;
|
||||||
|
//
|
||||||
|
id: string;
|
||||||
createdAt: Date;
|
createdAt: Date;
|
||||||
updatedAt?: Date;
|
updatedAt?: Date;
|
||||||
|
collectionId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// RULES: form data structure for creating new student
|
// RULES: form data structure for creating new student
|
||||||
@@ -23,6 +70,7 @@ export interface CreateFormProps {
|
|||||||
email: string;
|
email: string;
|
||||||
phone?: string;
|
phone?: string;
|
||||||
company?: string;
|
company?: string;
|
||||||
|
//
|
||||||
// handle seperately
|
// handle seperately
|
||||||
// billingAddress?: {
|
// billingAddress?: {
|
||||||
// country: string;
|
// country: string;
|
||||||
@@ -32,6 +80,7 @@ export interface CreateFormProps {
|
|||||||
// line1: string;
|
// line1: string;
|
||||||
// line2?: string;
|
// line2?: string;
|
||||||
// };
|
// };
|
||||||
|
//
|
||||||
taxId?: string;
|
taxId?: string;
|
||||||
timezone: string;
|
timezone: string;
|
||||||
language: string;
|
language: string;
|
||||||
@@ -64,6 +113,7 @@ export interface EditFormProps {
|
|||||||
// quota?: number;
|
// quota?: number;
|
||||||
// status?: 'pending' | 'active' | 'blocked';
|
// status?: 'pending' | 'active' | 'blocked';
|
||||||
}
|
}
|
||||||
|
|
||||||
// RULES: filter props for student search and filtering
|
// RULES: filter props for student search and filtering
|
||||||
export interface CustomersFiltersProps {
|
export interface CustomersFiltersProps {
|
||||||
filters?: Filters;
|
filters?: Filters;
|
@@ -1,26 +1,11 @@
|
|||||||
'use client';
|
// src/components/dashboard/user_meta/type.d.tsx
|
||||||
|
|
||||||
|
// RULES: sorting direction for user meta lists
|
||||||
import type { BillingAddress } from '@/db/billingAddress/type';
|
import type { BillingAddress } from '@/db/billingAddress/type';
|
||||||
|
|
||||||
// RULES: sorting direction for teacher lists
|
// RULES: sorting direction for teacher lists
|
||||||
export type SortDir = 'asc' | 'desc';
|
export type SortDir = 'asc' | 'desc';
|
||||||
|
|
||||||
// obsoleted
|
|
||||||
// export interface BillingAddress {
|
|
||||||
// city: string;
|
|
||||||
// country: string;
|
|
||||||
// line1: string;
|
|
||||||
// line2: string;
|
|
||||||
// state: string;
|
|
||||||
// zipCode: string;
|
|
||||||
// //
|
|
||||||
// id: string;
|
|
||||||
// collectionId: string;
|
|
||||||
// collectionName: string;
|
|
||||||
// updated: string;
|
|
||||||
// created: string;
|
|
||||||
// }
|
|
||||||
|
|
||||||
export interface DBUserMeta {
|
export interface DBUserMeta {
|
||||||
name: string;
|
name: string;
|
||||||
//
|
//
|
||||||
@@ -50,7 +35,7 @@ export interface DBUserMeta {
|
|||||||
collectionId: string;
|
collectionId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// RULES: core teacher data structure
|
// RULES: core user meta data structure
|
||||||
export interface UserMeta {
|
export interface UserMeta {
|
||||||
name: string;
|
name: string;
|
||||||
//
|
//
|
||||||
@@ -72,7 +57,6 @@ export interface UserMeta {
|
|||||||
timezone: string;
|
timezone: string;
|
||||||
language: string;
|
language: string;
|
||||||
currency: string;
|
currency: string;
|
||||||
|
|
||||||
//
|
//
|
||||||
id: string;
|
id: string;
|
||||||
createdAt: Date;
|
createdAt: Date;
|
||||||
@@ -80,12 +64,14 @@ export interface UserMeta {
|
|||||||
collectionId: string;
|
collectionId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// RULES: form data structure for creating new teacher
|
// RULES: form data structure for creating new user meta
|
||||||
export interface CreateFormProps {
|
export interface CreateFormProps {
|
||||||
name: string;
|
name: string;
|
||||||
email: string;
|
email: string;
|
||||||
phone?: string;
|
phone?: string;
|
||||||
company?: string;
|
company?: string;
|
||||||
|
//
|
||||||
|
// handle seperately ?
|
||||||
billingAddress?: {
|
billingAddress?: {
|
||||||
country: string;
|
country: string;
|
||||||
state: string;
|
state: string;
|
||||||
@@ -94,6 +80,7 @@ export interface CreateFormProps {
|
|||||||
line1: string;
|
line1: string;
|
||||||
line2?: string;
|
line2?: string;
|
||||||
};
|
};
|
||||||
|
//
|
||||||
taxId?: string;
|
taxId?: string;
|
||||||
timezone: string;
|
timezone: string;
|
||||||
language: string;
|
language: string;
|
||||||
@@ -103,7 +90,7 @@ export interface CreateFormProps {
|
|||||||
// status?: 'pending' | 'active' | 'blocked';
|
// status?: 'pending' | 'active' | 'blocked';
|
||||||
}
|
}
|
||||||
|
|
||||||
// RULES: form data structure for editing existing teacher
|
// RULES: form data structure for editing existing user meta
|
||||||
export interface EditFormProps {
|
export interface EditFormProps {
|
||||||
name: string;
|
name: string;
|
||||||
email: string;
|
email: string;
|
||||||
@@ -126,12 +113,13 @@ export interface EditFormProps {
|
|||||||
// status?: 'pending' | 'active' | 'blocked';
|
// status?: 'pending' | 'active' | 'blocked';
|
||||||
}
|
}
|
||||||
|
|
||||||
// RULES: filter props for teacher search and filtering
|
// RULES: filter props for user meta search and filtering
|
||||||
export interface UserMetasFiltersProps {
|
export interface UserMetasFiltersProps {
|
||||||
filters?: Filters;
|
filters?: Filters;
|
||||||
sortDir?: SortDir;
|
sortDir?: SortDir;
|
||||||
fullData: UserMeta[];
|
fullData: UserMeta[];
|
||||||
}
|
}
|
||||||
|
// RULES: available filter options for user meta data
|
||||||
export interface Filters {
|
export interface Filters {
|
||||||
email?: string;
|
email?: string;
|
||||||
phone?: string;
|
phone?: string;
|
Reference in New Issue
Block a user