diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 1d9daf17..6392f2fe 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/devcontainers/java:0-17 +FROM mcr.microsoft.com/devcontainers/java:17 RUN su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install gradle " diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 21d4f154..8442c4ac 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -14,14 +14,24 @@ // Use 'forwardPorts' to make a list of ports inside the container available locally. // This can be used to network with other containers or with the host. "forwardPorts": [ - 1080, - 80, - 8082 + 1080, // Mailcatcher + 5432, // PostgreSQL + 8080, // Events + 8082 // Adminer ], // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "gradle bootRun", + // "postCreateCommand": "gradle bootRun", // Configure tool-specific properties. // "customizations": {}, // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. - "remoteUser": "root" + "remoteUser": "root", + "customizations": { + "vscode": { + "extensions": [ + "vmware.vscode-boot-dev-pack", + "vscjava.vscode-gradle", + "vscjava.vscode-java-pack" + ] + } + } } \ No newline at end of file diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 1e479343..ca18713e 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -26,7 +26,7 @@ services: - mailcatcher postgres: - image: postgres:latest + image: docker.io/library/postgres:latest restart: unless-stopped volumes: - postgres-data:/var/lib/postgresql/data @@ -36,7 +36,7 @@ services: POSTGRES_HOST_AUTH_METHOD: trust adminer: - image: adminer + image: docker.io/library/adminer:latest restart: always depends_on: - postgres @@ -44,6 +44,6 @@ services: - "8082:8080" mailcatcher: - image: schickling/mailcatcher + image: docker.io/schickling/mailcatcher:latest restart: on-failure network_mode: service:postgres diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 6c374a5e..f4e6e787 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -10,10 +10,15 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 + - name: Setup JDK + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@v3 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 diff --git a/build.gradle b/build.gradle index c72e6dc5..22ba892c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ buildscript { ext { - springBootVersion = '2.7.18' + springBootVersion = '3.2.5' } repositories { mavenCentral() @@ -56,16 +56,11 @@ dependencies { //TEMP APPLICATION PROPERTIES HELPER runtimeOnly 'org.springframework.boot:spring-boot-properties-migrator' - - implementation 'javax.el:javax.el-api:2.2.5' implementation "be.woutschoovaerts:mollie:3.6.1" - - implementation 'org.thymeleaf:thymeleaf-spring5' - implementation 'org.thymeleaf:thymeleaf' - implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5' - implementation 'org.thymeleaf.extras:thymeleaf-extras-java8time' - + implementation 'org.thymeleaf:thymeleaf-spring6' + implementation 'org.thymeleaf:thymeleaf' + implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6' implementation 'com.google.guava:guava:32.0.0-jre' implementation 'org.hibernate.validator:hibernate-validator' diff --git a/config/application-devcontainer.yml b/config/application-devcontainer.yml index a0dca394..a21987c8 100644 --- a/config/application-devcontainer.yml +++ b/config/application-devcontainer.yml @@ -76,7 +76,7 @@ logging.level.web: DEBUG # Serve connect server: - port: 80 + port: 8080 servlet.context-path: / # CH Connect Configuration diff --git a/src/main/java/ch/wisv/events/ChConnectConfiguration.java b/src/main/java/ch/wisv/events/ChConnectConfiguration.java index eb146c0f..56d1f8c4 100644 --- a/src/main/java/ch/wisv/events/ChConnectConfiguration.java +++ b/src/main/java/ch/wisv/events/ChConnectConfiguration.java @@ -9,10 +9,10 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; -import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import org.springframework.security.config.Customizer; +import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.oauth2.client.oidc.userinfo.OidcUserRequest; import org.springframework.security.oauth2.client.oidc.userinfo.OidcUserService; @@ -20,6 +20,7 @@ import org.springframework.security.oauth2.core.oidc.OidcIdToken; import org.springframework.security.oauth2.core.oidc.user.DefaultOidcUser; import org.springframework.security.oauth2.core.oidc.user.OidcUser; +import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.csrf.CookieCsrfTokenRepository; import org.springframework.validation.annotation.Validated; import org.springframework.web.cors.CorsConfigurationSource; @@ -32,11 +33,11 @@ */ @Configuration @EnableWebSecurity -@EnableGlobalMethodSecurity(prePostEnabled = true) +@EnableMethodSecurity(prePostEnabled = true) @ConfigurationProperties(prefix = "wisvch.connect") @Validated @Profile("!test") -public class ChConnectConfiguration extends WebSecurityConfigurerAdapter { +public class ChConnectConfiguration { /** * Groups that are admin in the system. @@ -64,24 +65,29 @@ public class ChConnectConfiguration extends WebSecurityConfigurerAdapter { * @param http * @throws Exception */ - public void configure(HttpSecurity http) throws Exception { + @Bean + public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { http - .cors() - .and() - .csrf() - .and().authorizeRequests() - .antMatchers("/administrator/**").hasRole("ADMIN") - .antMatchers("/", "/management/health").permitAll() + .cors(Customizer.withDefaults()) + .csrf(Customizer.withDefaults()) + .authorizeHttpRequests((authorize) -> authorize + .requestMatchers("/administrator/**").hasRole("ADMIN") + .requestMatchers("/", "/management/health").permitAll() .anyRequest().permitAll() - .and() - .logout() + ) + .logout(logout -> logout .logoutSuccessUrl("/") - .and() - .csrf() + ) + .csrf(csrf -> csrf .csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse()) - .ignoringAntMatchers("/api/v1/**") - .and() - .oauth2Login().userInfoEndpoint().oidcUserService(oidcUserService()); + .ignoringRequestMatchers("/api/v1/**") + ) + .oauth2Login(oauth -> oauth + .userInfoEndpoint(userInfo -> userInfo + .oidcUserService(oidcUserService()) + ) + ); + return http.build(); } /** diff --git a/src/main/java/ch/wisv/events/EventsApplication.java b/src/main/java/ch/wisv/events/EventsApplication.java index 58db039e..346d92d1 100644 --- a/src/main/java/ch/wisv/events/EventsApplication.java +++ b/src/main/java/ch/wisv/events/EventsApplication.java @@ -3,10 +3,8 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.domain.EntityScan; -import org.springframework.context.annotation.Bean; import org.springframework.data.jpa.convert.threeten.Jsr310JpaConverters; import org.springframework.scheduling.annotation.EnableScheduling; -import org.thymeleaf.extras.java8time.dialect.Java8TimeDialect; /** * EventsApplication class. @@ -25,15 +23,4 @@ public class EventsApplication { public static void main(String[] args) { SpringApplication.run(EventsApplication.class, args); } - - /** - * Enables Time formating in thymeleaf. - * - * @return Java8TimeDialect - */ - @Bean - public Java8TimeDialect java8TimeDialect() { - return new Java8TimeDialect(); - } - } diff --git a/src/main/java/ch/wisv/events/WebConfiguration.java b/src/main/java/ch/wisv/events/WebConfiguration.java new file mode 100644 index 00000000..2a3ea9af --- /dev/null +++ b/src/main/java/ch/wisv/events/WebConfiguration.java @@ -0,0 +1,15 @@ +package ch.wisv.events; + +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.PathMatchConfigurer; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +public class WebConfiguration implements WebMvcConfigurer { + + @Override + public void configurePathMatch(PathMatchConfigurer configurer) { + configurer.setUseTrailingSlashMatch(true); + } + +} \ No newline at end of file diff --git a/src/main/java/ch/wisv/events/admin/controller/DashboardIndexController.java b/src/main/java/ch/wisv/events/admin/controller/DashboardIndexController.java index c27e0497..c5a239a6 100644 --- a/src/main/java/ch/wisv/events/admin/controller/DashboardIndexController.java +++ b/src/main/java/ch/wisv/events/admin/controller/DashboardIndexController.java @@ -5,7 +5,6 @@ import ch.wisv.events.core.repository.EventRepository; import ch.wisv.events.core.service.customer.CustomerService; import ch.wisv.events.core.service.event.EventService; -import ch.wisv.events.core.service.ticket.TicketService; import java.time.LocalDateTime; import java.util.HashMap; import java.util.List; diff --git a/src/main/java/ch/wisv/events/api/controller/OrderRestController.java b/src/main/java/ch/wisv/events/api/controller/OrderRestController.java index 4bca7733..79da0311 100644 --- a/src/main/java/ch/wisv/events/api/controller/OrderRestController.java +++ b/src/main/java/ch/wisv/events/api/controller/OrderRestController.java @@ -1,8 +1,6 @@ package ch.wisv.events.api.controller; -import ch.wisv.events.core.service.order.OrderService; import ch.wisv.events.webshop.service.PaymentsService; -import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; @@ -10,7 +8,6 @@ /** * OrderRestController class. */ -@Slf4j @RestController @RequestMapping("/api/v1/orders") public class OrderRestController { diff --git a/src/main/java/ch/wisv/events/api/request/ProductDto.java b/src/main/java/ch/wisv/events/api/request/ProductDto.java index 480331d5..69f02910 100644 --- a/src/main/java/ch/wisv/events/api/request/ProductDto.java +++ b/src/main/java/ch/wisv/events/api/request/ProductDto.java @@ -1,6 +1,6 @@ package ch.wisv.events.api.request; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotNull; import ch.wisv.events.core.util.VatRate; import lombok.Getter; diff --git a/src/main/java/ch/wisv/events/core/model/customer/Customer.java b/src/main/java/ch/wisv/events/core/model/customer/Customer.java index 2521e0a0..3bfd0ecd 100644 --- a/src/main/java/ch/wisv/events/core/model/customer/Customer.java +++ b/src/main/java/ch/wisv/events/core/model/customer/Customer.java @@ -5,16 +5,15 @@ import java.util.ArrayList; import java.util.List; import java.util.UUID; -import javax.persistence.Column; -import javax.persistence.ElementCollection; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; +import jakarta.persistence.Column; +import jakarta.persistence.ElementCollection; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.Id; import lombok.AccessLevel; import lombok.Data; import lombok.Getter; import lombok.Setter; -import org.springframework.beans.factory.annotation.Value; /** * Customer object. diff --git a/src/main/java/ch/wisv/events/core/model/document/Document.java b/src/main/java/ch/wisv/events/core/model/document/Document.java index fa24a0aa..6baa8960 100644 --- a/src/main/java/ch/wisv/events/core/model/document/Document.java +++ b/src/main/java/ch/wisv/events/core/model/document/Document.java @@ -1,8 +1,8 @@ package ch.wisv.events.core.model.document; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.Id; import lombok.Data; /** diff --git a/src/main/java/ch/wisv/events/core/model/event/Event.java b/src/main/java/ch/wisv/events/core/model/event/Event.java index b9df4761..41e6d7e7 100644 --- a/src/main/java/ch/wisv/events/core/model/event/Event.java +++ b/src/main/java/ch/wisv/events/core/model/event/Event.java @@ -6,22 +6,22 @@ import java.util.ArrayList; import java.util.List; import java.util.UUID; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.ElementCollection; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.OneToMany; -import javax.persistence.OrderBy; -import javax.validation.constraints.NotNull; +import jakarta.persistence.CascadeType; +import jakarta.persistence.Column; +import jakarta.persistence.ElementCollection; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.Id; +import jakarta.persistence.OneToMany; +import jakarta.persistence.OrderBy; +import jakarta.validation.constraints.NotNull; import lombok.AccessLevel; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.Setter; -import javax.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotEmpty; import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat.ISO; diff --git a/src/main/java/ch/wisv/events/core/model/order/Order.java b/src/main/java/ch/wisv/events/core/model/order/Order.java index 2126284b..a56a1c62 100644 --- a/src/main/java/ch/wisv/events/core/model/order/Order.java +++ b/src/main/java/ch/wisv/events/core/model/order/Order.java @@ -6,16 +6,16 @@ import java.util.HashMap; import java.util.List; import java.util.UUID; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.ManyToMany; -import javax.persistence.ManyToOne; -import javax.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.Id; +import jakarta.persistence.ManyToMany; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotNull; import ch.wisv.events.core.util.VatRate; import lombok.AccessLevel; @@ -23,6 +23,7 @@ import lombok.Getter; import lombok.Setter; import org.springframework.format.annotation.DateTimeFormat; + import static org.springframework.format.annotation.DateTimeFormat.ISO; @Entity @@ -51,7 +52,7 @@ public class Order { * Field customer customer that order this. */ @ManyToOne - @NotNull + // @NotNull private Customer owner; /** @@ -120,6 +121,8 @@ public Order() { this.createdAt = LocalDateTime.now(); this.status = OrderStatus.ANONYMOUS; this.orderProducts = new ArrayList<>(); + this.createdBy = "ANONYMOUS"; + this.amount = 0d; } /** diff --git a/src/main/java/ch/wisv/events/core/model/order/OrderProduct.java b/src/main/java/ch/wisv/events/core/model/order/OrderProduct.java index 3eb6f30b..a88a84b3 100644 --- a/src/main/java/ch/wisv/events/core/model/order/OrderProduct.java +++ b/src/main/java/ch/wisv/events/core/model/order/OrderProduct.java @@ -2,8 +2,8 @@ import ch.wisv.events.core.model.product.Product; -import javax.persistence.*; -import javax.validation.constraints.NotNull; +import jakarta.persistence.*; +import jakarta.validation.constraints.NotNull; import ch.wisv.events.core.util.VatRate; import lombok.AccessLevel; diff --git a/src/main/java/ch/wisv/events/core/model/product/Product.java b/src/main/java/ch/wisv/events/core/model/product/Product.java index dc95d8ee..65782ac9 100644 --- a/src/main/java/ch/wisv/events/core/model/product/Product.java +++ b/src/main/java/ch/wisv/events/core/model/product/Product.java @@ -6,7 +6,7 @@ import java.util.ArrayList; import java.util.List; import java.util.UUID; -import javax.persistence.*; +import jakarta.persistence.*; import ch.wisv.events.core.model.event.Event; import ch.wisv.events.core.util.VatRate; diff --git a/src/main/java/ch/wisv/events/core/model/ticket/Ticket.java b/src/main/java/ch/wisv/events/core/model/ticket/Ticket.java index e76f9fa5..69ce0643 100644 --- a/src/main/java/ch/wisv/events/core/model/ticket/Ticket.java +++ b/src/main/java/ch/wisv/events/core/model/ticket/Ticket.java @@ -8,11 +8,11 @@ import java.time.LocalDateTime; import java.util.UUID; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.validation.constraints.NotNull; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.Id; +import jakarta.persistence.ManyToOne; +import jakarta.validation.constraints.NotNull; import lombok.AccessLevel; import lombok.Data; @@ -39,7 +39,7 @@ public class Ticket { /** * Customer which owns the Ticket. */ - @ManyToOne(cascade = {javax.persistence.CascadeType.ALL}) + @ManyToOne(cascade = {jakarta.persistence.CascadeType.ALL}) public Order order; /** diff --git a/src/main/java/ch/wisv/events/core/model/webhook/Webhook.java b/src/main/java/ch/wisv/events/core/model/webhook/Webhook.java index 97d3897a..40278ac0 100644 --- a/src/main/java/ch/wisv/events/core/model/webhook/Webhook.java +++ b/src/main/java/ch/wisv/events/core/model/webhook/Webhook.java @@ -3,10 +3,10 @@ import java.util.ArrayList; import java.util.List; import java.util.UUID; -import javax.persistence.ElementCollection; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; +import jakarta.persistence.ElementCollection; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.Id; import lombok.Data; @Entity diff --git a/src/main/java/ch/wisv/events/core/model/webhook/WebhookTask.java b/src/main/java/ch/wisv/events/core/model/webhook/WebhookTask.java index a22a5bd7..5fc89edb 100644 --- a/src/main/java/ch/wisv/events/core/model/webhook/WebhookTask.java +++ b/src/main/java/ch/wisv/events/core/model/webhook/WebhookTask.java @@ -1,11 +1,11 @@ package ch.wisv.events.core.model.webhook; import java.time.LocalDateTime; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.ManyToOne; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.Id; +import jakarta.persistence.ManyToOne; import lombok.Data; import org.json.simple.JSONObject; diff --git a/src/main/java/ch/wisv/events/core/service/customer/CustomerServiceImpl.java b/src/main/java/ch/wisv/events/core/service/customer/CustomerServiceImpl.java index 0649b0fc..5a8b2d46 100644 --- a/src/main/java/ch/wisv/events/core/service/customer/CustomerServiceImpl.java +++ b/src/main/java/ch/wisv/events/core/service/customer/CustomerServiceImpl.java @@ -176,16 +176,16 @@ public Customer createByOidcUser(OidcUser userInfo) throws CustomerInvalidExcept */ @Override public void update(Customer customer) throws CustomerInvalidException, CustomerNotFoundException { + this.assertIsValidCustomer(customer); + Customer model = this.getByKey(customer.getKey()); - + model.setName(customer.getName()); model.setEmail(customer.getEmail()); model.setRfidToken(customer.getRfidToken()); model.setLdapGroups(customer.getLdapGroups()); model.setVerifiedChMember(customer.isVerifiedChMember()); - this.assertIsValidCustomer(model); - customerRepository.save(model); } diff --git a/src/main/java/ch/wisv/events/core/service/event/EventServiceImpl.java b/src/main/java/ch/wisv/events/core/service/event/EventServiceImpl.java index 6b36acc8..7027ba5f 100644 --- a/src/main/java/ch/wisv/events/core/service/event/EventServiceImpl.java +++ b/src/main/java/ch/wisv/events/core/service/event/EventServiceImpl.java @@ -163,6 +163,8 @@ public void create(Event event) throws EventInvalidException { */ @Override public void update(Event event) throws EventNotFoundException, EventInvalidException { + this.assertIsValidEvent(event); + Event update = this.getByKey(event.getKey()); this.updateLinkedProducts(event, update.getProducts(), false); @@ -184,7 +186,6 @@ public void update(Event event) throws EventNotFoundException, EventInvalidExcep update.setImageUrl(event.getImageUrl()); } - this.assertIsValidEvent(event); this.updateLinkedProducts(event, update.getProducts(), true); eventRepository.save(update); } diff --git a/src/main/java/ch/wisv/events/core/service/mail/MailServiceImpl.java b/src/main/java/ch/wisv/events/core/service/mail/MailServiceImpl.java index 65d20e39..68d79fea 100644 --- a/src/main/java/ch/wisv/events/core/service/mail/MailServiceImpl.java +++ b/src/main/java/ch/wisv/events/core/service/mail/MailServiceImpl.java @@ -11,9 +11,9 @@ import java.net.URL; import java.util.List; import java.util.Locale; -import javax.mail.MessagingException; -import javax.mail.internet.MimeMessage; -import javax.validation.constraints.NotNull; +import jakarta.mail.MessagingException; +import jakarta.mail.internet.MimeMessage; +import jakarta.validation.constraints.NotNull; import ch.wisv.events.core.service.ticket.TicketService; import ch.wisv.events.core.util.QrCode; @@ -29,8 +29,7 @@ import org.springframework.mail.javamail.MimeMessageHelper; import org.springframework.stereotype.Service; import org.thymeleaf.context.Context; -import org.thymeleaf.spring5.SpringTemplateEngine; - +import org.thymeleaf.spring6.SpringTemplateEngine; /** * MailService implementation. */ diff --git a/src/main/java/ch/wisv/events/core/service/product/ProductServiceImpl.java b/src/main/java/ch/wisv/events/core/service/product/ProductServiceImpl.java index 4f5fc526..e0a2fbb9 100644 --- a/src/main/java/ch/wisv/events/core/service/product/ProductServiceImpl.java +++ b/src/main/java/ch/wisv/events/core/service/product/ProductServiceImpl.java @@ -108,6 +108,8 @@ public Product create(ProductDto productDto) throws ProductInvalidException { */ @Override public void update(Product product) throws ProductNotFoundException, ProductInvalidException { + this.assertIsValidProduct(product); + Product model = this.getByKey(product.getKey()); this.updateLinkedProducts(product, model.getProducts(), false); @@ -128,7 +130,6 @@ public void update(Product product) throws ProductNotFoundException, ProductInva model.setSold(product.getSold()); } - this.assertIsValidProduct(product); this.updateLinkedProducts(product, model.getProducts(), true); productRepository.save(model); } diff --git a/src/main/java/ch/wisv/events/core/service/ticket/TicketServiceImpl.java b/src/main/java/ch/wisv/events/core/service/ticket/TicketServiceImpl.java index 14bd68f8..4a50c351 100644 --- a/src/main/java/ch/wisv/events/core/service/ticket/TicketServiceImpl.java +++ b/src/main/java/ch/wisv/events/core/service/ticket/TicketServiceImpl.java @@ -24,7 +24,7 @@ import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotNull; /** * TicketServiceImpl class. diff --git a/src/main/java/ch/wisv/events/webshop/controller/WebshopIndexController.java b/src/main/java/ch/wisv/events/webshop/controller/WebshopIndexController.java index e7702ddd..a6c94c3d 100644 --- a/src/main/java/ch/wisv/events/webshop/controller/WebshopIndexController.java +++ b/src/main/java/ch/wisv/events/webshop/controller/WebshopIndexController.java @@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotNull; /** * WebshopIndexController class. diff --git a/src/main/java/ch/wisv/events/webshop/controller/WebshopTicketController.java b/src/main/java/ch/wisv/events/webshop/controller/WebshopTicketController.java index 39913a96..3e4d05cd 100644 --- a/src/main/java/ch/wisv/events/webshop/controller/WebshopTicketController.java +++ b/src/main/java/ch/wisv/events/webshop/controller/WebshopTicketController.java @@ -19,7 +19,7 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.mvc.support.RedirectAttributes; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import java.awt.image.BufferedImage; import java.io.IOException; diff --git a/src/main/java/ch/wisv/events/webshop/service/PaymentsServiceImpl.java b/src/main/java/ch/wisv/events/webshop/service/PaymentsServiceImpl.java index 63bb17cf..8ab5e02d 100644 --- a/src/main/java/ch/wisv/events/webshop/service/PaymentsServiceImpl.java +++ b/src/main/java/ch/wisv/events/webshop/service/PaymentsServiceImpl.java @@ -15,7 +15,7 @@ import ch.wisv.events.core.service.mail.MailService; import ch.wisv.events.core.service.order.OrderService; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; diff --git a/src/main/resources/dev/data/orders.json b/src/main/resources/dev/data/orders.json index 33895536..8918fced 100644 --- a/src/main/resources/dev/data/orders.json +++ b/src/main/resources/dev/data/orders.json @@ -2,36 +2,50 @@ { "orderStatus" : "PAID", "paymentMethod" : "IDEAL", - "customerRfid" : "3061a041" + "customerRfid" : "3061a041", + "owner" : 1, + "createdBy" : "Sven Popping" }, { "orderStatus" : "PAID", "paymentMethod" : "IDEAL", - "customerRfid" : "3061a041" + "customerRfid" : "3061a041", + "owner" : 1, + "createdBy" : "Sven Popping" }, { "orderStatus" : "PAID", "paymentMethod" : "IDEAL", - "customerRfid" : "3061a041" + "customerRfid" : "3061a041", + "owner" : 1, + "createdBy" : "Sven Popping" }, { "orderStatus" : "PAID", "paymentMethod" : "IDEAL", - "customerRfid" : "3061a041" + "customerRfid" : "3061a041", + "owner" : 1, + "createdBy" : "Sven Popping" }, { "orderStatus" : "PAID", "paymentMethod" : "IDEAL", - "customerRfid" : "3061a041" + "customerRfid" : "3061a041", + "owner" : 1, + "createdBy" : "Sven Popping" }, { "orderStatus" : "PAID", "paymentMethod" : "IDEAL", - "customerRfid" : "3061a041" + "customerRfid" : "3061a041", + "owner" : 1, + "createdBy" : "Sven Popping" }, { "orderStatus" : "PAID", "paymentMethod" : "IDEAL", - "customerRfid" : "3061a041" + "customerRfid" : "3061a041", + "owner" : 1, + "createdBy" : "Sven Popping" } ] \ No newline at end of file diff --git a/src/main/resources/templates/admin/customers/customer.html b/src/main/resources/templates/admin/customers/customer.html index 9b435b1c..3ce1aeb5 100644 --- a/src/main/resources/templates/admin/customers/customer.html +++ b/src/main/resources/templates/admin/customers/customer.html @@ -32,17 +32,17 @@
- +