package kr.itn.itnhub.re; import jakarta.validation.Valid; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import java.util.List; /** 기관관리 상세의 RE 탭. 등록·수정·삭제 후에는 갱신된 목록을 그대로 돌려준다. */ @RestController public class ReMemoController { private final ReMemoService service; public ReMemoController(ReMemoService service) { this.service = service; } @GetMapping("/api/orgs/{id}/re-memos") public List list(@PathVariable("id") Long orgId) { return service.list(orgId); } @PostMapping("/api/orgs/{id}/re-memos") public List add(@PathVariable("id") Long orgId, @Valid @RequestBody ReMemoRequest request) { return service.add(orgId, request); } @PutMapping("/api/orgs/{id}/re-memos/{memoId}") public List update(@PathVariable("id") Long orgId, @PathVariable Long memoId, @Valid @RequestBody ReMemoRequest request) { return service.update(orgId, memoId, request); } @ResponseStatus(HttpStatus.NO_CONTENT) @DeleteMapping("/api/orgs/{id}/re-memos/{memoId}") public void delete(@PathVariable("id") Long orgId, @PathVariable Long memoId) { service.delete(orgId, memoId); } }