monacousa-portal/utils/types.ts

110 lines
1.9 KiB
TypeScript

// utils/types.ts
export interface User {
id: string;
email: string;
name: string;
firstName?: string;
lastName?: string;
username?: string;
tier: 'user' | 'board' | 'admin';
groups: string[];
}
export interface AuthState {
authenticated: boolean;
user: User | null;
groups: string[];
}
export interface ApiResponse<T = any> {
success: boolean;
data?: T;
error?: string;
message?: string;
}
export interface FileUpload {
fieldName: string;
fileName: string;
originalName: string;
size: number;
contentType: string;
}
export interface DatabaseRecord {
id: string;
created_at: string;
updated_at: string;
[key: string]: any;
}
export interface HealthCheck {
status: 'healthy' | 'degraded' | 'unhealthy';
timestamp: string;
checks: {
server: string;
database: string;
storage: string;
auth: string;
};
}
export interface TokenResponse {
access_token: string;
refresh_token: string;
id_token: string;
token_type: string;
expires_in: number;
}
export interface UserInfo {
sub: string;
email: string;
given_name?: string;
family_name?: string;
name?: string;
preferred_username?: string;
groups?: string[];
tier?: string;
}
export interface SessionData {
user: User;
tokens: {
accessToken: string;
refreshToken: string;
expiresAt: number;
};
rememberMe?: boolean;
createdAt: number;
lastActivity: number;
}
export interface KeycloakConfig {
issuer: string;
clientId: string;
clientSecret: string;
callbackUrl: string;
}
export interface KeycloakAdminConfig {
issuer: string;
clientId: string;
clientSecret: string;
}
export interface NocoDBConfig {
url: string;
token: string;
baseId: string;
}
export interface MinIOConfig {
endPoint: string;
port: number;
useSSL: boolean;
accessKey: string;
secretKey: string;
bucketName: string;
}