diff --git a/.github/workflows/ant.yml b/.github/workflows/ant.yml deleted file mode 100644 index 06fc807..0000000 --- a/.github/workflows/ant.yml +++ /dev/null @@ -1,25 +0,0 @@ -# This workflow will build a Java project with Ant -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-ant - -name: Java CI - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Set up JDK 11 - uses: actions/setup-java@v4 - with: - java-version: '11' - distribution: 'temurin' - - name: Build with Ant - run: ant -noinput -buildfile build.xml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8ea9e84 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,26 @@ +name: Java CI + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v5 + with: + java-version: "21" + distribution: "temurin" + cache: "maven" + + - name: Build backend + working-directory: backend + run: ./mvnw clean test diff --git a/backend/.gitignore b/backend/.gitignore index 8252ca8..166c53c 100644 --- a/backend/.gitignore +++ b/backend/.gitignore @@ -33,3 +33,4 @@ build/ ### Environment ### .env +.env diff --git a/backend/src/main/java/com/studentos/dto/StudentProfileResponse.java b/backend/src/main/java/com/studentos/dto/StudentProfileResponse.java index 09c6077..3352929 100644 --- a/backend/src/main/java/com/studentos/dto/StudentProfileResponse.java +++ b/backend/src/main/java/com/studentos/dto/StudentProfileResponse.java @@ -4,7 +4,6 @@ import java.time.Instant; import java.util.List; import java.util.UUID; - public record StudentProfileResponse( UUID id, String college, diff --git a/backend/src/main/java/com/studentos/dto/UserMapper.java b/backend/src/main/java/com/studentos/dto/UserMapper.java index ab675ba..a53d0e5 100644 --- a/backend/src/main/java/com/studentos/dto/UserMapper.java +++ b/backend/src/main/java/com/studentos/dto/UserMapper.java @@ -13,6 +13,7 @@ private UserMapper() { public static UserResponse toResponse(User user) { StudentProfile profile = user.getStudentProfile(); + StudentProfileResponse profileResponse = profile == null ? null : new StudentProfileResponse( profile.getId(), profile.getCollege(), diff --git a/backend/src/main/resources/application.yml b/backend/src/main/resources/application.yml index 7c388de..aa66be2 100644 --- a/backend/src/main/resources/application.yml +++ b/backend/src/main/resources/application.yml @@ -1,5 +1,3 @@ -spring: - application: name: studentos-backend datasource: url: ${DATABASE_URL:jdbc:postgresql://localhost:5432/studentos} @@ -20,12 +18,8 @@ spring: host: ${REDIS_HOST:localhost} port: ${REDIS_PORT:6379} -server: - port: 8080 -app: - jwt: - secret: ${JWT_SECRET:change-me-to-a-long-random-secret-at-least-256-bits} + secret: ${JWT_SECRET:change-me-to-a-long-random-secret-at-least-256-bits} access-expiration-ms: ${JWT_ACCESS_EXPIRATION_MS:900000} refresh-expiration-ms: ${JWT_REFRESH_EXPIRATION_MS:604800000} cors: