Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build and Test
on:
push:
branches:
- "main"
pull_request:
branches:
- "main"

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
# Checks out code from GitHub
- name: Checkout code
uses: actions/checkout@v6

# Sets up Java 25 (Temurin) and cache Maven-dependencies
- name: Set up JDK 25
uses: actions/setup-java@v5
with:
java-version: '25'
distribution: 'temurin'
cache: 'maven'

# Make sure Maven Wrapper is executable
- name: Make mvnw executable
run: chmod +x mvnw

# Compile and run tests
- name: Compile and run tests
run: ./mvnw -B test

# Control code format with spotless
- name: Run spotless check
run: ./mvnw -B spotless:check
60 changes: 47 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-flyway</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-flyway</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
Expand All @@ -62,10 +62,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webmvc</artifactId>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-database-postgresql</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.flywaydb</groupId>-->
<!-- <artifactId>flyway-database-postgresql</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity6</artifactId>
Expand Down Expand Up @@ -98,11 +98,11 @@
<artifactId>spring-boot-starter-data-jpa-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-flyway-test</artifactId>
<scope>test</scope>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-flyway-test</artifactId>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security-oauth2-client-test</artifactId>
Expand Down Expand Up @@ -158,10 +158,44 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.44.3</version>
<configuration>
<java>
<removeUnusedImports/>
<formatAnnotations/>
</java>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>
check
</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,14 @@ public class AuditLog {
@Column(name = "audit_id", nullable = false)
private Long id;

@NotNull
@CreatedDate
@NotNull @CreatedDate
private LocalDateTime timeStamp;

@NotNull
private Long userId; // Vem gjorde vad?
@NotNull private Long userId; // Vem gjorde vad?

@NotNull
private Long visaCaseId; // Vilket ärende rör det?
@NotNull private Long visaCaseId; // Vilket ärende rör det?

@NotNull
@Enumerated(EnumType.STRING)
@NotNull @Enumerated(EnumType.STRING)
private AuditEventType auditEventType;

private String description; // Beskrivning av händelse
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import org.example.visacasemanagementsystem.audit.entity.AuditLog;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

@Component
public class AuditMapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ public class Comment {
@JoinColumn(name = "author_id", nullable = false)
private User author;

@NotBlank
@Column(columnDefinition = "TEXT")
@NotBlank @Column(columnDefinition = "TEXT")
private String text;

@CreatedDate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,16 @@ public class User {
@Column(nullable = false, updatable = false)
private Long id;

@NotBlank
@Column(nullable = false)
@NotBlank @Column(nullable = false)
private String fullName;

@NotBlank
@Column(unique = true)
@NotBlank @Column(unique = true)
private String email;

//Placeholder password storage solution
@NotBlank
private String password;
@NotBlank private String password;

@NotNull
@Enumerated(EnumType.STRING)
@NotNull @Enumerated(EnumType.STRING)
private UserAuthorization userAuthorization;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,13 @@ public class Visa {
@Column(name = "visa_id", nullable = false, updatable = false)
private Long id;

@NotNull
@Enumerated(EnumType.STRING)
@NotNull @Enumerated(EnumType.STRING)
private VisaType visaType;

@NotNull
@Enumerated(EnumType.STRING)
@NotNull @Enumerated(EnumType.STRING)
private VisaStatus visaStatus;

@NotBlank
private String nationality;
@NotBlank private String nationality;

@ManyToOne
@JoinColumn(name = "applicant_id", nullable = false)
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ spring.datasource.username=${DB_USER:user}
spring.datasource.password=${DB_PASSWORD:secret}

# application.properties (default/test/prod)
spring.jpa.hibernate.ddl-auto=validate
spring.jpa.hibernate.ddl-auto=update

spring.jpa.show-sql=false
spring.jpa.properties.hibernate.format_sql=false
Expand Down