151 lines
4.3 KiB
TypeScript
151 lines
4.3 KiB
TypeScript
import { fakerKO as faker } from "@faker-js/faker";
|
|
import type {
|
|
HBArticleItem,
|
|
IMRArticleItem,
|
|
ValidationArticleItem,
|
|
} from "./verification-article-interface";
|
|
|
|
const HB_STATS_ITEMS = [
|
|
"하수도 보급률",
|
|
"하수관로",
|
|
"하수처리시설 및 방류량보고",
|
|
"펌프장",
|
|
"공공하수처리시설",
|
|
"분뇨처리시설",
|
|
"개인하수처리시설",
|
|
"하수도재정",
|
|
"물 재이용",
|
|
];
|
|
|
|
const HB_VERIFICATION_ITEMS = [
|
|
"행정구역 보급률",
|
|
"유역환경청별 보급률",
|
|
"관로연장",
|
|
"처리용량",
|
|
"방류량",
|
|
"펌프용량",
|
|
];
|
|
|
|
const IMR_STATS_ITEMS = [
|
|
"하수도 보급률",
|
|
"하수관로",
|
|
"하수처리시설 및 방류량보고",
|
|
"펌프장",
|
|
"공공하수처리시설",
|
|
"분뇨처리시설",
|
|
"개인하수처리시설",
|
|
"하수도재정",
|
|
"물 재이용",
|
|
];
|
|
|
|
const VALIDATION_STATS_ITEMS = [
|
|
"하수관로 유지관리",
|
|
"하수저류시설 및 빗물펌프장",
|
|
"공공하수처리시설",
|
|
"분뇨처리시설",
|
|
"개인하수처리시설",
|
|
"하수도재정",
|
|
];
|
|
|
|
const VERIFICATION_NAMES = [
|
|
"제정별 사업비",
|
|
"관로길이",
|
|
"공란검증",
|
|
"범위검증",
|
|
"논리검증",
|
|
"유지보수",
|
|
];
|
|
|
|
const TABLE_NAMES = [
|
|
"tb_stats_drng_sys",
|
|
"tb_stats_ppline",
|
|
"tb_stats_fclt",
|
|
"tb_stats_pump_stt",
|
|
"tb_stats_sewg_trtm",
|
|
];
|
|
|
|
const COLUMN_NAMES = [
|
|
"drng_sys_rate",
|
|
"ppline_len",
|
|
"fclt_cpct",
|
|
"pump_cpct",
|
|
"trtm_qty",
|
|
"popl_cnt",
|
|
];
|
|
|
|
const BASIC_RULES = [
|
|
"값 > 0",
|
|
"값 >= 0",
|
|
"값 != NULL",
|
|
"범위: 0-100",
|
|
"A > B",
|
|
];
|
|
|
|
function formatDateTime(date: Date): string {
|
|
const y = date.getFullYear();
|
|
const m = String(date.getMonth() + 1).padStart(2, "0");
|
|
const d = String(date.getDate()).padStart(2, "0");
|
|
const h = String(date.getHours()).padStart(2, "0");
|
|
const min = String(date.getMinutes()).padStart(2, "0");
|
|
return `${y}-${m}-${d} ${h}:${min}`;
|
|
}
|
|
|
|
/** H-B 탭 목데이터 생성 */
|
|
export function createHBArticleMock(count = 10): HBArticleItem[] {
|
|
faker.seed(100);
|
|
return Array.from({ length: count }, (_, index) => ({
|
|
statsItmNm: faker.helpers.arrayElement(HB_STATS_ITEMS),
|
|
vrfcItmNm: faker.helpers.arrayElement(HB_VERIFICATION_ITEMS),
|
|
tblNm: faker.helpers.arrayElement(TABLE_NAMES),
|
|
colNm: faker.helpers.arrayElement(COLUMN_NAMES),
|
|
percentileVal: faker.number.float({
|
|
min: 0,
|
|
max: 100,
|
|
fractionDigits: 2,
|
|
}),
|
|
aVal: faker.number.float({ min: 0, max: 10, fractionDigits: 3 }),
|
|
cVal: faker.number.float({ min: 0, max: 10, fractionDigits: 3 }),
|
|
regNm: faker.person.fullName(),
|
|
regDt: formatDateTime(faker.date.recent({ days: 90 })),
|
|
}));
|
|
}
|
|
|
|
/** I-MR 탭 목데이터 생성 */
|
|
export function createIMRArticleMock(count = 10): IMRArticleItem[] {
|
|
faker.seed(200);
|
|
return Array.from({ length: count }, (_, index) => ({
|
|
statsItmNm: faker.helpers.arrayElement(IMR_STATS_ITEMS),
|
|
vrfcNm: faker.helpers.arrayElement(VERIFICATION_NAMES),
|
|
tblNm: faker.helpers.arrayElement(TABLE_NAMES),
|
|
colNm: faker.helpers.arrayElement(COLUMN_NAMES),
|
|
regNm: faker.person.fullName(),
|
|
regDt: formatDateTime(faker.date.recent({ days: 90 })),
|
|
}));
|
|
}
|
|
|
|
/** Validation 탭 목데이터 생성 */
|
|
export function createValidationArticleMock(
|
|
count = 6,
|
|
): ValidationArticleItem[] {
|
|
faker.seed(300);
|
|
return Array.from({ length: count }, (_, index) => ({
|
|
no: `${index + 1}`,
|
|
statsItmNm: faker.helpers.arrayElement(VALIDATION_STATS_ITEMS),
|
|
vrfcNm: faker.helpers.arrayElement(VERIFICATION_NAMES),
|
|
tblNm: faker.helpers.arrayElement(TABLE_NAMES),
|
|
colNm: faker.helpers.arrayElement(COLUMN_NAMES),
|
|
cmpTblNm: faker.helpers.arrayElement(TABLE_NAMES),
|
|
cmpColNm: faker.helpers.arrayElement(COLUMN_NAMES),
|
|
bscRul: faker.helpers.arrayElement(BASIC_RULES),
|
|
}));
|
|
}
|
|
|
|
/** H-B 탭 기본 목데이터 */
|
|
export const hbArticleMockData = createHBArticleMock(10);
|
|
|
|
/** I-MR 탭 기본 목데이터 */
|
|
export const imrArticleMockData = createIMRArticleMock(10);
|
|
|
|
/** Validation 탭 기본 목데이터 */
|
|
export const validationArticleMockData = createValidationArticleMock(6);
|