very first commit
This commit is contained in:
139
src/app/models/auth.model.ts
Normal file
139
src/app/models/auth.model.ts
Normal file
@@ -0,0 +1,139 @@
|
||||
/**
|
||||
* Project identifier for authentication
|
||||
*/
|
||||
export type ProjectType = 'dexar' | 'novo' | 'fastcheck' | 'backoffice' | string;
|
||||
|
||||
/**
|
||||
* Device type classification
|
||||
*/
|
||||
export type DeviceType = 'mobile' | 'desktop' | 'tablet' | null;
|
||||
|
||||
/**
|
||||
* Operating system type
|
||||
*/
|
||||
export type DeviceOS = 'android' | 'ios' | 'windows' | 'macos' | 'linux' | null;
|
||||
|
||||
/**
|
||||
* Authentication context
|
||||
*/
|
||||
export type AuthContext = 'browser' | 'application' | 'telegram' | null;
|
||||
|
||||
/**
|
||||
* Complete device information
|
||||
*/
|
||||
export interface DeviceInfo {
|
||||
deviceType: DeviceType;
|
||||
deviceOS: DeviceOS;
|
||||
context: AuthContext;
|
||||
project: ProjectType;
|
||||
userAgent?: string;
|
||||
screenResolution?: string;
|
||||
browserName?: string;
|
||||
browserVersion?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* QR code generation request
|
||||
*/
|
||||
export interface QRGenerationRequest {
|
||||
project: ProjectType;
|
||||
deviceInfo: DeviceInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* QR code generation response
|
||||
*/
|
||||
export interface QRGenerationResponse {
|
||||
sessionId: string;
|
||||
qrCode: string; // base64 image or URL
|
||||
expiresAt: string;
|
||||
expiresIn: number; // seconds
|
||||
}
|
||||
|
||||
/**
|
||||
* QR code scan request
|
||||
*/
|
||||
export interface QRScanRequest {
|
||||
sessionId: string;
|
||||
deviceInfo: DeviceInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Authentication status check
|
||||
*/
|
||||
export interface AuthStatusResponse {
|
||||
authenticated: boolean;
|
||||
token?: string;
|
||||
userId?: string;
|
||||
expiresAt?: string;
|
||||
userInfo?: {
|
||||
username: string;
|
||||
email?: string;
|
||||
role?: string;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Login request (traditional)
|
||||
*/
|
||||
export interface LoginRequest {
|
||||
username: string;
|
||||
password: string;
|
||||
deviceInfo: DeviceInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Login response
|
||||
*/
|
||||
export interface LoginResponse {
|
||||
success: boolean;
|
||||
token?: string;
|
||||
userId?: string;
|
||||
expiresAt?: string;
|
||||
message?: string;
|
||||
userInfo?: {
|
||||
username: string;
|
||||
email?: string;
|
||||
role?: string;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Session validation request
|
||||
*/
|
||||
export interface SessionValidationRequest {
|
||||
token: string;
|
||||
deviceInfo: DeviceInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Session validation response
|
||||
*/
|
||||
export interface SessionValidationResponse {
|
||||
valid: boolean;
|
||||
userId?: string;
|
||||
expiresAt?: string;
|
||||
userInfo?: {
|
||||
username: string;
|
||||
email?: string;
|
||||
role?: string;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Logout request
|
||||
*/
|
||||
export interface LogoutRequest {
|
||||
token: string;
|
||||
deviceInfo: DeviceInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Error response
|
||||
*/
|
||||
export interface ErrorResponse {
|
||||
error: boolean;
|
||||
message: string;
|
||||
code?: string;
|
||||
details?: any;
|
||||
}
|
||||
Reference in New Issue
Block a user