MCPcopy Create free account
hub / github.com/Grashjs/cmms / create

Method create

api/src/main/java/com/grash/service/LaborService.java:37–45  ·  view source on GitHub ↗
(Labor labor)

Source from the content-addressed store, hash-verified

35 private final LicenseService licenseService;
36
37 @Transactional
38 public Labor create(Labor labor) {
39 if (!licenseService.hasEntitlement(LicenseEntitlement.TIME_TRACKING))
40 throw new CustomException("You need a license to create a labor", HttpStatus.FORBIDDEN);
41 updateHourlyRateIfNeeded(labor);
42 Labor savedLabor = laborRepository.saveAndFlush(labor);
43 em.refresh(savedLabor);
44 return savedLabor;
45 }
46
47 private void updateHourlyRateIfNeeded(Labor labor) {
48 if (labor.getHourlyRate() <= 0L && labor.getAssignedTo() != null) {

Callers

nothing calls this directly

Calls 3

hasEntitlementMethod · 0.80
refreshMethod · 0.45

Tested by

no test coverage detected