Compare commits

...

4 Commits

Author SHA1 Message Date
kjy
7b0d5b3023 상세주소 번지 일반주소로 옮김 2026-03-25 04:42:53 +09:00
kjy
2239533fb5 잘못올림 2026-03-04 11:20:39 +09:00
kjy
5a059641b4 레일팩 timezone 추가 2026-03-04 11:19:45 +09:00
kjy
9aa12420e8 타임존설정 2026-03-04 10:56:41 +09:00
4 changed files with 53 additions and 4 deletions

3
.env
View File

@@ -4,4 +4,5 @@
# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings
DATABASE_URL="file:./prisma/dev.db"
DATABASE_URL="file:./prisma/dev.db"
TZ=Asia/Seoul

View File

@@ -29,6 +29,7 @@
"xlsx": "^0.18.5"
},
"scripts": {
"start": "bun run starter.ts"
"start": "bun run starter.ts",
"postinstall": "bun x prisma generate"
}
}

7
railpack.json Normal file
View File

@@ -0,0 +1,7 @@
{
"deploy": {
"variables": {
"TZ": "Asia/Seoul"
}
}
}

View File

@@ -10,6 +10,7 @@ import {
testUsers,
type TelegramUser,
} from "./services/telegram.service";
import type { RealEstateArticle } from "./generated/prisma";
import * as XLSX from "xlsx";
import { unlink } from "node:fs/promises";
@@ -21,6 +22,41 @@ const telegramService = new TelegramService(
false
);
function splitAddress(
detailAddress: string | null | undefined,
baseAddress: string
) {
const safeDetail = detailAddress?.trim() || "";
const base = baseAddress.trim();
if (!safeDetail) {
return { address: base, detailAddress: "" };
}
const match = safeDetail.match(
/(^|[\s,])([\d]{1,6}(?:-[\d]{1,6})?)(?:\s*번지)?(?=[\s,]|$)/
);
if (!match) {
return { address: base, detailAddress: safeDetail };
}
const rawToken = match[2];
if (!rawToken) {
return { address: base, detailAddress: safeDetail };
}
const lot = rawToken.replace(/\s+/g, "");
const removed = safeDetail
.replace(new RegExp(`(^|[\\s,])${rawToken}(?:\\s*번지)?(?=[\\s,]|$)`), "")
.replace(/\s{2,}/g, " ")
.trim();
return {
address: [base, lot].filter(Boolean).join(" ").trim(),
detailAddress: removed,
};
}
function logWithTime(...args: unknown[]) {
console.log(`[${dayjs().format("YYYY-MM-DD HH:mm:ss")}]`, ...args);
}
@@ -106,6 +142,10 @@ async function createExcelFile(
const getPrice = () => {
return item.prcInfo;
};
const normalizedAddress = splitAddress(
item.detailAddress || "",
`${item.city || ""} ${item.division || ""} ${item.sector || ""}`
);
return {
매물번호: item.articleNumber,
@@ -113,8 +153,8 @@ async function createExcelFile(
소유자구분: getOwnerType(),
매물형태: item.articleName || "",
매매구분: item.tradTpNm || "",
: `${item.city || ""} ${item.division || ""} ${item.sector || ""}`,
상세주소: item.detailAddress || "",
주소: normalizedAddress.address,
상세주소: normalizedAddress.detailAddress,
층수: item.floorInfo || "",
가격: getPrice(),
매물특징: item.articleDescription || "",