Fix: Worker/Project status update and filtering issues
- Added cache invalidation for Workers and Projects - Implemented server-side status filtering for Workers - Fixed worker update query bug (removed non-existent join_date column) - Updated daily-work-report UI to fetch only active workers
This commit is contained in:
@@ -45,9 +45,9 @@ exports.createWorker = asyncHandler(async (req, res) => {
|
||||
* 전체 작업자 조회 (캐싱 및 페이지네이션 적용)
|
||||
*/
|
||||
exports.getAllWorkers = asyncHandler(async (req, res) => {
|
||||
const { page = 1, limit = 10, search = '' } = req.query;
|
||||
const { page = 1, limit = 10, search = '', status = '' } = req.query;
|
||||
|
||||
const cacheKey = cache.createKey('workers', 'list', page, limit, search);
|
||||
const cacheKey = cache.createKey('workers', 'list', page, limit, search, status);
|
||||
|
||||
// 캐시에서 조회
|
||||
const cachedData = await cache.get(cacheKey);
|
||||
@@ -62,7 +62,7 @@ exports.getAllWorkers = asyncHandler(async (req, res) => {
|
||||
}
|
||||
|
||||
// 최적화된 쿼리 사용
|
||||
const result = await optimizedQueries.getWorkersPaged(page, limit, search);
|
||||
const result = await optimizedQueries.getWorkersPaged(page, limit, search, status);
|
||||
|
||||
// 캐시에 저장 (5분)
|
||||
await cache.set(cacheKey, result, cache.TTL.MEDIUM);
|
||||
@@ -127,6 +127,10 @@ exports.updateWorker = asyncHandler(async (req, res) => {
|
||||
throw new NotFoundError('작업자를 찾을 수 없습니다');
|
||||
}
|
||||
|
||||
// 작업자 관련 캐시 무효화
|
||||
logger.info('작업자 수정 후 캐시 무효화', { worker_id: id });
|
||||
await cache.invalidateCache.worker();
|
||||
|
||||
logger.info('작업자 수정 성공', { worker_id: id });
|
||||
|
||||
res.json({
|
||||
|
||||
Reference in New Issue
Block a user