Skip to content
Extraits de code Groupes Projets
Valider 8c41e619 rédigé par mohammed echahbouni's avatar mohammed echahbouni
Parcourir les fichiers

resolve the comment and remove the unnecessary variable creation

parent a423a705
Branches
1 requête de fusion!5MLC-260/add cancellationReason and creationdate and update contractController
......@@ -55,18 +55,20 @@ public class ContractController {
return ResponseEntity.ok(contracts);
}
@PostMapping(Paths.UPDATE_CONTRACT_STATUS)
public ResponseEntity<ContractDTO> changeContractStatus(
@PathVariable Long id,
@RequestParam ContractStatus status,
@RequestParam(required = false) String cancellationReason
) throws FunctionalException {
if (status == ContractStatus.CANCELED && (cancellationReason == null || cancellationReason.trim().isEmpty())) {
throw new FunctionalException("ERR_CONTRACT_CANCEL_REASON_REQUIRED");
}
@PostMapping(Paths.UPDATE_CONTRACT_STATUS)
public ResponseEntity<ContractDTO> changeContractStatus(
@PathVariable Long id,
@RequestParam ContractStatus status,
@RequestParam(required = false) String cancellationReason) throws FunctionalException {
if (status.equals(ContractStatus.CANCELED) && (cancellationReason == null || cancellationReason.trim().isEmpty())) {
throw new FunctionalException("Le motif de résiliation est requis pour le statut 'Résilié'.");
ContractDTO updatedContract = contractService.changeContractStatus(id, status, cancellationReason);
return ResponseEntity.ok(updatedContract);
}
ContractDTO updatedContract = contractService.changeContractStatus(id, status, cancellationReason);
return ResponseEntity.ok(updatedContract);
}
@PostMapping("/delete")
public ResponseEntity<Void> deleteContract(@RequestParam Long id) throws FunctionalException {
......@@ -81,22 +83,6 @@ public ResponseEntity<ContractDTO> changeContractStatus(
return ResponseEntity.ok(saved);
}
@PostMapping("/update-deposit/{id}")
public ResponseEntity<ContractDTO> updateDepositAndActivate(
@PathVariable Long id,
@RequestParam double depositAmount
) throws FunctionalException {
ContractDTO updatedContract = contractService.updateDepositAndActivate(id, depositAmount);
return ResponseEntity.ok(updatedContract);
}
@PostMapping("/upload-temp-signed")
public ResponseEntity<String> uploadTempSignedContract(@RequestParam("file") MultipartFile file)
throws S3FunctionalException {
String fileUrl = s3FileService.uploadSingleFile(file);
return ResponseEntity.ok(fileUrl);
}
}
0% ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter