[apps/cs] refactor: 접속 로그 도메인 엔티티로 분리
This commit is contained in:
@@ -2,8 +2,8 @@ import "./styles/base.css";
|
||||
import "./styles/components.css";
|
||||
import "@fontsource-variable/noto-sans-kr";
|
||||
|
||||
import { AppProvider } from "./providers";
|
||||
import { cookies } from "next/headers";
|
||||
import { AppProvider } from "./providers/app-provider";
|
||||
|
||||
const App = async ({ children }: Readonly<{ children: React.ReactNode }>) => {
|
||||
const theme = (await cookies()).get("site-theme-key");
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
export { AppProvider } from "./app-provider";
|
||||
+16
-4
@@ -2,17 +2,19 @@ import { client } from "@/shared/api";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import {
|
||||
type ConnectionLogParams,
|
||||
type ConnectionLogList,
|
||||
type ConnectionStatisticsParams,
|
||||
type ConnectionStatistics,
|
||||
type ConnectionLogService,
|
||||
type ConnectionLogPageList,
|
||||
type ConnectionLogPayload,
|
||||
type ConnectionLog,
|
||||
} from "../model/connection-log-interface";
|
||||
|
||||
class ConnectionLogApiService implements ConnectionLogService {
|
||||
async getConnectionLog(
|
||||
async getConnectionLogPage(
|
||||
params: ConnectionLogParams,
|
||||
): Promise<ConnectionLogList> {
|
||||
const response = await client.get<ConnectionLogList>(
|
||||
): Promise<ConnectionLogPageList> {
|
||||
const response = await client.get<ConnectionLogPageList>(
|
||||
`${ENDPOINT.CMS_SERVICE.CONNECTION_LOG}`,
|
||||
{ params },
|
||||
);
|
||||
@@ -28,6 +30,16 @@ class ConnectionLogApiService implements ConnectionLogService {
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async saveConnectionLog(
|
||||
payload: ConnectionLogPayload,
|
||||
): Promise<ConnectionLog> {
|
||||
const response = await client.post<ConnectionLog>(
|
||||
`${ENDPOINT.CMS_SERVICE.CONNECTION_LOG}`,
|
||||
payload,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
}
|
||||
|
||||
export const ConnectionLogApi = new ConnectionLogApiService();
|
||||
@@ -0,0 +1,6 @@
|
||||
export { ConnectionLogApi } from "./api/connection-log-service";
|
||||
export type {
|
||||
ConnectionLog,
|
||||
ConnectionStatistics,
|
||||
ConnectionStatisticsParams,
|
||||
} from "./model/connection-log-interface";
|
||||
+18
-2
@@ -22,11 +22,24 @@ export interface ConnectionLog {
|
||||
menuCd: number;
|
||||
siteId: string;
|
||||
urlPath: string;
|
||||
}
|
||||
|
||||
export interface ConnectionLogList extends ConnectionLog {
|
||||
siteNm: string;
|
||||
menuNm: string;
|
||||
wbsrKndNm: string;
|
||||
}
|
||||
|
||||
export interface ConnectionLogPayload {
|
||||
cntnId?: string;
|
||||
cntnIp?: string;
|
||||
cntnRgn?: string;
|
||||
wbsrKnd?: string;
|
||||
menuCd?: number;
|
||||
siteId?: string;
|
||||
urlPath: string;
|
||||
}
|
||||
|
||||
export interface ConnectionStatisticsParams {
|
||||
keywordType?: string;
|
||||
keyword?: string;
|
||||
@@ -62,11 +75,14 @@ export interface ConnectionStatistics {
|
||||
browserList: BrowserConnectionStatistics[];
|
||||
}
|
||||
|
||||
export type ConnectionLogList = PageableList<ConnectionLog>;
|
||||
export type ConnectionLogPageList = PageableList<ConnectionLog>;
|
||||
|
||||
export interface ConnectionLogService {
|
||||
getConnectionLog(params: ConnectionLogParams): Promise<ConnectionLogList>;
|
||||
getConnectionLogPage(
|
||||
params: ConnectionLogParams,
|
||||
): Promise<ConnectionLogPageList>;
|
||||
getConnectionStatistics(
|
||||
params: ConnectionStatisticsParams,
|
||||
): Promise<ConnectionStatistics>;
|
||||
saveConnectionLog(payload: ConnectionLogPayload): Promise<ConnectionLog>;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ChartData, ChartOptions } from "chart.js";
|
||||
import { getCssVariableValue } from "@common/components";
|
||||
import type { ConnectionStatistics } from "./connection-log-interface";
|
||||
import type { ConnectionStatistics } from "@/entities/connection-log";
|
||||
|
||||
export const chartData = {
|
||||
day: (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { ColumnDef } from "@tanstack/react-table";
|
||||
import type { ConnectionLog } from "./connection-log-interface";
|
||||
import type { ConnectionLog } from "@/entities/connection-log";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
export const columns: ColumnDef<ConnectionLog>[] = [
|
||||
|
||||
@@ -27,15 +27,17 @@ import {
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@common/components";
|
||||
import {
|
||||
ConnectionLogApi,
|
||||
type ConnectionStatisticsParams,
|
||||
} from "@/entities/connection-log";
|
||||
import { SiteSelect } from "@/entities/site";
|
||||
import { useDataTable } from "@/shared/lib";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import { NoData } from "@/shared/ui/no-data";
|
||||
import { InputDateRangePicker } from "@/shared/ui/input-date-range-picker";
|
||||
import { ConnectionLogApi } from "../api/connection-log-service";
|
||||
import { chartData } from "../model/chart-data";
|
||||
import { columns } from "../model/table-columns";
|
||||
import type { ConnectionStatisticsParams } from "../model/connection-log-interface";
|
||||
|
||||
ChartJS.register(
|
||||
CategoryScale,
|
||||
@@ -80,7 +82,7 @@ function UserStatisticsPage() {
|
||||
const query = useQuery({
|
||||
queryKey: [ENDPOINT.CMS_SERVICE.CONNECTION_LOG, searchParams],
|
||||
queryFn: () =>
|
||||
ConnectionLogApi.getConnectionLog({
|
||||
ConnectionLogApi.getConnectionLogPage({
|
||||
...searchParams,
|
||||
}),
|
||||
placeholderData: keepPreviousData,
|
||||
|
||||
Reference in New Issue
Block a user