File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
package kr.itn.itnhub.contact;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/** 담당자관리 화면 전용 CRUD. 담당자 정보가 입력되는 유일한 경로다. */
@RestController
@RequestMapping("/api/contacts")
public class ContactController {
private final ContactService service;
public ContactController(ContactService service) {
this.service = service;
}
@GetMapping
public List<Contact> list(@RequestParam(required = false) String category) {
return service.findAll(category);
}
@PostMapping
public Contact create(@Valid @RequestBody ContactRequest request) {
return service.create(request);
}
@PutMapping("/{id}")
public Contact update(@PathVariable Long id, @Valid @RequestBody ContactRequest request) {
return service.update(id, request);
}
@ResponseStatus(HttpStatus.NO_CONTENT)
@DeleteMapping("/{id}")
public void delete(@PathVariable Long id) {
service.delete(id);
}
}