fromis_9/backend/src/schemas/schedule.js
caadiq f483f2cf53 refactor(backend): 트랜잭션 헬퍼, JSON 스키마 추가 및 스키마 파일 분리
- src/utils/transaction.js: withTransaction 헬퍼 함수 추가
- src/schemas/: 도메인별 스키마 파일 분리 (common, album, schedule, admin, member, auth)
- 라우트에 JSON Schema 검증 및 Swagger 문서화 적용
- 트랜잭션 패턴을 withTransaction 헬퍼로 추상화

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 14:58:07 +09:00

57 lines
1.5 KiB
JavaScript

/**
* 일정 스키마
*/
export const scheduleCategory = {
type: 'object',
properties: {
id: { type: 'integer' },
name: { type: 'string' },
color: { type: 'string' },
sort_order: { type: 'integer' },
},
};
export const scheduleMember = {
type: 'object',
properties: {
id: { type: 'integer' },
name: { type: 'string' },
},
};
export const scheduleResponse = {
type: 'object',
properties: {
id: { type: 'integer' },
title: { type: 'string' },
datetime: { type: 'string' },
category: scheduleCategory,
members: { type: 'array', items: scheduleMember },
createdAt: { type: 'string', format: 'date-time' },
updatedAt: { type: 'string', format: 'date-time' },
},
};
export const scheduleSearchQuery = {
type: 'object',
properties: {
search: { type: 'string', description: '검색어' },
year: { type: 'integer', minimum: 2000, maximum: 2100, description: '년도' },
month: { type: 'integer', minimum: 1, maximum: 12, description: '월' },
startDate: { type: 'string', format: 'date', description: '시작 날짜' },
offset: { type: 'integer', default: 0, minimum: 0, description: '페이지 오프셋' },
limit: { type: 'integer', default: 100, minimum: 1, maximum: 1000, description: '결과 개수' },
},
};
export const scheduleSearchResponse = {
type: 'object',
properties: {
schedules: { type: 'array', items: scheduleResponse },
total: { type: 'integer' },
offset: { type: 'integer' },
limit: { type: 'integer' },
hasMore: { type: 'boolean' },
},
};