Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
5514942
html
JohanHiths Mar 30, 2026
94fc4e6
code rabbit suggestions
JohanHiths Mar 30, 2026
0422f88
More coderabbits suggestions, avoiding style conflicts fragment mismatch
JohanHiths Mar 30, 2026
1d98a12
More coderabbits suggestions, font style mismatch
JohanHiths Mar 30, 2026
5673775
Merge branch 'main' into feature/frontend-structure
JohanHiths Mar 30, 2026
279f8d8
fixed navbar
JohanHiths Mar 31, 2026
dbd0689
Added controllers for viewing home and booking. todo: fix commented o…
JohanHiths Mar 31, 2026
b07d5dd
added error.html, also refactored usercontroller
JohanHiths Mar 31, 2026
7041268
update
JohanHiths Mar 31, 2026
4a97c2c
fixed multiple controllers issue
JohanHiths Mar 31, 2026
70024a8
Added modelattribute to UserController, started with admin.html and p…
JohanHiths Mar 31, 2026
b0573ba
Added contact html/css
JohanHiths Apr 1, 2026
b216e28
Added admin, register, login
JohanHiths Apr 1, 2026
87413af
Merge branch 'refs/heads/main' into backend-repository-service
JohanHiths Apr 1, 2026
7fa5ec9
Moved UserEntity to user, added dtos and UserService
JohanHiths Apr 1, 2026
3ce3d4f
update
JohanHiths Apr 1, 2026
9d8e0af
Exceptions, mapper
JohanHiths Apr 1, 2026
e7b5973
Exceptions, mapper
JohanHiths Apr 2, 2026
dc4fbb4
Frontend
JohanHiths Apr 2, 2026
8f35c66
Merge branch 'main' into feature/frontend
JohanHiths Apr 2, 2026
6687341
Update pom.xml
JohanHiths Apr 2, 2026
c10b8b3
Added fiels to UserEntity
JohanHiths Apr 2, 2026
50efee3
Merge remote-tracking branch 'origin/feature/frontend' into feature/f…
JohanHiths Apr 2, 2026
71c6e02
UserController, UserMapper, UserService
JohanHiths Apr 3, 2026
b4e3731
fixed maven errors
JohanHiths Apr 3, 2026
2be9c9b
fixed maven errors
JohanHiths Apr 3, 2026
9648aca
Added htmx to admin , booking, contact
JohanHiths Apr 4, 2026
3fc58b0
contact-fragments.html
JohanHiths Apr 5, 2026
bfa7ad8
Refactored controllers, added HTMX integration, enhanced Thymeleaf te…
JohanHiths Apr 7, 2026
3c56df8
add DuplicateEmailException, globalexception, UsernotfoundException
JohanHiths Apr 7, 2026
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
138 changes: 94 additions & 44 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,41 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>4.0.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>team4you</groupId>
<artifactId>team4you</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>team4you</name>
<description>team4you</description>
<url/>
<licenses>
<license/>
</licenses>
<developers>
<developer/>
</developers>
<scm>
<connection/>
<developerConnection/>
<tag/>
<url/>
</scm>
<properties>
<java.version>25</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webmvc</artifactId>
</dependency>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>4.0.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>team4you</groupId>
<artifactId>team4you</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>team4you</name>
<description>team4you</description>
<url/>
<licenses>
<license/>
</licenses>
<developers>
<developer/>
</developers>
<scm>
<connection/>
<developerConnection/>
<tag/>
<url/>
</scm>
<properties>
<java.version>25</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webmvc</artifactId>
</dependency>

<dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-docker-compose</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webmvc-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-flyway</artifactId>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-database-postgresql</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
Comment on lines +39 to +66
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
python - <<'PY'
import xml.etree.ElementTree as ET
from collections import Counter

ns = {"m": "http://maven.apache.org/POM/4.0.0"}
root = ET.parse("pom.xml").getroot()

coords = [
    (
        dep.findtext("m:groupId", namespaces=ns),
        dep.findtext("m:artifactId", namespaces=ns),
    )
    for dep in root.findall("./m:dependencies/m:dependency", ns)
]

for (group_id, artifact_id), count in sorted(Counter(coords).items()):
    if count > 1:
        print(f"{group_id}:{artifact_id} declared {count} times")
PY

Repository: ithsjava25/project-backend-team4you

Length of output: 532


🏁 Script executed:

cat -n pom.xml | head -150

Repository: ithsjava25/project-backend-team4you

Length of output: 5505


Deduplicate the copied dependency block.

Lines 39–66 and 75–78 re-declare coordinates that are already present later in the same <dependencies> section (lines 79–114). Remove these duplicate declarations and keep only the new Thymeleaf entries (lines 67–74) in this added block.

