Skip to content

Commit

Permalink
release: 0.5.4
Browse files Browse the repository at this point in the history
release: deployment configs
release: rm mobile
release: homepage url
release: angular configs
  • Loading branch information
Thống authored and thongdanghoang committed Feb 24, 2025
1 parent 8f89909 commit 81830ef
Show file tree
Hide file tree
Showing 174 changed files with 136 additions and 6,393 deletions.
3 changes: 1 addition & 2 deletions .run/IdentityProvider.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<env name="DB_HOST" value="localhost" />
<env name="DB_NAME" value="sep490_idp" />
<env name="DB_PORT" value="5432" />
<env name="DB_SCHEMA" value="public" />
<env name="FLYWAY_OUTPUT_QUERIES" value="true" />
<env name="HIBERNATE_SQL_LOG_LEVEL" value="DEBUG" />
<env name="HIBERNATE_SQL_PARAM_LOG_LEVEL" value="DEBUG" />
Expand All @@ -28,4 +27,4 @@
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
</component>
4 changes: 2 additions & 2 deletions .run/infrastructure.run.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="infrastructure" type="docker-deploy" factoryName="docker-compose.yml" server-name="Docker">
<configuration default="false" name="infrastructure" type="docker-deploy" factoryName="docker-compose.yml" server-name="Podman">
<deployment type="docker-compose.yml">
<settings>
<option name="envFilePath" value="" />
Expand Down Expand Up @@ -28,4 +28,4 @@
</deployment>
<method v="2" />
</configuration>
</component>
</component>
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration config = new CorsConfiguration();
config.addAllowedHeader("*");
config.addAllowedMethod("*");
config.addAllowedOrigin("http://localhost:4200");
config.addAllowedOrigin("https://greenbuildings.cloud");
config.setAllowCredentials(true);
source.registerCorsConfiguration("/**", config);
return source;
Expand Down
1 change: 1 addition & 0 deletions sep490-enterprise/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ dependencies {
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
testImplementation 'org.testcontainers:postgresql'
testImplementation 'org.testcontainers:kafka'
testImplementation 'io.rest-assured:rest-assured'

// Ops
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import java.util.UUID;

@RestController
@RequestMapping("/api/buildings")
@RequestMapping("/buildings")
@RequiredArgsConstructor
@RolesAllowed({
UserRole.RoleNameConstant.ENTERPRISE_OWNER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.util.*;

@RestController
@RequestMapping("/api/credit-package")
@RequestMapping("/credit-package")
@RequiredArgsConstructor
public class CreditPackageController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/enterprise")
@RequestMapping("/enterprise")
@RequiredArgsConstructor
@RolesAllowed({
UserRole.RoleNameConstant.ENTERPRISE_OWNER
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.UUID;

@RestController
@RequestMapping("/api/payment")
@RequestMapping("/payment")
@RequiredArgsConstructor
public class PaymentController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


@RestController
@RequestMapping("/api/wallet")
@RequestMapping("/wallet")
@RequiredArgsConstructor
public class WalletController {

Expand Down
15 changes: 11 additions & 4 deletions sep490-enterprise/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spring:
issuer-uri: ${ISSUER_URI}
application:
name: enterprise
homepage: http://localhost:4200
homepage: https://greenbuildings.cloud
datasource:
url: jdbc:postgresql://${DB_HOST}:${DB_PORT}/${DB_NAME}?serverTimezone=UTC
username: ${POSTGRES_USER}
Expand All @@ -31,12 +31,15 @@ spring:
query:
fail_on_pagination_over_collection_fetch: true
kafka:
admin:
fail-fast: true
bootstrap-servers: kafka:9092
producer:
bootstrap-servers: localhost:9092
bootstrap-servers: kafka:9092
key-serializer: org.apache.kafka.common.serialization.StringSerializer
value-serializer: org.springframework.kafka.support.serializer.JsonSerializer
consumer:
bootstrap-servers: localhost:9092
bootstrap-servers: kafka:9092
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
value-deserializer: org.springframework.kafka.support.serializer.JsonDeserializer
properties:
Expand All @@ -52,6 +55,7 @@ logging:
root: INFO
org:
springframework:
test: ${SPRING_TEST_LOG_LEVEL:INFO}
security: ${SPRING_SECURITY_LOG_LEVEL:INFO}
web: ${SPRING_WEB_LOG_LEVEL:INFO}
hibernate:
Expand All @@ -66,4 +70,7 @@ payment:
api_key: ${PAYOS_API_KEY:not_a_real_key_to_prevent_null}
checksum_key: ${PAYOS_CHECKSUM_KEY:not_a_real_key_to_prevent_null}
returnPath: /enterprise/payment
cancelPath: /enterprise/payment
cancelPath: /enterprise/payment
server:
servlet:
context-path: /enterprise
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.containers.KafkaContainer;
import org.testcontainers.utility.DockerImageName;

import java.util.Map;
import java.util.function.Supplier;
Expand All @@ -21,10 +23,14 @@
@Testcontainers
public abstract class TestcontainersConfigs {

static PostgreSQLContainer<?> postgres = new PostgreSQLContainer<>("postgres:16.4-alpine");
static GenericContainer<?> idP = new GenericContainer<>("thongdh3401/keycloak:24.0.5");
static final PostgreSQLContainer<?> postgres = new PostgreSQLContainer<>("postgres:16.4-alpine");
static final GenericContainer<?> idP = new GenericContainer<>("thongdh3401/keycloak:24.0.5");
static final KafkaContainer kafka = new KafkaContainer(
DockerImageName.parse("confluentinc/cp-kafka:7.6.1")
);

static {
kafka.start();
postgres.start();
idP.withExposedPorts(8180)
.withCommand("start-dev --http-port 8180")
Expand Down Expand Up @@ -57,6 +63,8 @@ void setUp() {

@DynamicPropertySource
static void configureProperties(DynamicPropertyRegistry registry) {
registry.add("spring.kafka.producer.bootstrap-servers", kafka::getBootstrapServers);
registry.add("spring.kafka.consumer.bootstrap-servers", kafka::getBootstrapServers);
registry.add("spring.datasource.url", postgres::getJdbcUrl);
registry.add("spring.datasource.username", postgres::getUsername);
registry.add("spring.datasource.password", postgres::getPassword);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void getEnterpriseBuildings_withValidToken_returns200() {
.contentType(ContentType.JSON)
.body(new SearchCriteriaDTO<Void>(null, null, null))
.when()
.post("/api/buildings/search")
.post("/enterprise/buildings/search")
.then()
.statusCode(200);
}
Expand All @@ -28,7 +28,7 @@ void getEnterpriseBuildings_withInvalidToken_returns401() {
.contentType(ContentType.JSON)
.body(new SearchCriteriaDTO<Void>(null, null, null))
.when()
.post("/api/buildings/search")
.post("/enterprise/buildings/search")
.then()
.statusCode(401);
}
Expand All @@ -44,7 +44,7 @@ void createBuilding_withValidToken_returns201() {
.contentType(ContentType.JSON)
.body(building)
.when()
.post("/api/buildings")
.post("/enterprise/buildings")
.then()
.statusCode(201);
}
Expand All @@ -56,7 +56,7 @@ void createBuilding_withMissingFields_returns400() {
.contentType(ContentType.JSON)
.body(BuildingDTO.builder().build())
.when()
.post("/api/buildings")
.post("/enterprise/buildings")
.then()
.statusCode(400);
}
Expand All @@ -68,7 +68,7 @@ void createBuilding_withInvalidToken_returns401() {
.contentType(ContentType.JSON)
.body(BuildingDTO.builder().build())
.when()
.post("/api/buildings")
.post("/enterprise/buildings")
.then()
.statusCode(401);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void saveBusinessErrorThrowsDemoException() {
.auth().oauth2(getToken("system.admin@greenbuildings.com", "system.admin"))
.body(body)
.when()
.post("/dev/save-business-error")
.post("/enterprise/dev/save-business-error")
.then()
.log().all()
.statusCode(HttpStatus.EXPECTATION_FAILED.value())
Expand All @@ -34,7 +34,7 @@ void saveTechnicalErrorThrowsTechnicalException() {
.auth().oauth2(getToken("system.admin@greenbuildings.com", "system.admin"))
.body(body)
.when()
.post("/dev/save-technical-error")
.post("/enterprise/dev/save-technical-error")
.then()
.log().all()
.statusCode(500)
Expand Down
Loading

0 comments on commit 81830ef

Please sign in to comment.