main #10

Closed
student-20690 wants to merge 26 commits from (deleted):main into main
3 changed files with 9 additions and 11 deletions
Showing only changes of commit f42e1493a1 - Show all commits

View File

@@ -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;
} }
} }

View File

@@ -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){

View File

@@ -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();
} }
} }