Skip to content

Commit

Permalink
Merge pull request #229 from ogomaemmanuel/node-sass
Browse files Browse the repository at this point in the history
Node sass
  • Loading branch information
ogomaemmanuel committed Nov 27, 2023
2 parents 2bd7fc0 + 6e8dfdf commit 2cdbf69
Show file tree
Hide file tree
Showing 109 changed files with 1,953 additions and 640 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Set;

@Repository
public interface EmployeeRepository extends BaseRepo<Employee> {
Expand Down Expand Up @@ -87,4 +88,6 @@ public interface EmployeeRepository extends BaseRepo<Employee> {
" left join departments d on e.department_id = d.id" +
" where e.deleted=0 and e.id=:employeeId",nativeQuery=true)
public EmployeeSalaryViewModel getEmployeeSalaryByEmployeeId(Long employeeId);

public List<Employee> findEmployeeByIdIn(List<Long> ids);
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import javax.persistence.*;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

@Entity
Expand Down Expand Up @@ -39,6 +40,8 @@ public class LeaveRequest {
@LastModifiedDate
@Temporal(TemporalType.TIMESTAMP)
private Date updatedAt;
@ManyToMany
private Set<Employee> approvers;

@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "applicant_user_id", updatable = false, insertable = false)
Expand Down Expand Up @@ -197,4 +200,21 @@ public void addLeaveHistory(LeaveRequestHistory leaveRequestHistory) {
}

}

public Set<Employee> getApprovers() {
return approvers;
}

public void setApprovers(Set<Employee> approvers) {
this.approvers = approvers;
}

public void addApprovers(List<Employee> approvers) {
if (approvers!=null){
approvers.forEach(approver->{
this.approvers.add(approver);
});
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

public class LeaveRequestModel {
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)
Expand All @@ -13,6 +14,8 @@ public class LeaveRequestModel {
private String reason;
private Long inPlaceId;
private Long leaveTypeId;

private List<Long> approversIds;

public Date getStartDate() {
return startDate;
Expand Down Expand Up @@ -64,4 +67,12 @@ public LeaveRequestModel setLeaveTypeId(Long leaveTypeId) {
this.leaveTypeId = leaveTypeId;
return this;
}

public List<Long> getApproversIds() {
return approversIds;
}

public void setApproversIds(List<Long> approversIds) {
this.approversIds = approversIds;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.ogoma.hr_core.boundaries.hr.leave_management.services;

import com.ogoma.hr_core.boundaries.hr.employee_management.enums.LeaveStatuses;
import com.ogoma.hr_core.boundaries.hr.employee_management.repositories.EmployeeRepository;
import com.ogoma.hr_core.boundaries.hr.leave_management.entities.LeaveRequest;
import com.ogoma.hr_core.boundaries.hr.leave_management.entities.LeaveRequestHistory;
import com.ogoma.hr_core.boundaries.hr.leave_management.events.LeaveRequestEvent;
Expand All @@ -27,24 +28,29 @@
import java.util.Optional;

@Service

public class LeaveRequestService {
private final LeaveRequestRepository leaveRequestRepository;
private final LeaveHistoryRepository leaveHistoryRepository;
private final ApplicationEventPublisher applicationEventPublisher;
private final HttpServletRequest httpServletRequest;
private final EmployeeRepository employeeRepository;

@Autowired
public LeaveRequestService(LeaveRequestRepository leaveRequestRepository,
LeaveHistoryRepository leaveHistoryRepository,
ApplicationEventPublisher applicationEventPublisher,
HttpServletRequest httpServletRequest) {
HttpServletRequest httpServletRequest, EmployeeRepository employeeRepository) {
this.leaveRequestRepository = leaveRequestRepository;
this.leaveHistoryRepository = leaveHistoryRepository;
this.applicationEventPublisher = applicationEventPublisher;
this.httpServletRequest = httpServletRequest;
this.employeeRepository = employeeRepository;
}

public LeaveRequest createLeaveRequest(LeaveRequestModel leaveRequestModel) {

var approvers= this.employeeRepository.findEmployeeByIdIn(leaveRequestModel.getApproversIds());
Long userId = SecurityUtils.getCurrentUserDetails().getId();
LeaveRequestHistory leaveRequestHistory = new
LeaveRequestHistory();
Expand All @@ -54,6 +60,7 @@ public LeaveRequest createLeaveRequest(LeaveRequestModel leaveRequestModel) {
BeanUtils.copyProperties(leaveRequestModel, leaveRequest);
leaveRequest.setLeaveStatuses(LeaveStatuses.NEW.name());
leaveRequest.setApplicantId(userId);
leaveRequest.addApprovers(approvers);
leaveRequest.addLeaveHistory(leaveRequestHistory);
leaveRequestRepository.save(leaveRequest);
LeaveRequestEventData leaveRequestEventData = new LeaveRequestEventData(
Expand Down
3 changes: 3 additions & 0 deletions hr_core/src/main/resources/static/css/dist/48.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
.v-sidebar-menu .vsm--header {
background: #1e1e21;
}
.top-1\/2 {
top: 50%;
}

2 changes: 1 addition & 1 deletion hr_core/src/main/resources/static/js/dist/1.bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion hr_core/src/main/resources/static/js/dist/10.bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion hr_core/src/main/resources/static/js/dist/105.bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion hr_core/src/main/resources/static/js/dist/106.bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2cdbf69

Please sign in to comment.