타입에러 수정

This commit is contained in:
dohyeons
2025-11-21 03:50:45 +09:00
parent 96401634b2
commit ef08c3fd7a
3 changed files with 20 additions and 15 deletions

View File

@@ -1,10 +1,11 @@
import { Request, Response } from "express"; import { Response } from "express";
import { AuthenticatedRequest } from "../types/auth";
import { pool } from "../database/db"; import { pool } from "../database/db";
import logger from "../utils/logger"; import logger from "../utils/logger";
// 레이아웃 목록 조회 // 레이아웃 목록 조회
export const getLayouts = async ( export const getLayouts = async (
req: Request, req: AuthenticatedRequest,
res: Response res: Response
): Promise<Response> => { ): Promise<Response> => {
try { try {
@@ -67,7 +68,7 @@ export const getLayouts = async (
// 레이아웃 상세 조회 (객체 포함) // 레이아웃 상세 조회 (객체 포함)
export const getLayoutById = async ( export const getLayoutById = async (
req: Request, req: AuthenticatedRequest,
res: Response res: Response
): Promise<Response> => { ): Promise<Response> => {
try { try {
@@ -125,7 +126,7 @@ export const getLayoutById = async (
// 레이아웃 생성 // 레이아웃 생성
export const createLayout = async ( export const createLayout = async (
req: Request, req: AuthenticatedRequest,
res: Response res: Response
): Promise<Response> => { ): Promise<Response> => {
const client = await pool.connect(); const client = await pool.connect();
@@ -237,7 +238,7 @@ export const createLayout = async (
// 레이아웃 수정 // 레이아웃 수정
export const updateLayout = async ( export const updateLayout = async (
req: Request, req: AuthenticatedRequest,
res: Response res: Response
): Promise<Response> => { ): Promise<Response> => {
const client = await pool.connect(); const client = await pool.connect();
@@ -407,7 +408,7 @@ export const updateLayout = async (
// 레이아웃 삭제 // 레이아웃 삭제
export const deleteLayout = async ( export const deleteLayout = async (
req: Request, req: AuthenticatedRequest,
res: Response res: Response
): Promise<Response> => { ): Promise<Response> => {
try { try {

View File

@@ -1,4 +1,5 @@
import { Request, Response } from "express"; import { Response } from "express";
import { AuthenticatedRequest } from "../types/auth";
import { getPool } from "../database/db"; import { getPool } from "../database/db";
import { logger } from "../utils/logger"; import { logger } from "../utils/logger";
@@ -6,7 +7,7 @@ import { logger } from "../utils/logger";
* 엔티티 검색 API * 엔티티 검색 API
* GET /api/entity-search/:tableName * GET /api/entity-search/:tableName
*/ */
export async function searchEntity(req: Request, res: Response) { export async function searchEntity(req: AuthenticatedRequest, res: Response) {
try { try {
const { tableName } = req.params; const { tableName } = req.params;
const { const {
@@ -22,7 +23,8 @@ export async function searchEntity(req: Request, res: Response) {
logger.warn("엔티티 검색 실패: 테이블명이 없음", { tableName }); logger.warn("엔티티 검색 실패: 테이블명이 없음", { tableName });
return res.status(400).json({ return res.status(400).json({
success: false, success: false,
message: "테이블명이 지정되지 않았습니다. 컴포넌트 설정에서 sourceTable을 확인해주세요.", message:
"테이블명이 지정되지 않았습니다. 컴포넌트 설정에서 sourceTable을 확인해주세요.",
}); });
} }
@@ -111,8 +113,10 @@ export async function searchEntity(req: Request, res: Response) {
}, },
}); });
} catch (error: any) { } catch (error: any) {
logger.error("엔티티 검색 오류", { error: error.message, stack: error.stack }); logger.error("엔티티 검색 오류", {
error: error.message,
stack: error.stack,
});
res.status(500).json({ success: false, message: error.message }); res.status(500).json({ success: false, message: error.message });
} }
} }

View File

@@ -1,4 +1,5 @@
import { Request, Response } from "express"; import { Response } from "express";
import { AuthenticatedRequest } from "../types/auth";
import { getPool } from "../database/db"; import { getPool } from "../database/db";
import { logger } from "../utils/logger"; import { logger } from "../utils/logger";
@@ -35,7 +36,7 @@ async function generateOrderNumber(companyCode: string): Promise<string> {
* 수주 등록 API * 수주 등록 API
* POST /api/orders * POST /api/orders
*/ */
export async function createOrder(req: Request, res: Response) { export async function createOrder(req: AuthenticatedRequest, res: Response) {
const pool = getPool(); const pool = getPool();
try { try {
@@ -167,7 +168,7 @@ export async function createOrder(req: Request, res: Response) {
* 수주 목록 조회 API * 수주 목록 조회 API
* GET /api/orders * GET /api/orders
*/ */
export async function getOrders(req: Request, res: Response) { export async function getOrders(req: AuthenticatedRequest, res: Response) {
const pool = getPool(); const pool = getPool();
try { try {
@@ -235,4 +236,3 @@ export async function getOrders(req: Request, res: Response) {
}); });
} }
} }