MLC-260/add cancellationReason and creationdate and update contractController
Fusionnées MLC-260/add cancellationReason and creationdate and update contractController
feature/MLC-260
dans
develop
5 fils de conversation non résolus
5 fils de conversation non résolus
Closes MLC-260
Rapports de requête de fusion
Activité
Filtrer l'activité
48 56 } 49 57 50 @PostMapping(Paths.UPDATE_CONTRACT_STATUS) 51 public ResponseEntity<Void> changeContractStatus( 52 @PathVariable Long id, 53 @RequestParam ContractStatus newStatus) throws FunctionalException { 54 contractService.changeContractStatus(id, newStatus); 55 return ResponseEntity.ok().build(); 58 59 @PostMapping(Paths.UPDATE_CONTRACT_STATUS) 60 public ResponseEntity<ContractDTO> changeContractStatus( 61 @PathVariable Long id, 62 @RequestParam ContractStatus status, 63 @RequestParam(required = false) String cancellationReason) throws FunctionalException { 64 if (status.equals(ContractStatus.CANCELED) && (cancellationReason == null || cancellationReason.trim().isEmpty())) { 65 throw new FunctionalException("Le motif de résiliation est requis pour le statut 'Résilié'."); changed this line in version 2 of the diff
81 return ResponseEntity.ok(saved); 82 } 83 84 @PostMapping("/update-deposit/{id}") 85 public ResponseEntity<ContractDTO> updateDepositAndActivate( 86 @PathVariable Long id, 87 @RequestParam double depositAmount 88 ) throws FunctionalException { 89 ContractDTO updatedContract = contractService.updateDepositAndActivate(id, depositAmount); 90 return ResponseEntity.ok(updatedContract); 91 } 92 93 @PostMapping("/upload-temp-signed") 94 public ResponseEntity<String> uploadTempSignedContract(@RequestParam("file") MultipartFile file) 95 throws S3FunctionalException { 96 String fileUrl = s3FileService.uploadSingleFile(file); changed this line in version 2 of the diff
65 throw new FunctionalException("ERR_CONTRACT_CANCEL_REASON_REQUIRED"); 66 } 67 ContractDTO updatedContract = contractService.changeContractStatus(id, status, cancellationReason); 68 return ResponseEntity.ok(updatedContract); 56 69 } 57 70 71 58 72 @PostMapping("/delete") 59 73 public ResponseEntity<Void> deleteContract(@RequestParam Long id) throws FunctionalException { 60 74 contractService.deleteContract(id); 61 75 return ResponseEntity.noContent().build(); 62 76 } 77 78 @PostMapping 79 public ResponseEntity<ContractDTO> createContract(@RequestBody ContractDTO contractDTO) throws FunctionalException { 80 System.out.println("Reçu: " + contractDTO); changed this line in version 3 of the diff
200 201 @Override 202 @Transactional 203 public ContractDTO createContract(ContractDTO dto) { 204 Contract contract = contractMapper.toEntity(dto); 205 contract.setDepositAmount(dto.getDepositAmount()); 206 207 Contract saved = contractRepository.save(contract); 208 return contractMapper.toDto(saved); 209 } 210 211 @Override 212 @Transactional 213 public ContractDTO updateDepositAndActivate(Long id, double depositAmount) throws FunctionalException { 214 Contract contract = contractRepository.findById(id) 215 .orElseThrow(() -> new FunctionalException("Contrat non trouvé avec l'ID: " + id)); changed this line in version 3 of the diff
205 contract.setDepositAmount(dto.getDepositAmount()); 206 207 Contract saved = contractRepository.save(contract); 208 return contractMapper.toDto(saved); 209 } 210 211 @Override 212 @Transactional 213 public ContractDTO updateDepositAndActivate(Long id, double depositAmount) throws FunctionalException { 214 Contract contract = contractRepository.findById(id) 215 .orElseThrow(() -> new FunctionalException("Contrat non trouvé avec l'ID: " + id)); 216 217 contract.setDepositAmount(depositAmount); 218 contract.setStatus(ContractStatus.ACTIVE); 219 220 Contract saved = contractRepository.save(contract); changed this line in version 3 of the diff
mentioned in commit 400bd1a9
Veuillez vous inscrire ou vous connecter pour répondre