Skip to content

[원병선] 통합구현 #5

Description

@byeongseon8-arch

TODO : JpaRepository<Post, Long> 를 상속하도록 선언

  • JpaRepository<Post, Long> 를 상속하도록 선언

TODO: 외부 API 연계(수신) → 변환 → DB 저장

  • @transactional 적용
  • RestTemplate + UriComponentsBuilder 로 (apiBase + "/posts", ?_limit=10) GET 호출
  • 상태코드가 HttpStatus.OK 가 아니거나 body 가 null 이면 MyBizException 발생 (연계 장애)
  • 응답 PostDTO[] 를 돌며 createAt=now() 설정 후 postRepository.save(dto.toEntity())
  • 저장 건수(int) 반환

TODO: DB 저장된 연계 데이터 목록 재제공

  • @transactional(readOnly = true)
  • findAll() → PostDTO.from 으로 매핑하여 List 반환

TODO: 단건 재제공

  • @transactional(readOnly = true)
  • findById(id) (없으면 MyBizException) → PostDTO.from

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions