Skip to content

Commit

Permalink
chore: backend domains (#475)
Browse files Browse the repository at this point in the history
  • Loading branch information
mghilardelli authored Jan 9, 2025
1 parent b825e08 commit f4f9013
Show file tree
Hide file tree
Showing 78 changed files with 774 additions and 635 deletions.
22 changes: 6 additions & 16 deletions .github/workflows/ci-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,25 @@
# documentation.

name: Backend Java CI with Maven


defaults:
run:
working-directory: backend

on:
push:
paths:
- 'backend/**'
- 'preload/**'
branches: [ "main" ]
pull_request:
paths:
- 'backend/**'
- 'preload/**'
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
directory: ['backend', 'preload']

defaults:
run:
working-directory: ${{ matrix.directory }}

steps:
- uses: actions/checkout@v4
Expand All @@ -48,7 +43,7 @@ jobs:
- name: Create container image
if: github.ref == 'refs/heads/main'
env:
IMAGE_ID: ghcr.io/${{ github.repository }}/${{ matrix.directory }}
IMAGE_ID: ghcr.io/${{ github.repository }}/backend
VERSION: main
run: |
# Convert to lowercase
Expand All @@ -59,8 +54,3 @@ jobs:
-Dspring-boot.build-image.imageName=$IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
- name: Update dependency graph
uses: advanced-security/maven-dependency-submission-action@v4
with:
directory: ${{ matrix.directory }}
5 changes: 0 additions & 5 deletions .github/workflows/ci-sfera-mock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,3 @@ jobs:
-Dspring-boot.build-image.imageName=$IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
- name: Update dependency graph
uses: advanced-security/maven-dependency-submission-action@v4
with:
directory: sfera-mock
22 changes: 22 additions & 0 deletions backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<properties>
<java.version>21</java.version>
<kotlin.version>2.0.21</kotlin.version>
<spring-modulith.version>1.3.0</spring-modulith.version>
</properties>
<dependencies>
<dependency>
Expand Down Expand Up @@ -63,6 +64,10 @@
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.modulith</groupId>
<artifactId>spring-modulith-starter-core</artifactId>
</dependency>

<dependency>
<groupId>org.springdoc</groupId>
Expand Down Expand Up @@ -117,8 +122,25 @@
<artifactId>postgresql</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.modulith</groupId>
<artifactId>spring-modulith-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.modulith</groupId>
<artifactId>spring-modulith-bom</artifactId>
<version>${spring-modulith.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<build>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.sbb.backend.infrastructure.configuration
package ch.sbb.backend.common

import io.swagger.v3.oas.models.Components
import io.swagger.v3.oas.models.OpenAPI
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.sbb.backend.application
package ch.sbb.backend.common

import jakarta.servlet.http.HttpServletRequest
import org.slf4j.Logger
Expand All @@ -7,7 +7,6 @@ import org.slf4j.event.Level
import org.springframework.http.HttpHeaders
import org.springframework.util.StopWatch


class RequestLogger(
private val stopWatch: StopWatch,
private val level: Level
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.sbb.backend.application
package ch.sbb.backend.common

import jakarta.servlet.Filter
import jakarta.servlet.FilterChain
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.sbb.backend.infrastructure.configuration
package ch.sbb.backend.common

import com.nimbusds.jose.proc.SecurityContext
import com.nimbusds.jwt.proc.DefaultJWTProcessor
Expand All @@ -17,7 +17,6 @@ import org.springframework.security.oauth2.server.resource.authentication.JwtAut
import org.springframework.security.oauth2.server.resource.authentication.JwtGrantedAuthoritiesConverter
import org.springframework.security.web.SecurityFilterChain


@Configuration
@EnableWebSecurity
class WebSecurityConfig {
Expand All @@ -33,7 +32,7 @@ class WebSecurityConfig {
@Bean
fun filterChain(http: HttpSecurity): SecurityFilterChain {
http {
authorizeRequests {
authorizeHttpRequests {
authorize("/swagger-ui/**", permitAll)
authorize("/v3/api-docs/**", permitAll)
authorize("/actuator/health/**", permitAll)
Expand Down
22 changes: 0 additions & 22 deletions backend/src/main/kotlin/ch/sbb/backend/domain/logging/LogEntry.kt

This file was deleted.

10 changes: 0 additions & 10 deletions backend/src/main/kotlin/ch/sbb/backend/domain/logging/LogLevel.kt

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ch.sbb.backend.application
package ch.sbb.backend.logging.application

import ch.sbb.backend.domain.tenancy.TenantId
import ch.sbb.backend.logging.domain.TenantId
import org.springframework.security.core.context.SecurityContextHolder
import org.springframework.security.oauth2.jwt.Jwt

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package ch.sbb.backend.application.rest
package ch.sbb.backend.logging.application.rest

import ch.sbb.backend.logging.domain.LogEntry
import ch.sbb.backend.logging.domain.LogLevel
import io.swagger.v3.oas.annotations.media.Schema
import java.time.OffsetDateTime

Expand Down Expand Up @@ -30,4 +32,8 @@ data class LogEntryRequest(
example = "{\"deviceId\": \"abcde123\", \"appVersion\": \"1.2.0\"}"
)
val metadata: Map<String, String>? = emptyMap()
)
) {
fun toLogEntry(): LogEntry {
return LogEntry(time, source, message, LogLevel(level.name), metadata)
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.sbb.backend.application.rest
package ch.sbb.backend.logging.application.rest

enum class LogLevelRequest {
TRACE,
Expand Down
Loading

0 comments on commit f4f9013

Please sign in to comment.