Files
sarlink-portal/lib/backend-types.ts
i701 1f6fe7db38
Some checks failed
Build and Push Docker Images / Build and Push Docker Images (push) Has been cancelled
feat(user-topups): add user topups page with dynamic filtering and admin table integration
feat(admin-devices-table): update admin check to use is_admin and clean up device display logic 
feat(admin-topup-table): create admin topups table with pagination and detail view links 
fix(user-payments-table): correct user data access and display payment amount with currency 
feat(app-sidebar): add link for user topups in the admin sidebar 
fix(backend-types): enhance Payment interface to include user details for better data handling 
2025-07-24 23:01:41 +05:00

100 lines
1.8 KiB
TypeScript

import { User } from "./types/user";
export interface Links {
next_page: string | null;
previous_page: string | null;
}
export interface Meta {
total: number;
per_page: number;
current_page: number;
last_page: number;
}
export interface ApiResponse<T> {
meta: Meta;
links: Links;
data: T[];
}
export interface Atoll {
id: number;
islands: Island[];
name: string;
createdAt: string;
updatedAt: string;
}
export interface Island {
id: number;
name: string;
createdAt: string;
updatedAt: string;
}
export interface Device {
id: number;
name: string;
mac: string;
vendor: string;
reason_for_blocking: string | null;
has_a_pending_payment: boolean;
pending_payment_id: string | null;
is_active: boolean;
registered: boolean;
blocked: boolean;
blocked_by: string;
expiry_date: string | null;
created_at: string;
updated_at: string;
user: Pick<User, "id" | "id_card" | "mobile"> & {
name: string;
};
}
export interface ApiError {
message?: string;
detail?: string;
}
export interface Topup {
id: string;
amount: number;
user: Pick<User, "id" | "id_card" | "mobile"> & {
name: string;
};
paid: boolean;
status: "CANCELLED" | "PENDING" | "VERIFIED";
paid_at: string | null;
mib_reference: string | null;
expires_at: string;
is_expired: boolean;
created_at: string;
updated_at: string;
}
export interface Payment {
id: string;
devices: Device[];
number_of_months: number;
amount: number;
paid: boolean;
paid_at: string | null;
method: string;
expires_at: string;
is_expired: boolean;
created_at: string;
updated_at: string;
status: "CANCELLED" | "PENDING" | "PAID";
mib_reference: string | null;
user: Pick<User, "id" | "id_card" | "mobile"> & {
name: string;
};
}
export interface NewPayment {
device_ids: number[];
number_of_months: number;
amount: number;
}