Extracted the user types

This commit is contained in:
Tiago Ribeiro
2023-11-27 11:35:04 +00:00
parent facac33a89
commit 5f76e430af
5 changed files with 55 additions and 74 deletions

View File

@@ -1,11 +1,12 @@
import {Module} from ".";
export interface User {
export type User = StudentUser | TeacherUser | CorporateUser | AgentUser | AdminUser | DeveloperUser;
export interface BasicUser {
email: string;
name: string;
profilePicture: string;
id: string;
experience: number;
isFirstLogin: boolean;
focus: "academic" | "general";
levels: {[key in Module]: number};
@@ -14,12 +15,37 @@ export interface User {
bio: string;
isVerified: boolean;
demographicInformation?: DemographicInformation;
corporateInformation?: CorporateInformation;
subscriptionExpirationDate?: null | Date;
registrationDate?: Date;
status: "active" | "disabled" | "paymentDue";
}
export interface StudentUser extends BasicUser {
type: "student";
}
export interface TeacherUser extends BasicUser {
type: "teacher";
}
export interface CorporateUser extends BasicUser {
type: "corporate";
corporateInformation: CorporateInformation;
}
export interface AgentUser extends BasicUser {
type: "agent";
agentInformation: AgentInformation;
}
export interface AdminUser extends BasicUser {
type: "admin";
}
export interface DeveloperUser extends BasicUser {
type: "developer";
}
export interface CorporateInformation {
companyInformation: CompanyInformation;
monthlyDuration: number;
@@ -30,6 +56,11 @@ export interface CorporateInformation {
referralAgent?: string;
}
export interface AgentInformation {
companyName: string;
commercialRegistration: string;
}
export interface CompanyInformation {
name: string;
userAmount: number;