-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: integration BuildingControllerTest bugfix: fix PR feat: setup idp testcontainer feat: create building resource
- Loading branch information
1 parent
a63d02b
commit c44bad6
Showing
31 changed files
with
2,409 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 10 additions & 1 deletion
11
sep490-enterprise/src/main/java/enterprise/dtos/BuildingDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,20 @@ | ||
package enterprise.dtos; | ||
|
||
import green_buildings.commons.api.BaseDTO; | ||
import jakarta.validation.constraints.DecimalMin; | ||
import jakarta.validation.constraints.Min; | ||
import jakarta.validation.constraints.NotBlank; | ||
import lombok.Builder; | ||
|
||
import java.math.BigDecimal; | ||
import java.util.UUID; | ||
|
||
@Builder | ||
public record BuildingDTO( | ||
UUID id, | ||
int version | ||
int version, | ||
@NotBlank String name, | ||
@Min(1) int floors, | ||
@DecimalMin(value = "0.0", inclusive = true) BigDecimal squareMeters | ||
) implements BaseDTO { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
sep490-enterprise/src/main/java/enterprise/mappers/BuildingMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package enterprise.mappers; | ||
|
||
import enterprise.dtos.BuildingDTO; | ||
import enterprise.entities.BuildingEntity; | ||
import org.mapstruct.BeanMapping; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.MappingConstants; | ||
import org.mapstruct.MappingTarget; | ||
import org.mapstruct.NullValuePropertyMappingStrategy; | ||
import org.mapstruct.ReportingPolicy; | ||
|
||
@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE, componentModel = MappingConstants.ComponentModel.SPRING) | ||
public interface BuildingMapper { | ||
BuildingEntity toEntity(BuildingDTO buildingDTO); | ||
|
||
BuildingDTO toDto(BuildingEntity buildingEntity); | ||
|
||
@BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE) | ||
BuildingEntity partialUpdate(BuildingDTO buildingDTO, @MappingTarget | ||
BuildingEntity buildingEntity); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
sep490-enterprise/src/main/java/enterprise/services/BuildingService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package enterprise.services; | ||
|
||
import enterprise.entities.BuildingEntity; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
|
||
import java.util.UUID; | ||
|
||
public interface BuildingService { | ||
|
||
BuildingEntity createBuilding(BuildingEntity building); | ||
|
||
Page<BuildingEntity> getEnterpriseBuildings(UUID enterpriseId, Pageable page); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
sep490-enterprise/src/main/java/enterprise/services/impl/BuildingServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package enterprise.services.impl; | ||
|
||
import enterprise.entities.BuildingEntity; | ||
import enterprise.repositories.BuildingRepository; | ||
import enterprise.services.BuildingService; | ||
import jakarta.transaction.Transactional; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.UUID; | ||
|
||
@Service | ||
@Transactional(rollbackOn = Throwable.class) | ||
@RequiredArgsConstructor | ||
public class BuildingServiceImpl implements BuildingService { | ||
|
||
private final BuildingRepository buildingRepository; | ||
|
||
@Override | ||
public BuildingEntity createBuilding(BuildingEntity building) { | ||
return buildingRepository.save(building); | ||
} | ||
|
||
@Override | ||
public Page<BuildingEntity> getEnterpriseBuildings(UUID enterpriseId, Pageable page) { | ||
return buildingRepository.findByEnterpriseId(enterpriseId, page); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
sep490-enterprise/src/main/resources/db/migration/V0.0.1.3__ManageBuildings.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
ALTER TABLE buildings | ||
ADD COLUMN name VARCHAR(255) NOT NULL, | ||
ADD COLUMN floors INTEGER NOT NULL, | ||
ADD COLUMN square_meters NUMERIC(15, 3) NOT NULL; |
11 changes: 0 additions & 11 deletions
11
sep490-enterprise/src/test/java/enterprise/EnterpriseApplication.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.