화물차 지도 마커와 카카오 키 전환
This commit is contained in:
@@ -9,7 +9,7 @@ const PORT = Number(process.env.PORT || 8080);
|
||||
const DATA_DIR = process.env.DATA_DIR || path.resolve(__dirname, "..", "data");
|
||||
const WEB_ROOT = process.env.WEB_ROOT || path.resolve(__dirname, "..", "..", "web", "public");
|
||||
const ADMIN_TOKEN = process.env.ADMIN_TOKEN || "";
|
||||
const DEFAULT_KAKAO_JAVASCRIPT_KEY = "5e0f889314e6d4f26fb18ee63d09c1ec";
|
||||
const DEFAULT_KAKAO_JAVASCRIPT_KEY = "07f4728599ceaf4299f77c772a135423";
|
||||
|
||||
const DRIVERS_FILE = path.join(DATA_DIR, "drivers.json");
|
||||
const LATEST_FILE = path.join(DATA_DIR, "latest-locations.json");
|
||||
@@ -400,6 +400,10 @@ function createLocationRecord(body, driver) {
|
||||
speed: optionalNumber(body.speed),
|
||||
heading: optionalNumber(body.heading),
|
||||
batteryLevel: optionalNumber(body.batteryLevel),
|
||||
cargoName: optionalString(body.cargoName || body.cargoItem || body.cargo || body.itemName, 80),
|
||||
cargoWeight: optionalString(body.cargoWeight || body.weight, 40),
|
||||
origin: optionalString(body.origin || body.departure, 80),
|
||||
destination: optionalString(body.destination || body.arrival, 80),
|
||||
provider: body.provider ? String(body.provider) : "",
|
||||
recordedAt: normalizeDate(body.recordedAt),
|
||||
receivedAt: new Date().toISOString()
|
||||
@@ -426,6 +430,11 @@ function optionalNumber(value) {
|
||||
return Number.isFinite(parsed) ? parsed : null;
|
||||
}
|
||||
|
||||
function optionalString(value, maxLength) {
|
||||
if (value === undefined || value === null) return "";
|
||||
return String(value).trim().slice(0, maxLength);
|
||||
}
|
||||
|
||||
function normalizeDate(value) {
|
||||
if (!value) return new Date().toISOString();
|
||||
const parsed = new Date(value);
|
||||
|
||||
Reference in New Issue
Block a user