feat: url dashboard
This commit is contained in:
+31
@@ -92,6 +92,28 @@ export type Stats = {
|
||||
feedback_by_category: { category: string; count: number }[];
|
||||
};
|
||||
|
||||
export type AdminShortUrl = {
|
||||
id: number;
|
||||
code: string;
|
||||
long_url: string;
|
||||
content_type: string;
|
||||
click_count: number;
|
||||
human_click_count: number;
|
||||
disabled: boolean;
|
||||
created_at: string;
|
||||
};
|
||||
|
||||
export type ShortUrlRangeStat = { created: number; clicks: number };
|
||||
|
||||
export type ShortUrlStats = {
|
||||
today: ShortUrlRangeStat;
|
||||
week: ShortUrlRangeStat;
|
||||
month: ShortUrlRangeStat;
|
||||
total_urls: number;
|
||||
total_clicks: number;
|
||||
range?: ShortUrlRangeStat; // present only when a custom from/to is requested
|
||||
};
|
||||
|
||||
export type AdminUser = {
|
||||
id: string;
|
||||
email: string | null;
|
||||
@@ -289,6 +311,15 @@ export const api = {
|
||||
collections(q: string, limit: number, offset: number) {
|
||||
return listed<AdminCollection>(`/admin/collections${qs({ q, limit, offset })}`);
|
||||
},
|
||||
shortUrls(q: string, limit: number, offset: number) {
|
||||
return listed<AdminShortUrl>(`/admin/short-urls${qs({ q, limit, offset })}`);
|
||||
},
|
||||
async shortUrlStats(from?: string, to?: string): Promise<ShortUrlStats> {
|
||||
const { data } = await call<ShortUrlStats>(
|
||||
`/admin/short-urls/stats${qs({ from, to })}`,
|
||||
);
|
||||
return data;
|
||||
},
|
||||
feedback(status: string, limit: number, offset: number) {
|
||||
return listed<AdminFeedback>(`/admin/feedback${qs({ status, limit, offset })}`);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user