플로우 위젝 라벨표시 및 , 배치관리 회사별 분리

This commit is contained in:
kjs
2025-10-28 12:06:54 +09:00
parent c0f2fbbd88
commit 7c45b3e254
8 changed files with 486 additions and 270 deletions

View File

@@ -4,7 +4,11 @@
import { Request, Response } from "express";
import { AuthenticatedRequest } from "../types/auth";
import { BatchExecutionLogService } from "../services/batchExecutionLogService";
import { BatchExecutionLogFilter, CreateBatchExecutionLogRequest, UpdateBatchExecutionLogRequest } from "../types/batchExecutionLogTypes";
import {
BatchExecutionLogFilter,
CreateBatchExecutionLogRequest,
UpdateBatchExecutionLogRequest,
} from "../types/batchExecutionLogTypes";
export class BatchExecutionLogController {
/**
@@ -18,7 +22,7 @@ export class BatchExecutionLogController {
start_date,
end_date,
page,
limit
limit,
} = req.query;
const filter: BatchExecutionLogFilter = {
@@ -27,11 +31,15 @@ export class BatchExecutionLogController {
start_date: start_date ? new Date(start_date as string) : undefined,
end_date: end_date ? new Date(end_date as string) : undefined,
page: page ? Number(page) : undefined,
limit: limit ? Number(limit) : undefined
limit: limit ? Number(limit) : undefined,
};
const result = await BatchExecutionLogService.getExecutionLogs(filter);
const userCompanyCode = req.user?.companyCode;
const result = await BatchExecutionLogService.getExecutionLogs(
filter,
userCompanyCode
);
if (result.success) {
res.json(result);
} else {
@@ -42,7 +50,7 @@ export class BatchExecutionLogController {
res.status(500).json({
success: false,
message: "배치 실행 로그 조회 중 오류가 발생했습니다.",
error: error instanceof Error ? error.message : "알 수 없는 오류"
error: error instanceof Error ? error.message : "알 수 없는 오류",
});
}
}
@@ -53,9 +61,9 @@ export class BatchExecutionLogController {
static async createExecutionLog(req: AuthenticatedRequest, res: Response) {
try {
const data: CreateBatchExecutionLogRequest = req.body;
const result = await BatchExecutionLogService.createExecutionLog(data);
if (result.success) {
res.status(201).json(result);
} else {
@@ -66,7 +74,7 @@ export class BatchExecutionLogController {
res.status(500).json({
success: false,
message: "배치 실행 로그 생성 중 오류가 발생했습니다.",
error: error instanceof Error ? error.message : "알 수 없는 오류"
error: error instanceof Error ? error.message : "알 수 없는 오류",
});
}
}
@@ -78,9 +86,12 @@ export class BatchExecutionLogController {
try {
const { id } = req.params;
const data: UpdateBatchExecutionLogRequest = req.body;
const result = await BatchExecutionLogService.updateExecutionLog(Number(id), data);
const result = await BatchExecutionLogService.updateExecutionLog(
Number(id),
data
);
if (result.success) {
res.json(result);
} else {
@@ -91,7 +102,7 @@ export class BatchExecutionLogController {
res.status(500).json({
success: false,
message: "배치 실행 로그 업데이트 중 오류가 발생했습니다.",
error: error instanceof Error ? error.message : "알 수 없는 오류"
error: error instanceof Error ? error.message : "알 수 없는 오류",
});
}
}
@@ -102,9 +113,11 @@ export class BatchExecutionLogController {
static async deleteExecutionLog(req: AuthenticatedRequest, res: Response) {
try {
const { id } = req.params;
const result = await BatchExecutionLogService.deleteExecutionLog(Number(id));
const result = await BatchExecutionLogService.deleteExecutionLog(
Number(id)
);
if (result.success) {
res.json(result);
} else {
@@ -115,7 +128,7 @@ export class BatchExecutionLogController {
res.status(500).json({
success: false,
message: "배치 실행 로그 삭제 중 오류가 발생했습니다.",
error: error instanceof Error ? error.message : "알 수 없는 오류"
error: error instanceof Error ? error.message : "알 수 없는 오류",
});
}
}
@@ -126,9 +139,11 @@ export class BatchExecutionLogController {
static async getLatestExecutionLog(req: AuthenticatedRequest, res: Response) {
try {
const { batchConfigId } = req.params;
const result = await BatchExecutionLogService.getLatestExecutionLog(Number(batchConfigId));
const result = await BatchExecutionLogService.getLatestExecutionLog(
Number(batchConfigId)
);
if (result.success) {
res.json(result);
} else {
@@ -139,7 +154,7 @@ export class BatchExecutionLogController {
res.status(500).json({
success: false,
message: "최신 배치 실행 로그 조회 중 오류가 발생했습니다.",
error: error instanceof Error ? error.message : "알 수 없는 오류"
error: error instanceof Error ? error.message : "알 수 없는 오류",
});
}
}
@@ -149,18 +164,14 @@ export class BatchExecutionLogController {
*/
static async getExecutionStats(req: AuthenticatedRequest, res: Response) {
try {
const {
batch_config_id,
start_date,
end_date
} = req.query;
const { batch_config_id, start_date, end_date } = req.query;
const result = await BatchExecutionLogService.getExecutionStats(
batch_config_id ? Number(batch_config_id) : undefined,
start_date ? new Date(start_date as string) : undefined,
end_date ? new Date(end_date as string) : undefined
);
if (result.success) {
res.json(result);
} else {
@@ -171,9 +182,8 @@ export class BatchExecutionLogController {
res.status(500).json({
success: false,
message: "배치 실행 통계 조회 중 오류가 발생했습니다.",
error: error instanceof Error ? error.message : "알 수 없는 오류"
error: error instanceof Error ? error.message : "알 수 없는 오류",
});
}
}
}