Skip to content

Commit

Permalink
✨ Feat(owner): allow to have no DPE (#885)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattboll authored Oct 21, 2024
1 parent 8bbf3ff commit 1293a48
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ public class LightPropertyModel {
private Integer propertyApartmentSharingCount;
private String ademeNumber;
private ObjectNode ademeApiResult;
private Boolean dpeNotRequired;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
Expand Down Expand Up @@ -46,7 +47,7 @@ public class PropertyController {
private final OwnerMapper ownerMapper;
private final PropertyMapper propertyMapper;

@PutMapping
@PostMapping
public ResponseEntity<PropertyModel> createOrUpdate(HttpServletResponse response, @RequestBody PropertyForm Property) throws HttpResponseException, InterruptedException {
try {
PropertyModel propertyModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,6 @@ public class PropertyForm {

private String ademeNumber;

private Boolean dpeNotRequired;

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ public class PropertyModel {
private String dpeDate;
private String ademeNumber;
private ObjectNode ademeApiResult;
private Boolean dpeNotRequired;
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ public PropertyModel createOrUpdate(PropertyForm propertyForm) throws HttpRespon
mailService.sendEmailValidatedProperty(owner, property);
ownerLogService.saveLog(OwnerLogType.PROPERTY_COMPLETED, owner.getId());
}
if (propertyForm.getDpeNotRequired() != null) {
property.setDpeNotRequired(propertyForm.getDpeNotRequired());
}
property.setOwner(owner);
return propertyMapper.toPropertyModel(propertyRepository.save(property));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ public class Property implements Serializable {
@Nullable
private Date dpeDate;

@Column
private Boolean dpeNotRequired;

@Override
public String toString() {
return this.name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
<include file="db/migration/202409250000-create-application-log.xml"/>
<include file="db/migration/202409300000-update-userapi.xml"/>
<include file="db/migration/202410070000-update-jsonprofile-owner_log.xml"/>
<include file="db/migration/202410181600-add-column-dpe-not-required.xml"/>


</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.10.xsd">
<changeSet id="202410181600" author="Matthieu">
<addColumn tableName="property">
<column name="dpe_not_required" type="BOOL" defaultValue="false"/>
</addColumn>
</changeSet>
</databaseChangeLog>

0 comments on commit 1293a48

Please sign in to comment.