THE END OF THE DAY

This commit is contained in:
Daniil Makeev 2025-02-18 20:31:10 +03:00
parent 7853f77e14
commit 78f2190788
2 changed files with 15 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package com.example.onomatopoeiaback.controller;
import com.example.onomatopoeiaback.domain.employee.Employee;
import com.example.onomatopoeiaback.domain.employee.EmployeeDTO;
import com.example.onomatopoeiaback.domain.visit.Visit;
import com.example.onomatopoeiaback.domain.visit.VisitDTO;
import com.example.onomatopoeiaback.service.EmployeeService;
@ -27,6 +28,11 @@ public class EmployeeController {
return String.format("Hello %s!", name);
}
@PostMapping("/create")
public ResponseEntity<Employee> createEmployee(@RequestBody EmployeeDTO employeeDTO) {
return ResponseEntity.ok(employeeService.createEmployee(employeeDTO));
}
@GetMapping("/{username}/info")
public ResponseEntity<Employee> info(@PathVariable String username) {
return employeeService.info(username);

View File

@ -1,6 +1,7 @@
package com.example.onomatopoeiaback.service;
import com.example.onomatopoeiaback.domain.employee.Employee;
import com.example.onomatopoeiaback.domain.employee.EmployeeDTO;
import com.example.onomatopoeiaback.repository.EmployeeRepository;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@ -18,6 +19,14 @@ public class EmployeeService {
this.employeeRepository = employeeRepository;
}
public Employee createEmployee(EmployeeDTO employeeDTO) {
// TODO
Employee employee = new Employee();
employee.setLogin(employeeDTO.getLogin());
employee.setPassword(employeeDTO.getPassword());
return employee;
}
public HttpStatus auth(String login) {
Employee employee = employeeRepository.getEmployeesByLogin(login);