restore: old src/ components, subscriptions, audit-log, client detail pages; fix tsconfig @/* paths; merge api.ts
This commit is contained in:
209
src/types/index.ts
Normal file
209
src/types/index.ts
Normal file
@@ -0,0 +1,209 @@
|
||||
export interface User {
|
||||
id: string;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
email: string;
|
||||
phone?: string;
|
||||
isActive: boolean;
|
||||
lastLoginAt?: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
roleAssignments?: RoleAssignment[];
|
||||
}
|
||||
|
||||
export interface RoleAssignment {
|
||||
id: string;
|
||||
userId: string;
|
||||
role: string;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
export interface AuthUser {
|
||||
id: string;
|
||||
email: string;
|
||||
firstName?: string;
|
||||
lastName?: string;
|
||||
name?: string;
|
||||
role?: string;
|
||||
}
|
||||
|
||||
export interface AuthState {
|
||||
user: AuthUser | null;
|
||||
accessToken: string | null;
|
||||
tenantSlug: string | null;
|
||||
isAuthenticated: boolean;
|
||||
login: (tenantSlug: string, email: string, password: string) => Promise<void>;
|
||||
logout: () => void;
|
||||
}
|
||||
|
||||
export interface Client {
|
||||
id: string;
|
||||
tenantId: string;
|
||||
accountNumber: string;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
email: string;
|
||||
phone: string;
|
||||
address?: string;
|
||||
isActive: boolean;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
area?: { id: string; name: string };
|
||||
subscriptions?: Subscription[];
|
||||
}
|
||||
|
||||
export interface Subscription {
|
||||
id: string;
|
||||
clientId: string;
|
||||
planId: string;
|
||||
plan?: Plan;
|
||||
status: string;
|
||||
type?: string;
|
||||
startDate: string;
|
||||
endDate?: string;
|
||||
monthlyRate?: number;
|
||||
mrc?: number;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
export interface Plan {
|
||||
id: string;
|
||||
name: string;
|
||||
type: string;
|
||||
speedDownMbps: number;
|
||||
speedUpMbps: number;
|
||||
monthlyPrice: number;
|
||||
isActive: boolean;
|
||||
}
|
||||
|
||||
export interface Invoice {
|
||||
id: string;
|
||||
invoiceNumber?: string;
|
||||
clientId: string;
|
||||
client?: { firstName: string; lastName: string; accountNumber: string };
|
||||
amount: number;
|
||||
totalAmount?: number;
|
||||
dueDate: string;
|
||||
status: string;
|
||||
paidAt?: string;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
export interface Payment {
|
||||
id: string;
|
||||
clientId: string;
|
||||
client?: { firstName: string; lastName: string; accountNumber: string };
|
||||
amount: number;
|
||||
channel: string;
|
||||
reference?: string;
|
||||
referenceNumber?: string;
|
||||
status: string;
|
||||
date?: string;
|
||||
paymentDate?: string;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
export interface Ticket {
|
||||
id: string;
|
||||
ticketNumber?: string;
|
||||
subject: string;
|
||||
description?: string;
|
||||
clientId?: string;
|
||||
client?: { id: string; firstName: string; lastName: string; accountNumber: string };
|
||||
type: string;
|
||||
priority: string;
|
||||
status: string;
|
||||
assignedToId?: string;
|
||||
assignedTo?: { id: string; firstName: string; lastName: string } | string;
|
||||
assignedUser?: { id: string; firstName: string; lastName: string };
|
||||
createdById?: string;
|
||||
createdBy?: { firstName: string; lastName: string };
|
||||
resolvedAt?: string;
|
||||
updatedAt?: string;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
export interface Remittance {
|
||||
id: string;
|
||||
collectorId?: string;
|
||||
collector?: { firstName: string; lastName: string };
|
||||
amount: number | string;
|
||||
notes?: string;
|
||||
status: string;
|
||||
payments?: Payment[];
|
||||
createdAt: string;
|
||||
updatedAt?: string;
|
||||
}
|
||||
|
||||
export interface Task {
|
||||
id: string;
|
||||
title: string;
|
||||
type: string;
|
||||
status: string;
|
||||
assignedTo?: string;
|
||||
assignedUser?: { firstName: string; lastName: string };
|
||||
dueDate?: string;
|
||||
ticketId?: string;
|
||||
ticket?: { subject: string };
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
export interface AuditLog {
|
||||
id: string;
|
||||
userId?: string;
|
||||
user?: { firstName: string; lastName: string; email: string };
|
||||
action: string;
|
||||
entity?: string;
|
||||
entityType?: string;
|
||||
entityId?: string;
|
||||
details?: Record<string, unknown>;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
export interface DashboardSummary {
|
||||
subscribers: {
|
||||
total: number;
|
||||
active: number;
|
||||
pending: number;
|
||||
suspended: number;
|
||||
};
|
||||
billing: {
|
||||
unpaidInvoices: number;
|
||||
overdueInvoices: number;
|
||||
};
|
||||
support: {
|
||||
openTickets: number;
|
||||
inProgressTickets: number;
|
||||
};
|
||||
tasks: {
|
||||
pending: number;
|
||||
};
|
||||
revenue: {
|
||||
thisMonth: number;
|
||||
lastMonth: number;
|
||||
growth: number | null;
|
||||
};
|
||||
}
|
||||
|
||||
export interface Meta {
|
||||
total: number;
|
||||
page: number;
|
||||
limit: number;
|
||||
totalPages: number;
|
||||
}
|
||||
|
||||
export interface PaginatedResponse<T> {
|
||||
data: T[];
|
||||
meta: Meta;
|
||||
}
|
||||
|
||||
// For /users which returns plain array
|
||||
export type UsersResponse = User[];
|
||||
|
||||
// For invoices/payments which return { data, total, page, limit }
|
||||
export interface LegacyPaginatedResponse<T> {
|
||||
data: T[];
|
||||
total: number;
|
||||
page: number;
|
||||
limit: number;
|
||||
}
|
||||
Reference in New Issue
Block a user