🧹 Cleanup diff
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-docker-compose</artifactId>
-            <scope>runtime</scope>
-            <optional>true</optional>
-        </dependency>
-        <dependency>
-            <groupId>org.postgresql</groupId>
-            <artifactId>postgresql</artifactId>
-            <scope>runtime</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-webmvc-test</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-flyway</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.flywaydb</groupId>
-            <artifactId>flyway-database-postgresql</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-data-jpa</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-thymeleaf</artifactId>
         </dependency>
         <dependency>
             <groupId>nz.net.ultraq.thymeleaf</groupId>
             <artifactId>thymeleaf-layout-dialect</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.springframework.security</groupId>
-            <artifactId>spring-security-webauthn</artifactId>
-        </dependency>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pom.xml` around lines 39 - 66, Remove the duplicated dependency declarations
in the added block: delete the entries with artifactId values
spring-boot-docker-compose, postgresql, spring-boot-starter-webmvc-test,
spring-boot-starter-flyway, flyway-database-postgresql, and
spring-boot-starter-data-jpa, leaving only the new Thymeleaf-related dependency
entries in that inserted block; ensure the project retains the canonical single
declarations of those removed artifacts elsewhere in the <dependencies> section
so there are no duplicate coordinates.

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>nz.net.ultraq.thymeleaf</groupId>
<artifactId>thymeleaf-layout-dialect</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-webauthn</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-docker-compose</artifactId>
<scope>runtime</scope>
Expand Down Expand Up @@ -80,15 +121,24 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
</dependencies>
<dependency>
<groupId>io.github.wimdeblauwe</groupId>
<artifactId>htmx-spring-boot</artifactId>
<version>5.0.0</version>
</dependency>

</dependencies>




<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
15 changes: 13 additions & 2 deletions src/main/java/backendlab/team4you/config/SecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.webauthn.management.JdbcPublicKeyCredentialUserEntityRepository;
import org.springframework.security.web.webauthn.management.JdbcUserCredentialRepository;
Expand All @@ -22,8 +23,13 @@ SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
.authorizeHttpRequests(
authorizeHttp -> authorizeHttp
// Public endpoints
.requestMatchers( "/login", "/signup").permitAll()
.anyRequest().authenticated()
.requestMatchers(
"/login",
"/signup",
"/css/**",
"/js/**",
"/images/**"
).permitAll()

// Add elevated permissions

Expand Down Expand Up @@ -59,4 +65,9 @@ public UserDetailsService userDetailsService(){
.accountLocked(true) // Prevent password-based login
.build();
}

@Bean
public BCryptPasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
}
9 changes: 9 additions & 0 deletions src/main/java/backendlab/team4you/contact/ContactFormDTO.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package backendlab.team4you.contact;

public record ContactFormDTO(
String firstName,
String lastName,
String email,
String phone,
String message
) {}
88 changes: 88 additions & 0 deletions src/main/java/backendlab/team4you/contact/ContactMessage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package backendlab.team4you.contact;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;


import java.time.LocalDateTime;



@Entity
@Table(name = "contact_messages")
public class ContactMessage {
@Id
private Long id;

private String firstName;
private String email;

private String phone;
private String lastName;


@Column(columnDefinition = "TEXT")
private String message;

private LocalDateTime submittedAt = LocalDateTime.now();


public ContactMessage() {
}
public ContactMessage(String firstName, String email, String phone, String lastName, String message) {
this.firstName = firstName;
this.email = email;
this.phone = phone;
this.lastName = lastName;
this.message = message;
}

public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public LocalDateTime getSubmittedAt() {
return submittedAt;
}
public void setSubmittedAt(LocalDateTime submittedAt) {
this.submittedAt = submittedAt;

}


public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}

}
10 changes: 10 additions & 0 deletions src/main/java/backendlab/team4you/contact/ContactRepository.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package backendlab.team4you.contact;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface ContactRepository extends JpaRepository<ContactMessage, Long> {


}
70 changes: 70 additions & 0 deletions src/main/java/backendlab/team4you/controller/AdminController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package backendlab.team4you.controller;

import backendlab.team4you.service.LogService;
import backendlab.team4you.user.UserService;
import groovy.util.logging.Slf4j;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;


@Slf4j
@Controller
public class AdminController {

private final LogService logService = new LogService();

private final UserService userService;

public AdminController(UserService userService) {
this.userService = userService;
}

@GetMapping("/admin/logs")
public String logs(Model model) {
List<String> logs = List.of(
"User johndoe loggade in",
"Ny användare registrerad",
"Admin tog bort user #123"
);

model.addAttribute("logs", logs);
return "fragments/admin-logs :: content";
}


@GetMapping("/admin/users")
public String adminLogs(Model model){
List<String> users = List.of(
"User johndoe",
"User janedoe",
"User anna"
);

model.addAttribute("users", users);
return "fragments/admin-users :: content";
}

@PostMapping("/admin/users")
public String deleteUser(@RequestParam String id){
userService.deleteUser(id);
return "";
}

@PostMapping("/admin/logs/delete")
public String deleteLog(@RequestParam String log) {
logService.delete(log);
return "";
}



}

Loading