:(
This commit is contained in:
@@ -37,13 +37,10 @@ public class EmployeeController {
|
|||||||
if (employeeService.isCodeValid(code)) {
|
if (employeeService.isCodeValid(code)) {
|
||||||
return HttpStatus.OK;
|
return HttpStatus.OK;
|
||||||
|
|
||||||
} else if (code == null) {
|
} else if (!employeeService.isCodeValid(code)){
|
||||||
return
|
return HttpStatus.UNAUTHORIZED;
|
||||||
HttpStatus.BAD_REQUEST;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return
|
return HttpStatus.BAD_REQUEST;
|
||||||
HttpStatus.UNAUTHORIZED;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
package com.example.nto.entity;
|
package com.example.nto.entity;
|
||||||
|
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.*;
|
||||||
import jakarta.persistence.GeneratedValue;
|
|
||||||
import jakarta.persistence.GenerationType;
|
|
||||||
import jakarta.persistence.Id;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -23,9 +20,11 @@ import lombok.NoArgsConstructor;
|
|||||||
public class Place {
|
public class Place {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@Column(name = "id")
|
||||||
private long id;
|
private long id;
|
||||||
|
|
||||||
|
|
||||||
|
@Column(name = "place_name")
|
||||||
private String place;
|
private String place;
|
||||||
|
|
||||||
public Place(long id, String place){
|
public Place(long id, String place){
|
||||||
|
|||||||
@@ -39,4 +39,6 @@ public class EmployeeServiceImpl implements EmployeeService {
|
|||||||
public boolean isCodeValid(String code){
|
public boolean isCodeValid(String code){
|
||||||
return employeeRepository.findByCode(code).isPresent();
|
return employeeRepository.findByCode(code).isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user