-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
42252a7
commit 04408e9
Showing
10 changed files
with
138 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/main/java/com/pj/liquibasedemo/domain/EmploymentType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,33 +9,55 @@ | |
|
||
import java.util.List; | ||
|
||
/** | ||
* Provides API endpoints for Employee and related operations | ||
* | ||
* @author Pavan Kumar Jadda | ||
* @since 1.0.0 | ||
*/ | ||
@RestController | ||
@RequestMapping("/api/v1/employee") | ||
public class EmployeeController | ||
{ | ||
private final EmployeeRepository employeeRepository; | ||
private final EmployeeRepository employeeRepository; | ||
|
||
public EmployeeController(EmployeeRepository employeeRepository) | ||
{ | ||
this.employeeRepository = employeeRepository; | ||
} | ||
public EmployeeController(EmployeeRepository employeeRepository) | ||
{ | ||
this.employeeRepository = employeeRepository; | ||
} | ||
|
||
|
||
@GetMapping(path = "/list") | ||
public List<Employee> findAll() | ||
{ | ||
return employeeRepository.findAll(); | ||
} | ||
/** | ||
* Finds all employees in the database | ||
* | ||
* @return List of employees | ||
* | ||
* @author Pavan Kumar Jadda | ||
* @since 1.0.0 | ||
*/ | ||
@GetMapping(path = "/list") | ||
public List<Employee> findAll() | ||
{ | ||
return employeeRepository.findAll(); | ||
} | ||
|
||
@GetMapping(path = "/create") | ||
public Employee createEmployee() | ||
{ | ||
Employee employee = new Employee(); | ||
employee.setFirstName("John"); | ||
employee.setLastName("Reese"); | ||
employee.setEmail("[email protected]"); | ||
employee.setPhone("903-888-9999"); | ||
employee.setEmploymentType(EmploymentType.CONTRACTOR); | ||
return employeeRepository.saveAndFlush(employee); | ||
} | ||
/** | ||
* Creates a new employee in the database | ||
* | ||
* @return Newly created employee | ||
* | ||
* @author Pavan Kumar Jadda | ||
* @since 1.0.0 | ||
*/ | ||
@GetMapping(path = "/create") | ||
public Employee createEmployee() | ||
{ | ||
Employee employee = new Employee(); | ||
employee.setFirstName("John"); | ||
employee.setLastName("Reese"); | ||
employee.setEmail("[email protected]"); | ||
employee.setPhone("903-888-9999"); | ||
employee.setEmploymentType(EmploymentType.CONTRACTOR); | ||
return employeeRepository.saveAndFlush(employee); | ||
} | ||
} |