Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
207 commits
Select commit Hold shift + click to select a range
2d59436
refactor: split websocket package into lobby/shared and rename GameCo…
tasaje1 May 26, 2026
812d6b9
style: fix imports
tasaje1 May 26, 2026
2c9bcea
refactor: migrate playingfield package into game domain and application
tasaje1 May 26, 2026
15ec64d
refactor: separate game dto models from mapping services
tasaje1 May 26, 2026
c692f35
refactor: move utility enums into feature-owned packages
tasaje1 May 26, 2026
2063659
refactor: align lobby package to api application domain structure
tasaje1 May 26, 2026
ac43e9f
refactor: consolidate game websocket api structure
tasaje1 May 26, 2026
1f71916
refactor: organize chat package into api application and domain
tasaje1 May 26, 2026
578dd01
refactor: split recovery package into application domain and infrastr…
tasaje1 May 26, 2026
7364514
refactor: move jackson config to shared and align clue classes under …
tasaje1 May 27, 2026
c55271a
refactor: move game dto package under game api
tasaje1 May 27, 2026
ae578bd
refactor: standardize game dto class naming
tasaje1 May 27, 2026
4917efa
style: fix imports
tasaje1 May 27, 2026
ec92ed2
style: fix imports
tasaje1 May 27, 2026
e724865
style: remove unused imports
tasaje1 May 27, 2026
60cb7be
refactor: remove unused import
XtophB May 27, 2026
8eddac7
refactor: fix import order
XtophB May 27, 2026
2b545e2
refactor: change import order
XtophB May 27, 2026
a43c0b3
refactor: change import order
XtophB May 27, 2026
f18d9fd
refactor: 100 characters per line
XtophB May 27, 2026
5f360e4
refactor: change import order
XtophB May 27, 2026
32d7aa8
refactor: change import order
XtophB May 27, 2026
8bc71df
refactor: change formatting to original format
XtophB May 27, 2026
9e7478f
Merge pull request #142 from SS26-SE2-Codenames/refactor/backend-cleanup
tasaje1 Jun 1, 2026
dab6749
feat: create lobby table
XtophB Jun 1, 2026
5c744fc
feat: add table for player
XtophB Jun 1, 2026
5220386
feat: add table for game state
XtophB Jun 1, 2026
63f0927
refactor: use BIG instead of normal data types
XtophB Jun 1, 2026
5cb88b2
refactor: update how primary keys are created to modern standards
XtophB Jun 1, 2026
d981b20
feat: add table for cards
XtophB Jun 1, 2026
ec81c0b
feat: add table for chat
XtophB Jun 2, 2026
8d3dde3
refactor: change PK of game_state table
XtophB Jun 2, 2026
844eb81
fix: delete stray comma
XtophB Jun 2, 2026
a3b18d6
refactor: change length of varchar for DB entries
XtophB Jun 2, 2026
4b8a45a
chore: remove chat table, team decision
XtophB Jun 2, 2026
1d6c777
Merge pull request #146 from SS26-SE2-Codenames/feature/145-flyway-mi…
XtophB Jun 2, 2026
fa47584
feat: add player entity class
XtophB Jun 4, 2026
3bddc60
feat: add length limit to player table columns
XtophB Jun 4, 2026
11aef64
feat: add lobby entity class
XtophB Jun 4, 2026
0cb958e
feat: add game state entity class
XtophB Jun 4, 2026
19d48a2
feat: add card entity class
XtophB Jun 4, 2026
d58db42
docs: add javaDocs
XtophB Jun 4, 2026
2b8770e
fix: change types to match DB schema
XtophB Jun 4, 2026
995d94a
refactor: change IDE generated POJO column to proper import
XtophB Jun 4, 2026
243c7a6
fix: remove erroneous copy paste from different file
XtophB Jun 4, 2026
98b70b1
feat: add relational mappings to entity classes
XtophB Jun 4, 2026
12457d4
chore: add lombok config to exclude generated getter setter from test
XtophB Jun 4, 2026
e7b446b
refactor: remove unused imports
XtophB Jun 4, 2026
acae16f
feat: add repository class for lobby
XtophB Jun 5, 2026
34fdee5
feat: add repository class for Player
XtophB Jun 5, 2026
e3b4024
task: added server logs to services
the-only-queen-anna Jun 5, 2026
f52b576
fix: added null check to logs
the-only-queen-anna Jun 5, 2026
193f20d
Merge pull request #148 from SS26-SE2-Codenames/feature/131-create-jp…
XtophB Jun 5, 2026
e9e4f3e
Merge remote-tracking branch 'origin/development' into feature/132-jp…
XtophB Jun 5, 2026
11a93a6
chore: move entity classes into dedicated package
XtophB Jun 5, 2026
a1dd401
fix: change parameter to Long as player table uses BIGINT as the PK
XtophB Jun 5, 2026
699bbb6
feat: add incomplete mapping class to store all entries for DB
XtophB Jun 5, 2026
bcf9dbd
refactor: rename classes -> improve maintainability
XtophB Jun 5, 2026
1c9b55d
Merge branch 'feature/132-jpa-repositories' into feature/133-persiste…
XtophB Jun 5, 2026
159c557
fix: update imports after merge and incorrect parameters
XtophB Jun 5, 2026
e4297da
fix: rename method to match entity class
XtophB Jun 6, 2026
6053b7b
feat: add mapping for gameState table
XtophB Jun 6, 2026
9bc04a0
feat: add mapping for card table
XtophB Jun 6, 2026
f55f613
feat: add player table mapping
XtophB Jun 6, 2026
ffb76f8
docs: add javaDocs
XtophB Jun 6, 2026
4a30f09
feat: add service class to create and save snapshot to database
XtophB Jun 6, 2026
83e310f
fix: change method name to match entity class name
XtophB Jun 6, 2026
a40c846
test: add test for player mapping
XtophB Jun 6, 2026
bc9e75e
refactor: move lobbyEntity creation to setUp
XtophB Jun 6, 2026
e297caa
test: add test for game state mapping
XtophB Jun 6, 2026
6369afd
test: add test for card mapping
XtophB Jun 6, 2026
a812192
refactor: change name for future maintainability
XtophB Jun 6, 2026
72e276a
Merge pull request #150 from SS26-SE2-Codenames/add-server-logs
the-only-queen-anna Jun 6, 2026
52da7ef
refactor: remove unused imports
XtophB Jun 6, 2026
2536fb4
refactor: remove lombok constructor annotation
XtophB Jun 6, 2026
e58c521
fix: add null guard clause to avoid null pointer exception
XtophB Jun 6, 2026
ef25c84
test: add mocking and setUp() for integration test
XtophB Jun 6, 2026
0120711
refactor: use variables instead of directly calling enums
XtophB Jun 6, 2026
21e4596
test: add test for lobbyEntity
XtophB Jun 6, 2026
31d4ba8
test: add test for game state entity
XtophB Jun 6, 2026
248d9a5
Merge remote-tracking branch 'origin/development' into feature/132-jp…
XtophB Jun 6, 2026
10fe4ef
test: add test for player entity
XtophB Jun 6, 2026
a13381e
test: add test for card entity test
XtophB Jun 6, 2026
7084377
fix: repalce getFirst() with get(x)
XtophB Jun 6, 2026
79b0906
fix: add CreationTimestamp annotation to generate the timestamp for DB
XtophB Jun 6, 2026
6c32e2d
fix: add autowired annotation to allow repository to be initialized
XtophB Jun 6, 2026
bb98bfc
refactor: rename playerEntity to avoid name shadowing
XtophB Jun 6, 2026
9c8a400
style: lint code for google code style
XtophB Jun 6, 2026
952a937
refactor: extract duplicated method calls into variable
XtophB Jun 6, 2026
8d75b7a
test: add test for non Null clues
XtophB Jun 6, 2026
5ead1f7
Merge remote-tracking branch 'origin/development' into feature/133-pe…
XtophB Jun 6, 2026
3e069d3
chore: remove unused gameManager in test
XtophB Jun 6, 2026
e173c46
chore: replace json persistence with DB persistence
XtophB Jun 6, 2026
960c5db
fix: replace json persistence calls with DB persistence calls
XtophB Jun 6, 2026
93a589d
style: remove style violations (empty line, space)
XtophB Jun 6, 2026
df41293
chore: remove comments
XtophB Jun 6, 2026
c846616
fix: remove persistence after flipping card
XtophB Jun 6, 2026
5cc9b50
Merge pull request #151 from SS26-SE2-Codenames/feature/132-jpa-repos…
XtophB Jun 7, 2026
a49b258
Merge remote-tracking branch 'origin/development' into feature/133-pe…
XtophB Jun 7, 2026
8317582
Merge pull request #152 from SS26-SE2-Codenames/feature/133-persisten…
XtophB Jun 7, 2026
8d97966
feat: create mapping method for GameManager restoration
XtophB Jun 8, 2026
4e283df
feat: add mapping for CardList for mapping to GameState
XtophB Jun 8, 2026
cd7760a
feat: add mapping to PlayerDto
XtophB Jun 8, 2026
cde42ea
feat: add helper methods to re-build lobby
XtophB Jun 8, 2026
7a3fad3
feat: add lobby mapper
XtophB Jun 8, 2026
ce7558c
fix: expose method to allow Service to use it
XtophB Jun 8, 2026
81ab52f
feat: add service class to handle existing restoration methods
XtophB Jun 8, 2026
a419673
fix: remove erroneous leftover code
XtophB Jun 8, 2026
6b9d60a
feat: add transactional annotation to ensure atomicity
XtophB Jun 8, 2026
8abca8b
style: add javaDocs
XtophB Jun 8, 2026
6f07d98
fix: replace Transactional annotation with TransactionTemplate
XtophB Jun 9, 2026
ca095d0
test: add unit test for mapping to lobby
XtophB Jun 9, 2026
beb0791
refactor: change for loop to ease testing
XtophB Jun 9, 2026
4c42c2e
test: add unit test for mapping to game state dto
XtophB Jun 9, 2026
7a6806c
test: add test for null game state
XtophB Jun 9, 2026
c98c67c
test: add null test for clue
XtophB Jun 9, 2026
3501e1f
fix: add null guards to prevent null pointer
XtophB Jun 9, 2026
086610a
test: add test for scenario where we have null entries for team
XtophB Jun 9, 2026
de210dd
Terminal test: add test for scenario where we have null entries for role
XtophB Jun 9, 2026
0b037d4
test: add unit test for restorationService class
XtophB Jun 9, 2026
8a4c92b
feat: add logging to ease bug findings
XtophB Jun 9, 2026
301992f
refactor: remove unused import
XtophB Jun 10, 2026
49a10b3
Implement backend cheat functionality
Zheaver Jun 10, 2026
1f8862b
Implement backend cheat validation tests
Zheaver Jun 10, 2026
06141f2
Merge pull request #154 from SS26-SE2-Codenames/feature/149-server-re…
XtophB Jun 11, 2026
af26483
feat: add logging of card list before saving to DB
XtophB Jun 11, 2026
24be06b
fix: add persistence when card is flip
XtophB Jun 11, 2026
b62af83
feat: add mapping for remaining guesses
XtophB Jun 11, 2026
067acd5
feature: update dto to support remaining guesses
XtophB Jun 11, 2026
9a1aaab
fix: add semicolon back
XtophB Jun 11, 2026
5dfe1e4
fix: update existing methods using GameStateDto
XtophB Jun 11, 2026
9134c83
fix: update all tests using gameStateDto
XtophB Jun 11, 2026
0997395
Merge pull request #165 from SS26-SE2-Codenames/fix/163-write-to-db-o…
XtophB Jun 11, 2026
f40c8d4
Merge remote-tracking branch 'origin/development' into fix/add-remain…
XtophB Jun 11, 2026
c9c1aee
feat: add DB lobby entry (and all cascades) deletion when lobby is empty
XtophB Jun 11, 2026
aeab391
fix: update test to include LobbyRepository as constructor argument
XtophB Jun 11, 2026
c17c5cf
test: add test to verify deletion
XtophB Jun 11, 2026
b37e7c5
Merge pull request #166 from SS26-SE2-Codenames/fix/add-remaining-gue…
XtophB Jun 11, 2026
51a3beb
Merge branch 'development' into feature/135-delete-db-entry-when-lobb…
XtophB Jun 11, 2026
703c4f3
fix: to avoid uniqueness violation we try deleting and inserting
XtophB Jun 11, 2026
83af2b7
Merge pull request #169 from SS26-SE2-Codenames/fix/168-db-uniqueness…
XtophB Jun 11, 2026
043f112
Merge branch 'development' into feature/135-delete-db-entry-when-lobb…
XtophB Jun 11, 2026
aead259
Merge pull request #167 from SS26-SE2-Codenames/feature/135-delete-db…
XtophB Jun 12, 2026
e8e2892
refactor: delete Serialization class (dead code)
XtophB Jun 12, 2026
3491cbe
refactor: delete json persistency (redundant due to postgresql DB)
XtophB Jun 12, 2026
e86aa31
refactor: remove usages of now nonexistent json persistence calls
XtophB Jun 12, 2026
cb266a8
refactor: remove volume as it was only used by the json persistence
XtophB Jun 12, 2026
004195f
Merge pull request #172 from SS26-SE2-Codenames/refactor/139-remove-j…
XtophB Jun 13, 2026
23de257
feat: prepare backend for player UUID authentication
5eli Jun 14, 2026
8edc8f9
feat: add player UUID generation in backend
5eli Jun 14, 2026
a867f2a
feat: prevent fake players by verifying UUID on rejoin
5eli Jun 14, 2026
8cf89ad
feat: restrict joins for running games
5eli Jun 14, 2026
fabd484
test: add tests for UUID and rejoin Lobby feature
5eli Jun 14, 2026
7a058a4
test: fix failing test
5eli Jun 14, 2026
27bbbfe
Merge branch 'development' into feature/cheat-validation
Zheaver Jun 14, 2026
f5ebb29
Resolve merge conflicts and refactor cheat handling
Zheaver Jun 14, 2026
a4a9eb6
feature: Implemented security chain
ad-devel Jun 14, 2026
f49c358
Merge remote-tracking branch 'origin/development' into feature/113-se…
ad-devel Jun 14, 2026
82ab401
fix: sonar issue Scope CSRF configuration to API endpoints
ad-devel Jun 14, 2026
94bc5cb
fix: add migration for player UUID
5eli Jun 14, 2026
e49ab6a
feat: add player UUID to persistence mapping
XtophB Jun 14, 2026
97a2a3d
feat: add player UUID to Player DTO
XtophB Jun 14, 2026
581d4b4
feat: add uuid to restoration mapping
XtophB Jun 14, 2026
b78de6d
feat: add parameter to correctly create playerDto in LobbyService
XtophB Jun 14, 2026
98181a9
test: update test to intake uuid as parameter for PlayerDto
XtophB Jun 14, 2026
501d7f0
feat: add V3 Flyway Script to update player table and have UUID as PK
XtophB Jun 14, 2026
47cfd0e
feat: update PlayerEntity class to have UUID as PK
XtophB Jun 14, 2026
a7511e5
test: ensure uuid is mapped correctly
XtophB Jun 14, 2026
747b664
test: update mapping test to check uuid
XtophB Jun 14, 2026
236af04
style: apply google codestyle
5eli Jun 14, 2026
10e1a2f
style: apply google codestyle to tests
5eli Jun 14, 2026
74cf700
test: add test for setting player UUID for restoration
XtophB Jun 14, 2026
081493c
style: add spacing before {
XtophB Jun 14, 2026
7878e5c
Persist cheat flags for game state recovery
Zheaver Jun 15, 2026
51dcfc2
Fix Sonar issues
Zheaver Jun 15, 2026
1ca23e3
Add migration for cheat flags
Zheaver Jun 15, 2026
ccd2b9b
fix: allowed-origins and SockJS changes according to feedback
ad-devel Jun 15, 2026
b1f0891
style: add imports instead of manually calling packages
XtophB Jun 15, 2026
ff28bc4
Merge pull request #176 from SS26-SE2-Codenames/feature/113-security_…
ad-devel Jun 15, 2026
19dee71
Merge branch 'development' into feature/cheat-validation
Zheaver Jun 15, 2026
a193523
Merge branch 'development' into feature/cheat-validation
Zheaver Jun 15, 2026
9e1c134
fix: authenticate leave and start game requests using UUID
5eli Jun 16, 2026
44b1f95
fix: remove unnecessary null-check
5eli Jun 16, 2026
4e30486
fix: enforce UUID validation for player reconnects
5eli Jun 16, 2026
b38cb4c
fix: update javaDoc
5eli Jun 16, 2026
40bf4f5
test: align tests with new UUID validation logic
5eli Jun 16, 2026
1f69149
Merge branch 'development' into player_UUID
5eli Jun 16, 2026
a59938d
Merge remote-tracking branch 'origin/player_UUID' into player_UUID
5eli Jun 16, 2026
6810356
fix: same username can be picked multiple times
5eli Jun 16, 2026
dbc4730
refactor: change files so uuid is used instead of username
5eli Jun 16, 2026
e370f2a
test: change test to align with new changes
5eli Jun 16, 2026
a9b58ef
fix: change required from UUID to username for lobby creation
5eli Jun 16, 2026
2f38bf6
style: update javaDoc
5eli Jun 16, 2026
be8ae70
Fix cheat system message handling
Zheaver Jun 17, 2026
5b9c0d4
Merge branch 'feature/cheat-validation' of https://github.com/SS26-SE…
Zheaver Jun 17, 2026
8a389ad
Merge pull request #155 from SS26-SE2-Codenames/feature/cheat-validation
Zheaver Jun 17, 2026
4b347f0
Merge branch 'development' into player_UUID
5eli Jun 17, 2026
c5fa252
refactor: removed unused variable
the-only-queen-anna Jun 17, 2026
59f429d
fix: change getPlayer from uuid to username
the-only-queen-anna Jun 17, 2026
f78c389
fix: combine V2 flyway migration scripts
the-only-queen-anna Jun 17, 2026
15fd8d0
docs: add docker compose resource limits
tasaje1 Jun 17, 2026
a76414d
chore: change jdk to jre to reduce RAM usage
XtophB Jun 17, 2026
df6656a
Merge pull request #175 from SS26-SE2-Codenames/player_UUID
tasaje1 Jun 17, 2026
5fd6a1a
Merge remote-tracking branch 'origin/development' into docs/deploymen…
XtophB Jun 17, 2026
738feed
Merge pull request #179 from SS26-SE2-Codenames/docs/deployment-resou…
tasaje1 Jun 17, 2026
25f8c91
Merge branch 'development' into merge/development-update
the-only-queen-anna Jun 17, 2026
928e43d
Merge pull request #183 from SS26-SE2-Codenames/merge/development-update
XtophB Jun 17, 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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ WORKDIR /app
COPY . .
RUN mvn clean package -DskipTests

FROM eclipse-temurin:17-jdk-jammy
FROM eclipse-temurin:17-jre-jammy
WORKDIR /app
COPY --from=build /app/target/*.jar app.jar

Expand Down
21 changes: 18 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ services:
postgres:
image: postgres:16
restart: unless-stopped
deploy:
resources:
limits:
cpus: "0.25"
memory: 256M
reservations:
cpus: "0.10"
memory: 128M
environment:
POSTGRES_DB: codenames
POSTGRES_USER: codenames_user
Expand All @@ -17,11 +25,18 @@ services:
backend:
image: ghcr.io/ss26-se2-codenames/backend:latest
restart: unless-stopped
deploy:
resources:
limits:
cpus: "0.50"
memory: 512M
reservations:
cpus: "0.25"
memory: 256M
ports:
- "53213:8080"
volumes:
- ./data:/app/data
environment: # Inject datasource url into application.yml when containerized
JAVA_TOOL_OPTIONS: "-XX:MaxRAMPercentage=75"
SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/codenames
SPRING_DATASOURCE_USERNAME: codenames_user
SPRING_DATASOURCE_PASSWORD: codenames_pass
Expand All @@ -30,4 +45,4 @@ services:
condition: service_healthy

volumes:
postgres_data:
postgres_data:
6 changes: 6 additions & 0 deletions lombok.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Source - https://stackoverflow.com/a/48971823
#Posted by mladzo, modified by community. See post 'Timeline' for change history
#Retrieved 2026-06-04, License - CC BY-SA 3.0

config.stopBubbling = true
lombok.addLombokGeneratedAnnotation = true
27 changes: 16 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
<?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">
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
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>3.2.5</version>
<relativePath/> <!-- lookup parent from repository -->
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.codenames</groupId>
<artifactId>Codenames_Backend</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Codenames_Backend</name>
<description>Codenames_Backend</description>
<url/>
<url />
<licenses>
<license/>
<license />
</licenses>
<developers>
<developer/>
<developer />
</developers>
<scm>
<connection/>
<developerConnection/>
<tag/>
<url/>
<connection />
<developerConnection />
<tag />
<url />
</scm>
<properties>
<java.version>17</java.version>
Expand Down Expand Up @@ -58,7 +59,7 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
Expand Down Expand Up @@ -93,6 +94,10 @@
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.codenames.codenames.backend.chat;
package com.codenames.codenames.backend.chat.api;

import com.codenames.codenames.backend.lobby.services.LobbyService;
import com.codenames.codenames.backend.utility.ChatMessageType;
import com.codenames.codenames.backend.utility.Role;
import com.codenames.codenames.backend.utility.Team;
import com.codenames.codenames.backend.chat.api.dto.ChatDto;
import com.codenames.codenames.backend.chat.api.dto.ChatMessageType;
import com.codenames.codenames.backend.chat.application.ChatService;
import com.codenames.codenames.backend.lobby.application.LobbyService;
import com.codenames.codenames.backend.lobby.domain.Role;
import com.codenames.codenames.backend.lobby.domain.Team;
import org.springframework.messaging.handler.annotation.DestinationVariable;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.Payload;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
package com.codenames.codenames.backend.chat;

import com.codenames.codenames.backend.utility.ChatMessageType;
package com.codenames.codenames.backend.chat.api.dto;

/**
* Record class for messages that is used in controller.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.codenames.codenames.backend.utility;
package com.codenames.codenames.backend.chat.api.dto;

/**
* Enum representing the type of chat message.
*/
public enum ChatMessageType {
CHAT
}
CHAT,
SYSTEM
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.codenames.codenames.backend.chat;
package com.codenames.codenames.backend.chat.application;

import com.codenames.codenames.backend.chat.api.dto.ChatDto;
import com.codenames.codenames.backend.chat.domain.ChatHistory;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import lombok.extern.slf4j.Slf4j;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.codenames.codenames.backend.chat;
package com.codenames.codenames.backend.chat.domain;

import com.codenames.codenames.backend.chat.api.dto.ChatDto;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.codenames.codenames.backend.database.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
* Persistent entity representing a card record within the database schema.
*/
@Getter
@Setter
@NoArgsConstructor
@Entity
@Table(name = "card")
public class CardEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ManyToOne
@JoinColumn(name = "lobby_code", nullable = false)
private LobbyEntity lobbyEntity;
@Column(nullable = false)
private int position;
@Column(length = 11, nullable = false)
private String word;
@Column(length = 8, nullable = false)
private String color;
@Column(name = "is_guessed", nullable = false)
private Boolean isGuessed;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.codenames.codenames.backend.database.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.MapsId;
import jakarta.persistence.OneToOne;
import jakarta.persistence.Table;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
* Persistent entity representing a gameState record within the database schema.
*/
@Getter
@Setter
@NoArgsConstructor
@Entity
@Table(name = "game_state")
public class GameStateEntity {
@Id
@Column(name = "lobby_code")
private String lobbyCode;
@OneToOne
@MapsId
@JoinColumn(name = "lobby_code")
private LobbyEntity lobbyEntity;
@Column(name = "current_turn", length = 4, nullable = false)
private String currentTurn;
@Column(name = "current_phase", length = 9, nullable = false)
private String currentPhase;
@Column(name = "clue_word", length = 20)
private String clueWord;
@Column(name = "clue_guess_amount")
private int clueGuessAmount;
@Column(name = "remaining_guesses")
private int remainingGuesses;
@Column(name = "red_team_cheat_used", nullable = false)
private boolean redTeamCheatUsed;
@Column(name = "blue_team_cheat_used", nullable = false)
private boolean blueTeamCheatUsed;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.codenames.codenames.backend.database.entity;

import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.OneToMany;
import jakarta.persistence.OneToOne;
import jakarta.persistence.Table;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.SourceType;

/**
* Persistent entity representing a lobby record within the database schema.
*/
@Getter
@Setter
@NoArgsConstructor
@Entity
@Table(name = "lobby")
public class LobbyEntity {
@Id
@Column(name = "lobby_code", length = 5, nullable = false)
private String lobbyCode;
@Column(name = "created_at", insertable = false, updatable = false, nullable = false)
@CreationTimestamp(source = SourceType.DB)
private Timestamp createdAt;

@OneToOne(mappedBy = "lobbyEntity", cascade = CascadeType.ALL, orphanRemoval = true)
private GameStateEntity gameStateEntity;

@OneToMany(mappedBy = "lobbyEntity", cascade = CascadeType.ALL, orphanRemoval = true)
private List<PlayerEntity> playerEntities = new ArrayList<>();

@OneToMany(mappedBy = "lobbyEntity", cascade = CascadeType.ALL, orphanRemoval = true)
private List<CardEntity> cardEntities = new ArrayList<>();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.codenames.codenames.backend.database.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
* Persistent entity representing a player record within the database schema.
*/
@Getter
@Setter
@NoArgsConstructor
@Entity
@Table(name = "player")
public class PlayerEntity {
@Id
@Column(nullable = false)
private String uuid;
@ManyToOne
@JoinColumn(name = "lobby_code", nullable = false)
private LobbyEntity lobbyEntity;
@Column(length = 20, nullable = false)
private String username;
@Column(name = "is_host", nullable = false)
private Boolean isHost;
@Column(length = 4, nullable = false)
private String team;
@Column(length = 9, nullable = false)
private String role;
}
Loading
Loading