feat: Initial commit

This commit is contained in:
2026-01-20 12:59:58 +03:00
commit 786d367b5f
15 changed files with 335 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
package ru.example.nto.controller;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import ru.example.nto.entity.Department;
import ru.example.nto.service.DepartmentService;
import java.util.List;
@RestController
@RequestMapping("api/v1/department")
public class DepartmentController {
private final DepartmentService departmentService;
public DepartmentController(DepartmentService departmentService) {
this.departmentService = departmentService;
}
@GetMapping
@ResponseStatus(code = HttpStatus.OK)
public List<Department> getAll() {
return departmentService.getAll();
}
@GetMapping("/{name}")
@ResponseStatus(HttpStatus.OK)
public Department getByName(@PathVariable String name) {
return departmentService.getByName(name);
}
}