161 lines
3.1 KiB
TypeScript
161 lines
3.1 KiB
TypeScript
export interface User {
|
|
id: number;
|
|
username: string;
|
|
password: string;
|
|
name: string;
|
|
email: string | null;
|
|
role: 'admin' | 'user';
|
|
created_at: string;
|
|
updated_at: string;
|
|
}
|
|
|
|
export interface Company {
|
|
id: number;
|
|
company_name: string;
|
|
is_active: boolean;
|
|
created_at: string;
|
|
updated_at: string;
|
|
}
|
|
|
|
export interface Serial {
|
|
id: number;
|
|
serial_number: string;
|
|
company_name: string;
|
|
valid_until: string | null;
|
|
is_active: boolean;
|
|
created_by: number | null;
|
|
created_at: string;
|
|
updated_at: string;
|
|
created_by_name?: string;
|
|
}
|
|
|
|
export interface AuthUser {
|
|
id: number;
|
|
username: string;
|
|
name: string;
|
|
role: 'admin' | 'user';
|
|
}
|
|
|
|
export interface JWTPayload {
|
|
userId: number;
|
|
username: string;
|
|
role: 'admin' | 'user';
|
|
}
|
|
|
|
export interface LoginRequest {
|
|
username: string;
|
|
password: string;
|
|
}
|
|
|
|
export interface ChangePasswordRequest {
|
|
currentPassword: string;
|
|
newPassword: string;
|
|
}
|
|
|
|
export interface GenerateSerialRequest {
|
|
companyName: string;
|
|
quantity?: number;
|
|
validDays?: number;
|
|
}
|
|
|
|
export interface GenerateSerialWithPrefixRequest {
|
|
companyName: string;
|
|
quantity?: number;
|
|
validDays?: number;
|
|
serialPrefix: string;
|
|
}
|
|
|
|
export interface QRCodeRequest {
|
|
baseUrl?: string;
|
|
}
|
|
|
|
export interface UpdateSerialRequest {
|
|
companyName?: string;
|
|
validUntil?: string;
|
|
isActive?: boolean;
|
|
}
|
|
|
|
export interface UpdateCompanyRequest {
|
|
newCompanyName: string;
|
|
}
|
|
|
|
export interface PaginationQuery {
|
|
page?: number;
|
|
limit?: number;
|
|
search?: string;
|
|
}
|
|
|
|
export interface PaginationResponse {
|
|
page: number;
|
|
limit: number;
|
|
total: number;
|
|
totalPages: number;
|
|
}
|
|
|
|
export interface ApiResponse<T = any> {
|
|
message: string;
|
|
data?: T;
|
|
error?: string;
|
|
}
|
|
|
|
export interface LoginResponse {
|
|
accessToken: string;
|
|
user: {
|
|
id: number;
|
|
username: string;
|
|
name: string;
|
|
email: string | null;
|
|
role: 'admin' | 'user';
|
|
};
|
|
}
|
|
|
|
export interface SerialListItem {
|
|
serialNumber: string;
|
|
companyName: string;
|
|
validUntil: string | null;
|
|
isActive: boolean;
|
|
createdAt: string;
|
|
createdBy?: string;
|
|
}
|
|
|
|
export interface CompanyListItem {
|
|
companyName: string;
|
|
firstCreated: string;
|
|
lastCreated: string;
|
|
serialCount: number;
|
|
activeCount: number;
|
|
status: 'active' | 'disabled';
|
|
}
|
|
|
|
export interface CompanyDetail {
|
|
companyName: string;
|
|
serialCount: number;
|
|
activeCount: number;
|
|
disabledCount: number;
|
|
expiredCount: number;
|
|
firstCreated: string;
|
|
lastCreated: string;
|
|
status: 'active' | 'disabled';
|
|
serials: SerialListItem[];
|
|
monthlyStats: MonthlyStat[];
|
|
}
|
|
|
|
export interface MonthlyStat {
|
|
month: string;
|
|
count: number;
|
|
}
|
|
|
|
export interface StatsOverview {
|
|
totalCompanies: number;
|
|
totalSerials: number;
|
|
activeSerials: number;
|
|
inactiveSerials: number;
|
|
}
|
|
|
|
export interface StatsResponse {
|
|
overview: StatsOverview;
|
|
monthlyStats: Array<{ month: string; company_count: number; serial_count: number }>;
|
|
recentCompanies: Array<{ companyName: string; lastCreated: string; status: 'active' | 'disabled' }>;
|
|
recentSerials: Array<{ serialNumber: string; companyName: string; isActive: boolean; createdAt: string }>;
|
|
}
|