Merge pull request 'feat: Implement services and controllers' (#6) from 3002833/Backend:main into main
Reviewed-on: Maradona/Backend#6pull/1/head
commit
793af99cab
|
@ -0,0 +1,43 @@
|
|||
package com.maradona.backend.controllers;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.maradona.backend.entities.Employee;
|
||||
import com.maradona.backend.services.EmployeeService;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/employees")
|
||||
public class EmployeeController {
|
||||
|
||||
@Autowired
|
||||
private EmployeeService employeeService;
|
||||
|
||||
@PostMapping
|
||||
public ResponseEntity<Employee> createEmployee(@RequestBody Employee employee) {
|
||||
Employee savedEmployee = employeeService.saveEmployee(employee);
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body(savedEmployee);
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public ResponseEntity<Employee> getEmployee(@PathVariable Long id) {
|
||||
Optional<Employee> employee = employeeService.getEmployeeById(id);
|
||||
return employee.map(ResponseEntity::ok)
|
||||
.orElseGet(() -> ResponseEntity.status(HttpStatus.NOT_FOUND).build());
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
public ResponseEntity<Void> deleteEmployee(@PathVariable Long id) {
|
||||
employeeService.deleteEmployee(id);
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public ResponseEntity<Iterable<Employee>> getAllEmployees() {
|
||||
Iterable<Employee> employees = employeeService.getAllEmployees();
|
||||
return ResponseEntity.ok(employees);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.maradona.backend.controllers;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.maradona.backend.entities.FormOfAddress;
|
||||
import com.maradona.backend.services.FormOfAddressService;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/form-of-address")
|
||||
public class FormOfAddressController {
|
||||
|
||||
@Autowired
|
||||
private FormOfAddressService formOfAddressService;
|
||||
|
||||
@PostMapping
|
||||
public ResponseEntity<FormOfAddress> createFormOfAddress(@RequestBody FormOfAddress formOfAddress) {
|
||||
FormOfAddress savedFormOfAddress = formOfAddressService.saveFormOfAddress(formOfAddress);
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body(savedFormOfAddress);
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public ResponseEntity<FormOfAddress> getFormOfAddress(@PathVariable Long id) {
|
||||
Optional<FormOfAddress> formOfAddress = formOfAddressService.getFormOfAddressById(id);
|
||||
return formOfAddress.map(ResponseEntity::ok)
|
||||
.orElseGet(() -> ResponseEntity.status(HttpStatus.NOT_FOUND).build());
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
public ResponseEntity<Void> deleteFormOfAddress(@PathVariable Long id) {
|
||||
formOfAddressService.deleteFormOfAddress(id);
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public ResponseEntity<Iterable<FormOfAddress>> getAllFormOfAddresses() {
|
||||
Iterable<FormOfAddress> formOfAddresses = formOfAddressService.getAllFormOfAddresses();
|
||||
return ResponseEntity.ok(formOfAddresses);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.maradona.backend.controllers;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.maradona.backend.entities.PrimarySkill;
|
||||
import com.maradona.backend.services.PrimarySkillService;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/primary-skills")
|
||||
public class PrimarySkillController {
|
||||
|
||||
@Autowired
|
||||
private PrimarySkillService primarySkillService;
|
||||
|
||||
@PostMapping
|
||||
public ResponseEntity<PrimarySkill> createPrimarySkill(@RequestBody PrimarySkill primarySkill) {
|
||||
PrimarySkill savedPrimarySkill = primarySkillService.savePrimarySkill(primarySkill);
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body(savedPrimarySkill);
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public ResponseEntity<PrimarySkill> getPrimarySkill(@PathVariable Long id) {
|
||||
Optional<PrimarySkill> primarySkill = primarySkillService.getPrimarySkillById(id);
|
||||
return primarySkill.map(ResponseEntity::ok)
|
||||
.orElseGet(() -> ResponseEntity.status(HttpStatus.NOT_FOUND).build());
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
public ResponseEntity<Void> deletePrimarySkill(@PathVariable Long id) {
|
||||
primarySkillService.deletePrimarySkill(id);
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public ResponseEntity<Iterable<PrimarySkill>> getAllPrimarySkills() {
|
||||
Iterable<PrimarySkill> primarySkills = primarySkillService.getAllPrimarySkills();
|
||||
return ResponseEntity.ok(primarySkills);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.maradona.backend.controllers;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.maradona.backend.entities.ProjectAssignment;
|
||||
import com.maradona.backend.services.ProjectAssignmentService;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/project-assignments")
|
||||
public class ProjectAssignmentController {
|
||||
|
||||
@Autowired
|
||||
private ProjectAssignmentService projectAssignmentService;
|
||||
|
||||
@PostMapping
|
||||
public ResponseEntity<ProjectAssignment> createProjectAssignment(@RequestBody ProjectAssignment projectAssignment) {
|
||||
ProjectAssignment savedProjectAssignment = projectAssignmentService.saveProjectAssignment(projectAssignment);
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body(savedProjectAssignment);
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public ResponseEntity<ProjectAssignment> getProjectAssignment(@PathVariable Long id) {
|
||||
Optional<ProjectAssignment> projectAssignment = projectAssignmentService.getProjectAssignmentById(id);
|
||||
return projectAssignment.map(ResponseEntity::ok)
|
||||
.orElseGet(() -> ResponseEntity.status(HttpStatus.NOT_FOUND).build());
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
public ResponseEntity<Void> deleteProjectAssignment(@PathVariable Long id) {
|
||||
projectAssignmentService.deleteProjectAssignment(id);
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public ResponseEntity<Iterable<ProjectAssignment>> getAllProjectAssignments() {
|
||||
Iterable<ProjectAssignment> projectAssignments = projectAssignmentService.getAllProjectAssignments();
|
||||
return ResponseEntity.ok(projectAssignments);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.maradona.backend.controllers;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.maradona.backend.entities.Project;
|
||||
import com.maradona.backend.services.ProjectService;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/projects")
|
||||
public class ProjectController {
|
||||
|
||||
@Autowired
|
||||
private ProjectService projectService;
|
||||
|
||||
@PostMapping
|
||||
public ResponseEntity<Project> createProject(@RequestBody Project project) {
|
||||
Project savedProject = projectService.saveProject(project);
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body(savedProject);
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public ResponseEntity<Project> getProject(@PathVariable Long id) {
|
||||
Optional<Project> project = projectService.getProjectById(id);
|
||||
return project.map(ResponseEntity::ok)
|
||||
.orElseGet(() -> ResponseEntity.status(HttpStatus.NOT_FOUND).build());
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
public ResponseEntity<Void> deleteProject(@PathVariable Long id) {
|
||||
projectService.deleteProject(id);
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public ResponseEntity<Iterable<Project>> getAllProjects() {
|
||||
Iterable<Project> projects = projectService.getAllProjects();
|
||||
return ResponseEntity.ok(projects);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.maradona.backend.controllers;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.maradona.backend.entities.SecondarySkill;
|
||||
import com.maradona.backend.services.SecondarySkillService;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/secondary-skills")
|
||||
public class SecondarySkillController {
|
||||
|
||||
@Autowired
|
||||
private SecondarySkillService secondarySkillService;
|
||||
|
||||
@PostMapping
|
||||
public ResponseEntity<SecondarySkill> createSecondarySkill(@RequestBody SecondarySkill secondarySkill) {
|
||||
SecondarySkill savedSecondarySkill = secondarySkillService.saveSecondarySkill(secondarySkill);
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body(savedSecondarySkill);
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public ResponseEntity<SecondarySkill> getSecondarySkill(@PathVariable Long id) {
|
||||
Optional<SecondarySkill> secondarySkill = secondarySkillService.getSecondarySkillById(id);
|
||||
return secondarySkill.map(ResponseEntity::ok)
|
||||
.orElseGet(() -> ResponseEntity.status(HttpStatus.NOT_FOUND).build());
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
public ResponseEntity<Void> deleteSecondarySkill(@PathVariable Long id) {
|
||||
secondarySkillService.deleteSecondarySkill(id);
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public ResponseEntity<Iterable<SecondarySkill>> getAllSecondarySkills() {
|
||||
Iterable<SecondarySkill> secondarySkills = secondarySkillService.getAllSecondarySkills();
|
||||
return ResponseEntity.ok(secondarySkills);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.maradona.backend.controllers;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.maradona.backend.entities.SkillAssignment;
|
||||
import com.maradona.backend.services.SkillAssignmentService;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/skill-assignments")
|
||||
public class SkillAssignmentController {
|
||||
|
||||
@Autowired
|
||||
private SkillAssignmentService skillAssignmentService;
|
||||
|
||||
@PostMapping
|
||||
public ResponseEntity<SkillAssignment> createSkillAssignment(@RequestBody SkillAssignment skillAssignment) {
|
||||
SkillAssignment savedSkillAssignment = skillAssignmentService.saveSkillAssignment(skillAssignment);
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body(savedSkillAssignment);
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public ResponseEntity<SkillAssignment> getSkillAssignment(@PathVariable Long id) {
|
||||
Optional<SkillAssignment> skillAssignment = skillAssignmentService.getSkillAssignmentById(id);
|
||||
return skillAssignment.map(ResponseEntity::ok)
|
||||
.orElseGet(() -> ResponseEntity.status(HttpStatus.NOT_FOUND).build());
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
public ResponseEntity<Void> deleteSkillAssignment(@PathVariable Long id) {
|
||||
skillAssignmentService.deleteSkillAssignment(id);
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public ResponseEntity<Iterable<SkillAssignment>> getAllSkillAssignments() {
|
||||
Iterable<SkillAssignment> skillAssignments = skillAssignmentService.getAllSkillAssignments();
|
||||
return ResponseEntity.ok(skillAssignments);
|
||||
}
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
package com.maradona.backend.controllers;
|
||||
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/skills")
|
||||
public class SkillController {
|
||||
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package com.maradona.backend.repositories;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import com.maradona.backend.entities.Employee;
|
||||
|
||||
public interface EmployeeRepository extends JpaRepository<Employee, Long> {
|
||||
public interface EmployeeRepository extends CrudRepository<Employee, Long> {
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.maradona.backend.repositories;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import com.maradona.backend.entities.FormOfAddress;
|
||||
|
||||
public interface FormOfAddressRepository extends JpaRepository<FormOfAddress, Long> {
|
||||
public interface FormOfAddressRepository extends CrudRepository<FormOfAddress, Long> {
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.maradona.backend.repositories;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import com.maradona.backend.entities.PrimarySkill;
|
||||
|
||||
public interface PrimarySkillRepository extends JpaRepository<PrimarySkill, Long> {
|
||||
public interface PrimarySkillRepository extends CrudRepository<PrimarySkill, Long> {
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.maradona.backend.repositories;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import com.maradona.backend.entities.ProjectAssignment;
|
||||
|
||||
public interface ProjectAssignmentRepository extends JpaRepository<ProjectAssignment, Long> {
|
||||
public interface ProjectAssignmentRepository extends CrudRepository<ProjectAssignment, Long> {
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.maradona.backend.repositories;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import com.maradona.backend.entities.Project;
|
||||
|
||||
public interface ProjectRepository extends JpaRepository<Project, Long> {
|
||||
public interface ProjectRepository extends CrudRepository<Project, Long> {
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.maradona.backend.repositories;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import com.maradona.backend.entities.SecondarySkill;
|
||||
|
||||
public interface SecondarySkillRepository extends JpaRepository<SecondarySkill, Long> {
|
||||
public interface SecondarySkillRepository extends CrudRepository<SecondarySkill, Long> {
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.maradona.backend.repositories;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import com.maradona.backend.entities.SkillAssignment;
|
||||
|
||||
public interface SkillAssignmentRepository extends JpaRepository<SkillAssignment, Long> {
|
||||
public interface SkillAssignmentRepository extends CrudRepository<SkillAssignment, Long> {
|
||||
}
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package com.maradona.backend.services;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.maradona.backend.entities.Employee;
|
||||
import com.maradona.backend.repositories.EmployeeRepository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
public class EmployeeService {
|
||||
|
||||
@Autowired
|
||||
private EmployeeRepository employeeRepository;
|
||||
|
||||
public Employee saveEmployee(Employee employee) {
|
||||
return employeeRepository.save(employee);
|
||||
}
|
||||
|
||||
public Optional<Employee> getEmployeeById(Long id) {
|
||||
return employeeRepository.findById(id);
|
||||
}
|
||||
|
||||
public void deleteEmployee(Long id) {
|
||||
employeeRepository.deleteById(id);
|
||||
}
|
||||
|
||||
public Iterable<Employee> getAllEmployees() {
|
||||
return employeeRepository.findAll();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.maradona.backend.services;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.maradona.backend.entities.FormOfAddress;
|
||||
import com.maradona.backend.repositories.FormOfAddressRepository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
public class FormOfAddressService {
|
||||
|
||||
@Autowired
|
||||
private FormOfAddressRepository formOfAddressRepository;
|
||||
|
||||
public FormOfAddress saveFormOfAddress(FormOfAddress formOfAddress) {
|
||||
return formOfAddressRepository.save(formOfAddress);
|
||||
}
|
||||
|
||||
public Optional<FormOfAddress> getFormOfAddressById(Long id) {
|
||||
return formOfAddressRepository.findById(id);
|
||||
}
|
||||
|
||||
public void deleteFormOfAddress(Long id) {
|
||||
formOfAddressRepository.deleteById(id);
|
||||
}
|
||||
|
||||
public Iterable<FormOfAddress> getAllFormOfAddresses() {
|
||||
return formOfAddressRepository.findAll();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.maradona.backend.services;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.maradona.backend.entities.PrimarySkill;
|
||||
import com.maradona.backend.repositories.PrimarySkillRepository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
public class PrimarySkillService {
|
||||
|
||||
@Autowired
|
||||
private PrimarySkillRepository primarySkillRepository;
|
||||
|
||||
public PrimarySkill savePrimarySkill(PrimarySkill primarySkill) {
|
||||
return primarySkillRepository.save(primarySkill);
|
||||
}
|
||||
|
||||
public Optional<PrimarySkill> getPrimarySkillById(Long id) {
|
||||
return primarySkillRepository.findById(id);
|
||||
}
|
||||
|
||||
public void deletePrimarySkill(Long id) {
|
||||
primarySkillRepository.deleteById(id);
|
||||
}
|
||||
|
||||
public Iterable<PrimarySkill> getAllPrimarySkills() {
|
||||
return primarySkillRepository.findAll();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.maradona.backend.services;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.maradona.backend.entities.ProjectAssignment;
|
||||
import com.maradona.backend.repositories.ProjectAssignmentRepository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
public class ProjectAssignmentService {
|
||||
|
||||
@Autowired
|
||||
private ProjectAssignmentRepository projectAssignmentRepository;
|
||||
|
||||
public ProjectAssignment saveProjectAssignment(ProjectAssignment projectAssignment) {
|
||||
return projectAssignmentRepository.save(projectAssignment);
|
||||
}
|
||||
|
||||
public Optional<ProjectAssignment> getProjectAssignmentById(Long id) {
|
||||
return projectAssignmentRepository.findById(id);
|
||||
}
|
||||
|
||||
public void deleteProjectAssignment(Long id) {
|
||||
projectAssignmentRepository.deleteById(id);
|
||||
}
|
||||
|
||||
public Iterable<ProjectAssignment> getAllProjectAssignments() {
|
||||
return projectAssignmentRepository.findAll();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.maradona.backend.services;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.maradona.backend.entities.Project;
|
||||
import com.maradona.backend.repositories.ProjectRepository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
public class ProjectService {
|
||||
|
||||
@Autowired
|
||||
private ProjectRepository projectRepository;
|
||||
|
||||
public Project saveProject(Project project) {
|
||||
return projectRepository.save(project);
|
||||
}
|
||||
|
||||
public Optional<Project> getProjectById(Long id) {
|
||||
return projectRepository.findById(id);
|
||||
}
|
||||
|
||||
public void deleteProject(Long id) {
|
||||
projectRepository.deleteById(id);
|
||||
}
|
||||
|
||||
public Iterable<Project> getAllProjects() {
|
||||
return projectRepository.findAll();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.maradona.backend.services;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.maradona.backend.entities.SecondarySkill;
|
||||
import com.maradona.backend.repositories.SecondarySkillRepository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
public class SecondarySkillService {
|
||||
|
||||
@Autowired
|
||||
private SecondarySkillRepository secondarySkillRepository;
|
||||
|
||||
public SecondarySkill saveSecondarySkill(SecondarySkill secondarySkill) {
|
||||
return secondarySkillRepository.save(secondarySkill);
|
||||
}
|
||||
|
||||
public Optional<SecondarySkill> getSecondarySkillById(Long id) {
|
||||
return secondarySkillRepository.findById(id);
|
||||
}
|
||||
|
||||
public void deleteSecondarySkill(Long id) {
|
||||
secondarySkillRepository.deleteById(id);
|
||||
}
|
||||
|
||||
public Iterable<SecondarySkill> getAllSecondarySkills() {
|
||||
return secondarySkillRepository.findAll();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.maradona.backend.services;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.maradona.backend.entities.SkillAssignment;
|
||||
import com.maradona.backend.repositories.SkillAssignmentRepository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
public class SkillAssignmentService {
|
||||
|
||||
@Autowired
|
||||
private SkillAssignmentRepository skillAssignmentRepository;
|
||||
|
||||
public SkillAssignment saveSkillAssignment(SkillAssignment skillAssignment) {
|
||||
return skillAssignmentRepository.save(skillAssignment);
|
||||
}
|
||||
|
||||
public Optional<SkillAssignment> getSkillAssignmentById(Long id) {
|
||||
return skillAssignmentRepository.findById(id);
|
||||
}
|
||||
|
||||
public void deleteSkillAssignment(Long id) {
|
||||
skillAssignmentRepository.deleteById(id);
|
||||
}
|
||||
|
||||
public Iterable<SkillAssignment> getAllSkillAssignments() {
|
||||
return skillAssignmentRepository.findAll();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue