THE END OF THE DAY
This commit is contained in:
parent
7853f77e14
commit
78f2190788
@ -2,6 +2,7 @@ package com.example.onomatopoeiaback.controller;
|
|||||||
|
|
||||||
|
|
||||||
import com.example.onomatopoeiaback.domain.employee.Employee;
|
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.Visit;
|
||||||
import com.example.onomatopoeiaback.domain.visit.VisitDTO;
|
import com.example.onomatopoeiaback.domain.visit.VisitDTO;
|
||||||
import com.example.onomatopoeiaback.service.EmployeeService;
|
import com.example.onomatopoeiaback.service.EmployeeService;
|
||||||
@ -27,6 +28,11 @@ public class EmployeeController {
|
|||||||
return String.format("Hello %s!", name);
|
return String.format("Hello %s!", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
public ResponseEntity<Employee> createEmployee(@RequestBody EmployeeDTO employeeDTO) {
|
||||||
|
return ResponseEntity.ok(employeeService.createEmployee(employeeDTO));
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/{username}/info")
|
@GetMapping("/{username}/info")
|
||||||
public ResponseEntity<Employee> info(@PathVariable String username) {
|
public ResponseEntity<Employee> info(@PathVariable String username) {
|
||||||
return employeeService.info(username);
|
return employeeService.info(username);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.example.onomatopoeiaback.service;
|
package com.example.onomatopoeiaback.service;
|
||||||
|
|
||||||
import com.example.onomatopoeiaback.domain.employee.Employee;
|
import com.example.onomatopoeiaback.domain.employee.Employee;
|
||||||
|
import com.example.onomatopoeiaback.domain.employee.EmployeeDTO;
|
||||||
import com.example.onomatopoeiaback.repository.EmployeeRepository;
|
import com.example.onomatopoeiaback.repository.EmployeeRepository;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
@ -18,6 +19,14 @@ public class EmployeeService {
|
|||||||
this.employeeRepository = employeeRepository;
|
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) {
|
public HttpStatus auth(String login) {
|
||||||
Employee employee = employeeRepository.getEmployeesByLogin(login);
|
Employee employee = employeeRepository.getEmployeesByLogin(login);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user