-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
개요
점검 일정을 등록하고 관리할 수 있는 API를 개발합니다. 신고 점검과 정기 점검을 구분하여 관리하며, 점검자의 담당 구역에 따른 권한 관리를 제공합니다.
점검 일정 관리 API
작업 내용
- 모델 정의:
- ReportSchedule, RegularSchedule 엔티티 작성 및 DB 매핑
- 점검 일정 등록 API:
- 신규 점검 일정 저장
- 일정 중복 확인
- 구역 기반 권한 검증
- 점검 일정 조회 API:
- 전체 점검 일정 목록 조회
- 특정 점검 상세 정보 조회
- 구역별 필터링
세부 내용
- 모델 정의:
@Entity
public class ReportSchedule {
@Id @GeneratedValue
private Long scheduleId;
private LocalDate scheduleDate;
private LocalDate nextDate;
private String status;
@ManyToOne
private Inspector inspector;
@ManyToOne
private Report report;
}
@Entity
public class RegularSchedule {
@Id @GeneratedValue
private Long scheduleId;
private LocalDate scheduleDate;
private LocalDate nextDate;
private String status;
@ManyToOne
private Inspector inspector;
}- 점검 일정 등록 API:
@PostMapping("/api/schedules/reports")
public ApiResponse<?> createReportSchedule(@RequestBody ReportScheduleRequestDto request,
@AuthenticationPrincipal UserDetails userDetails) {
return scheduleService.createReportSchedule(request, userDetails.getUsername());
}
@PostMapping("/api/schedules/regular")
public ApiResponse<?> createRegularSchedule(@RequestBody RegularScheduleRequestDto request,
@AuthenticationPrincipal UserDetails userDetails) {
return scheduleService.createRegularSchedule(request, userDetails.getUsername());
}- 점검 일정 조회 API:
@GetMapping("/api/schedules/reports")
public ApiResponse<?> getMyReportSchedules(@AuthenticationPrincipal UserDetails userDetails) {
return scheduleService.getReportSchedulesByInspector(userDetails.getUsername());
}
@GetMapping("/api/schedules/regular")
public ApiResponse<?> getMyRegularSchedules(@AuthenticationPrincipal UserDetails userDetails) {
return scheduleService.getRegularSchedulesByInspector(userDetails.getUsername());
}응답 형식
- 성공 응답:
{
"status": 200,
"message": "일정이 성공적으로 예약되었습니다.",
"data": {
"scheduleId": 1,
"scheduleDate": "2025-02-01",
"nextDate": "2025-02-15",
"status": "SCHEDULED",
"inspectorName": "홍길동",
"report": {
"reportId": 1,
"description": "신고 내용",
"detailAddress": "부산광역시 사하구",
"defectType": "결함 유형"
}
}
}구현된 기능
- 구역 기반 권한 관리: 점검자는 자신의 담당 구역 신고만 점검 가능
- 중복 일정 방지: 이미 예약된 신고나 같은 날짜의 정기 점검 방지
- 메시지 국제화: 다국어 지원을 위한 메시지 소스 통합
- 예외 처리: 권한, 중복, 유효성 검사 등 다양한 예외 상황 처리
이 기능은 점검자가 자신의 담당 구역 내에서 효율적으로 점검 일정을 관리할 수 있도록 도와주는 핵심 기능입니다. 구역 기반의 권한 관리를 통해 체계적인 점검 관리가 가능하며, 중복 일정 방지 기능으로 일정 관리의 신뢰성을 높입니다.
Metadata
Metadata
Assignees
Labels
No labels