최신 export 기록 조회 API (v2)
최신 export 기록 조회 API는 인증된 사용자의 채널별(LOCAL | EPA) 가장 최근 1건 의 health-data export 기록을 조회하는 v2 endpoint입니다. 채널은 path 로 고정되므로 별도 쿼리 파라미터/검증(400)이 없으며, 해당 채널 이력이 없으면 HTTP 200 + 응답 바디 null 을 반환합니다.
핵심
- 채널별 경로 분리:
GET .../local/latest(LOCAL),GET .../epa/latest(EPA). 두 endpoint는 채널만 다르고 응답 스키마는 동일합니다. - 이력 없음 = 200 +
null: 해당 채널 이력이 없으면 status 200 그대로 응답 바디가null입니다. - DB read only: 조회만 수행하므로 사전조건(active cycle 등) 검증이 없습니다.
인증 정책 (v2 공통)
- 인증 채널은
Authorization: Bearer <accessToken>한 줄(JwtAuthGuard). - 채널은 path 로 고정되므로 Query Parameter / Request Body 가 없습니다.
GET /v2/health-data/export/local/latest
인증된 사용자의 LOCAL 채널 최신 export 기록 1건을 조회합니다.
- Path:
GET /v2/health-data/export/local/latest - 인증: User Access Token (
JwtAuthGuard) - Rate Limit: 60/분 (전역 default)
- 🔗 라이브 명세 (Swagger UI): dev
Request
| Header | Value |
|---|---|
Authorization | Bearer <accessToken> (필수) |
요청 본문/쿼리 없음. 채널은 path(local)로 고정됩니다.
Response 200 OK — LatestExportResponseDto
{
"channel": "LOCAL",
"status": "SUCCEEDED",
"requestedAt": 1749031200000,
"completedAt": 1749031205000
}
이력이 없으면 응답 바디는 null 입니다(status 200 동일).
| 필드 | 타입 | 필수 | 설명 |
|---|---|---|---|
channel | string | Yes | export 채널 (LOCAL | EPA) — 요청 path 에 대응 |
status | string | Yes | export 결과 (SUCCEEDED | FAILED) |
requestedAt | number | Yes | export 요청 시각 unix timestamp(ms, 13자리) |
completedAt | number | null | No | export 완료 시각 unix timestamp(ms, 13자리). 미완료 시 null |
Errors
| HTTP | code | message | 발생 조건 |
|---|---|---|---|
| 401 | 1000 | Authentication token not found | Bearer access token 미제공 (JwtAuthGuard) |
| 401 | 1000 | Invalid or expired token | access token 만료/서명·검증 실패 (JwtAuthGuard) |
| 401 | 1000 | Invalid token: missing subject (user ID) | payload에 userId(sub) 없음 |
| 401 | 1000 | User ID not found in request | guard 통과했으나 req.user.userId 부재 (컨트롤러) |
| 500 | 21000 | (빈 값) | export 기록 조회 중 예상치 못한 서버 오류 |
| 500 | 1000 | An unexpected error occurred | 그 외 미처리 예외 (global exception filter fallback) |
GET /v2/health-data/export/epa/latest
인증된 사용자의 EPA 채널 최신 export 기록 1건을 조회합니다. 응답 스키마·에러는 위 LOCAL 조회와 동일하며 channel 값만 EPA 입니다.
- Path:
GET /v2/health-data/export/epa/latest - 인증: User Access Token (
JwtAuthGuard) - Rate Limit: 60/분 (전역 default)
- 🔗 라이브 명세 (Swagger UI): dev
Request
| Header | Value |
|---|---|
Authorization | Bearer <accessToken> (필수) |
요청 본문/쿼리 없음. 채널은 path(epa)로 고정됩니다.
Response 200 OK — LatestExportResponseDto
{
"channel": "EPA",
"status": "SUCCEEDED",
"requestedAt": 1749031200000,
"completedAt": 1749031205000
}
이력이 없으면 응답 바디는 null 입니다. 필드 상세는 위 GET .../local/latest 의 응답 표를 참조하세요.
Errors
위 LOCAL 조회와 동일합니다(401 4종 + 500 21000 / 1000).
다음 단계
- 새 export 실행: 로컬 export · ePA 전송.
- 자동 주기 전송 설정: ePA 주기 export 스케줄.