api: Add services
parent
1f45622f3b
commit
8cb2b2f6c6
|
@ -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