Skip to content

Commit ee8a02c

Browse files
committed
feat: add homepage and improve entity FK handling
- Add HomeController with beautiful HTML landing page - Add /health endpoint for quick health checks - Allow root path (/) and /health without authentication - Fix entity @PrePersist to sync FK fields from relations - Remove TeamMember->Role relation (use roleId as team role string) - Fix TeamMemberRepository query to use roleId directly
1 parent 6ffbc8a commit ee8a02c

File tree

13 files changed

+407
-12
lines changed

13 files changed

+407
-12
lines changed

src/main/java/com/halolight/config/SecurityConfig.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
3434
.cors(cors -> cors.configurationSource(corsConfigurationSource))
3535
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
3636
.authorizeHttpRequests(auth -> auth
37+
.requestMatchers("/", "/health").permitAll()
3738
.requestMatchers("/api/auth/**").permitAll()
3839
.requestMatchers("/api/health").permitAll()
3940
.requestMatchers("/docs/**", "/swagger-ui/**", "/v3/api-docs/**", "/swagger-ui.html").permitAll()

src/main/java/com/halolight/controller/HomeController.java

Lines changed: 359 additions & 0 deletions
Large diffs are not rendered by default.

src/main/java/com/halolight/domain/entity/ActivityLog.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,8 @@ public void prePersist() {
6161
if (this.id == null) {
6262
this.id = java.util.UUID.randomUUID().toString().replace("-", "").substring(0, 25);
6363
}
64+
if (this.userId == null && this.user != null) {
65+
this.userId = this.user.getId();
66+
}
6467
}
6568
}

src/main/java/com/halolight/domain/entity/CalendarEvent.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,5 +87,11 @@ public void prePersist() {
8787
if (this.id == null) {
8888
this.id = java.util.UUID.randomUUID().toString().replace("-", "").substring(0, 25);
8989
}
90+
if (this.organizerId == null && this.organizer != null) {
91+
this.organizerId = this.organizer.getId();
92+
}
93+
if (this.teamId == null && this.team != null) {
94+
this.teamId = this.team.getId();
95+
}
9096
}
9197
}

src/main/java/com/halolight/domain/entity/Document.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,11 @@ public void prePersist() {
8585
if (this.id == null) {
8686
this.id = java.util.UUID.randomUUID().toString().replace("-", "").substring(0, 25);
8787
}
88+
if (this.ownerId == null && this.owner != null) {
89+
this.ownerId = this.owner.getId();
90+
}
91+
if (this.teamId == null && this.team != null) {
92+
this.teamId = this.team.getId();
93+
}
8894
}
8995
}

src/main/java/com/halolight/domain/entity/Folder.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,14 @@ public void prePersist() {
7575
if (this.id == null) {
7676
this.id = java.util.UUID.randomUUID().toString().replace("-", "").substring(0, 25);
7777
}
78+
if (this.ownerId == null && this.owner != null) {
79+
this.ownerId = this.owner.getId();
80+
}
81+
if (this.parentId == null && this.parent != null) {
82+
this.parentId = this.parent.getId();
83+
}
84+
if (this.teamId == null && this.team != null) {
85+
this.teamId = this.team.getId();
86+
}
7887
}
7988
}

src/main/java/com/halolight/domain/entity/Notification.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,8 @@ public void prePersist() {
6262
if (this.id == null) {
6363
this.id = java.util.UUID.randomUUID().toString().replace("-", "").substring(0, 25);
6464
}
65+
if (this.userId == null && this.user != null) {
66+
this.userId = this.user.getId();
67+
}
6568
}
6669
}

src/main/java/com/halolight/domain/entity/Role.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ public class Role {
5050
@Builder.Default
5151
private Set<UserRole> users = new LinkedHashSet<>();
5252

53-
@OneToMany(mappedBy = "role")
54-
@Builder.Default
55-
private Set<TeamMember> teamMembers = new LinkedHashSet<>();
56-
5753
@PrePersist
5854
public void prePersist() {
5955
if (this.id == null) {

src/main/java/com/halolight/domain/entity/StorageFile.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,14 @@ public void prePersist() {
7676
if (this.id == null) {
7777
this.id = java.util.UUID.randomUUID().toString().replace("-", "").substring(0, 25);
7878
}
79+
if (this.ownerId == null && this.owner != null) {
80+
this.ownerId = this.owner.getId();
81+
}
82+
if (this.folderId == null && this.folder != null) {
83+
this.folderId = this.folder.getId();
84+
}
85+
if (this.teamId == null && this.team != null) {
86+
this.teamId = this.team.getId();
87+
}
7988
}
8089
}

src/main/java/com/halolight/domain/entity/Team.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,8 @@ public void prePersist() {
7373
if (this.id == null) {
7474
this.id = java.util.UUID.randomUUID().toString().replace("-", "").substring(0, 25);
7575
}
76+
if (this.ownerId == null && this.owner != null) {
77+
this.ownerId = this.owner.getId();
78+
}
7679
}
7780
}

0 commit comments

Comments
 (0)