166 lines
3.0 KiB
TypeScript
166 lines
3.0 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;
|
|
}
|
|
|
|
// Member Management Types
|
|
export enum MembershipStatus {
|
|
Active = 'Active',
|
|
Inactive = 'Inactive',
|
|
Pending = 'Pending',
|
|
Expired = 'Expired'
|
|
}
|
|
|
|
export interface Member {
|
|
Id: string;
|
|
"First Name": string;
|
|
"Last Name": string;
|
|
Email: string;
|
|
Phone: string;
|
|
"Current Year Dues Paid": string; // "true" or "false"
|
|
Nationality: string; // "FR,MC,US" for multiple nationalities
|
|
"Date of Birth": string;
|
|
"Membership Date Paid": string;
|
|
"Payment Due Date": string;
|
|
"Membership Status": string;
|
|
Address: string;
|
|
"Member Since": string;
|
|
|
|
// Computed fields (added by processing)
|
|
FullName?: string;
|
|
FormattedPhone?: string;
|
|
NationalityArray?: string[]; // Parsed from comma-separated string
|
|
}
|
|
|
|
// Admin-only NocoDB Configuration
|
|
export interface NocoDBSettings {
|
|
tableId: string;
|
|
apiKey: string;
|
|
baseId: string;
|
|
url: string;
|
|
}
|
|
|
|
export interface MemberResponse {
|
|
list: Member[];
|
|
PageInfo: {
|
|
pageSize: number;
|
|
totalRows: number;
|
|
isFirstPage: boolean;
|
|
isLastPage: boolean;
|
|
page: number;
|
|
};
|
|
}
|
|
|
|
export interface MemberFilters {
|
|
searchTerm?: string;
|
|
nationality?: string;
|
|
membershipStatus?: MembershipStatus;
|
|
duesPaid?: boolean;
|
|
memberSince?: string;
|
|
}
|