2026-08-16 14:45:02 +07:00
|
|
|
import { orpc } from "@/lib/orpc/client";
|
2026-07-26 11:27:21 +07:00
|
|
|
import type {
|
2026-08-01 23:06:00 +07:00
|
|
|
DashboardActivity,
|
2026-07-26 11:27:21 +07:00
|
|
|
DashboardChannelDetail,
|
|
|
|
|
DashboardStats,
|
|
|
|
|
DashboardUserDetail,
|
|
|
|
|
PaginatedChannels,
|
|
|
|
|
PaginatedUsers,
|
2026-08-05 10:20:12 +07:00
|
|
|
TopReactedMessage,
|
2026-08-05 11:29:56 +07:00
|
|
|
TopReactor,
|
2026-07-26 11:27:21 +07:00
|
|
|
} from "@/lib/types";
|
|
|
|
|
|
|
|
|
|
export const dashboardApi = {
|
2026-08-16 14:45:02 +07:00
|
|
|
getStats: () => orpc.dashboard.stats() as unknown as Promise<DashboardStats>,
|
2026-07-26 11:27:21 +07:00
|
|
|
|
2026-08-01 23:06:00 +07:00
|
|
|
getActivity: (days = 14) =>
|
2026-08-16 14:45:02 +07:00
|
|
|
orpc.dashboard.activity({ days }) as unknown as Promise<DashboardActivity>,
|
2026-08-01 23:06:00 +07:00
|
|
|
|
2026-08-16 13:25:10 +07:00
|
|
|
listUsers: (limit?: number, cursor?: string, search?: string) =>
|
2026-08-16 14:45:02 +07:00
|
|
|
orpc.dashboard.users({
|
2026-08-16 13:25:10 +07:00
|
|
|
limit,
|
|
|
|
|
cursor,
|
|
|
|
|
search,
|
|
|
|
|
}) as unknown as Promise<PaginatedUsers>,
|
2026-07-26 11:27:21 +07:00
|
|
|
|
|
|
|
|
getUserDetail: (userId: string) =>
|
2026-08-16 14:45:02 +07:00
|
|
|
orpc.dashboard.userDetail({
|
2026-08-16 13:25:10 +07:00
|
|
|
userId,
|
|
|
|
|
}) as unknown as Promise<DashboardUserDetail>,
|
2026-07-26 11:27:21 +07:00
|
|
|
|
2026-08-16 13:25:10 +07:00
|
|
|
listChannels: (limit?: number, search?: string, guildId?: string) =>
|
2026-08-16 14:45:02 +07:00
|
|
|
orpc.dashboard.channels({
|
2026-08-16 13:25:10 +07:00
|
|
|
limit,
|
|
|
|
|
search,
|
|
|
|
|
guildId,
|
|
|
|
|
}) as unknown as Promise<PaginatedChannels>,
|
2026-07-26 11:27:21 +07:00
|
|
|
|
|
|
|
|
getChannelDetail: (channelId: string) =>
|
2026-08-16 14:45:02 +07:00
|
|
|
orpc.dashboard.channelDetail({
|
2026-08-16 13:25:10 +07:00
|
|
|
channelId,
|
|
|
|
|
}) as unknown as Promise<DashboardChannelDetail>,
|
2026-08-05 10:20:12 +07:00
|
|
|
|
|
|
|
|
getTopReactions: (limit = 20) =>
|
2026-08-16 14:45:02 +07:00
|
|
|
orpc.dashboard.reactions({ limit }) as unknown as Promise<
|
2026-08-16 13:25:10 +07:00
|
|
|
TopReactedMessage[]
|
|
|
|
|
>,
|
2026-08-05 11:29:56 +07:00
|
|
|
|
|
|
|
|
getTopReactors: (limit = 20) =>
|
2026-08-16 14:45:02 +07:00
|
|
|
orpc.dashboard.reactors({ limit }) as unknown as Promise<TopReactor[]>,
|
2026-07-26 11:27:21 +07:00
|
|
|
};
|