2026-08-16 13:25:10 +07:00
|
|
|
import { trpc } from "@/lib/trpc/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 13:25:10 +07:00
|
|
|
getStats: () =>
|
|
|
|
|
trpc.dashboard.stats.query() 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 13:25:10 +07:00
|
|
|
trpc.dashboard.activity.query({
|
|
|
|
|
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) =>
|
|
|
|
|
trpc.dashboard.users.query({
|
|
|
|
|
limit,
|
|
|
|
|
cursor,
|
|
|
|
|
search,
|
|
|
|
|
}) as unknown as Promise<PaginatedUsers>,
|
2026-07-26 11:27:21 +07:00
|
|
|
|
|
|
|
|
getUserDetail: (userId: string) =>
|
2026-08-16 13:25:10 +07:00
|
|
|
trpc.dashboard.userDetail.query({
|
|
|
|
|
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) =>
|
|
|
|
|
trpc.dashboard.channels.query({
|
|
|
|
|
limit,
|
|
|
|
|
search,
|
|
|
|
|
guildId,
|
|
|
|
|
}) as unknown as Promise<PaginatedChannels>,
|
2026-07-26 11:27:21 +07:00
|
|
|
|
|
|
|
|
getChannelDetail: (channelId: string) =>
|
2026-08-16 13:25:10 +07:00
|
|
|
trpc.dashboard.channelDetail.query({
|
|
|
|
|
channelId,
|
|
|
|
|
}) as unknown as Promise<DashboardChannelDetail>,
|
2026-08-05 10:20:12 +07:00
|
|
|
|
|
|
|
|
getTopReactions: (limit = 20) =>
|
2026-08-16 13:25:10 +07:00
|
|
|
trpc.dashboard.reactions.query({ limit }) as unknown as Promise<
|
|
|
|
|
TopReactedMessage[]
|
|
|
|
|
>,
|
2026-08-05 11:29:56 +07:00
|
|
|
|
|
|
|
|
getTopReactors: (limit = 20) =>
|
2026-08-16 13:25:10 +07:00
|
|
|
trpc.dashboard.reactors.query({ limit }) as unknown as Promise<
|
|
|
|
|
TopReactor[]
|
|
|
|
|
>,
|
2026-07-26 11:27:21 +07:00
|
|
|
};
|