feat(web): charge point details page
This commit is contained in:
@@ -27,14 +27,27 @@ export type Stats = {
|
||||
};
|
||||
|
||||
export type ConnectorSummary = {
|
||||
id: number;
|
||||
id: string;
|
||||
connectorId: number;
|
||||
status: string;
|
||||
lastStatusAt: string | null;
|
||||
};
|
||||
|
||||
export type ConnectorDetail = {
|
||||
id: string;
|
||||
connectorId: number;
|
||||
status: string;
|
||||
errorCode: string;
|
||||
info: string | null;
|
||||
vendorId: string | null;
|
||||
vendorErrorCode: string | null;
|
||||
lastStatusAt: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
};
|
||||
|
||||
export type ChargePoint = {
|
||||
id: number;
|
||||
id: string;
|
||||
chargePointIdentifier: string;
|
||||
chargePointVendor: string | null;
|
||||
chargePointModel: string | null;
|
||||
@@ -45,6 +58,27 @@ export type ChargePoint = {
|
||||
connectors: ConnectorSummary[];
|
||||
};
|
||||
|
||||
export type ChargePointDetail = {
|
||||
id: string;
|
||||
chargePointIdentifier: string;
|
||||
chargePointVendor: string | null;
|
||||
chargePointModel: string | null;
|
||||
chargePointSerialNumber: string | null;
|
||||
firmwareVersion: string | null;
|
||||
iccid: string | null;
|
||||
imsi: string | null;
|
||||
meterSerialNumber: string | null;
|
||||
meterType: string | null;
|
||||
registrationStatus: string;
|
||||
heartbeatInterval: number | null;
|
||||
lastHeartbeatAt: string | null;
|
||||
lastBootNotificationAt: string | null;
|
||||
feePerKwh: number;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
connectors: ConnectorDetail[];
|
||||
};
|
||||
|
||||
export type Transaction = {
|
||||
id: number;
|
||||
chargePointIdentifier: string | null;
|
||||
@@ -98,7 +132,7 @@ export const api = {
|
||||
},
|
||||
chargePoints: {
|
||||
list: () => apiFetch<ChargePoint[]>("/api/charge-points"),
|
||||
get: (id: number) => apiFetch<ChargePoint>(`/api/charge-points/${id}`),
|
||||
get: (id: string) => apiFetch<ChargePointDetail>(`/api/charge-points/${id}`),
|
||||
create: (data: {
|
||||
chargePointIdentifier: string;
|
||||
chargePointVendor?: string;
|
||||
@@ -124,11 +158,12 @@ export const api = {
|
||||
apiFetch<{ success: true }>(`/api/charge-points/${id}`, { method: "DELETE" }),
|
||||
},
|
||||
transactions: {
|
||||
list: (params?: { page?: number; limit?: number; status?: "active" | "completed" }) => {
|
||||
list: (params?: { page?: number; limit?: number; status?: "active" | "completed"; chargePointId?: string }) => {
|
||||
const q = new URLSearchParams();
|
||||
if (params?.page) q.set("page", String(params.page));
|
||||
if (params?.limit) q.set("limit", String(params.limit));
|
||||
if (params?.status) q.set("status", params.status);
|
||||
if (params?.chargePointId) q.set("chargePointId", params.chargePointId);
|
||||
const qs = q.toString();
|
||||
return apiFetch<PaginatedTransactions>(`/api/transactions${qs ? "?" + qs : ""}`);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user