-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
175 additions
and
25 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
app/backend/src/main/kotlin/com/gamelounge/backend/entity/Comment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.gamelounge.backend.entity | ||
import jakarta.persistence.* | ||
import java.time.Instant | ||
|
||
@Entity | ||
@Table(name = "comments") | ||
class Comment( | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
val commentId: Long? = null, | ||
|
||
val content: String = "", | ||
val creationDate: Instant = Instant.now(), | ||
val upvotes: Int = 0, | ||
val downvotes: Int = 0, | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "postId") | ||
val post: Post? = null, | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "lfgId") | ||
val lfg: LFG? = null, | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "userId") | ||
val user: User? = null | ||
) |
32 changes: 32 additions & 0 deletions
32
app/backend/src/main/kotlin/com/gamelounge/backend/entity/Game.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.gamelounge.backend.entity | ||
|
||
import jakarta.persistence.GeneratedValue | ||
import jakarta.persistence.GenerationType | ||
import jakarta.persistence.Id | ||
import jakarta.persistence.ManyToOne | ||
|
||
import jakarta.persistence.* | ||
|
||
@Entity | ||
@Table(name = "games") | ||
class Game ( | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
val gameId: Long? = null, | ||
|
||
val title: String = "", | ||
val description: String = "", | ||
val genre: String = "", | ||
val platform: String = "", | ||
val avatarDetails: String = "", // Consider a more complex structure | ||
val playerNumber: String = "", | ||
val releaseYear: Int = 0, | ||
val universe: String = "", | ||
val mechanics: String = "", | ||
val playtime: String = "", | ||
val mapInformation: String = "", | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "userId") | ||
val user: User? = null | ||
) |
28 changes: 28 additions & 0 deletions
28
app/backend/src/main/kotlin/com/gamelounge/backend/entity/LFG.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.gamelounge.backend.entity | ||
|
||
import jakarta.persistence.* | ||
import java.time.Instant | ||
|
||
@Entity | ||
@Table(name = "lfg") | ||
class LFG( | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
val lfgId: Long? = null, | ||
|
||
val title: String = "", | ||
val description: String = "", | ||
val requiredPlatform: String = "", | ||
val requiredLanguage: String = "", | ||
val micCamRequirement: Boolean = true, | ||
val memberCapacity: Int = 0, | ||
val creationDate: Instant = Instant.now(), | ||
val tags: String? = "", | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "userId") | ||
val user: User? = null, | ||
|
||
@OneToMany(mappedBy = "lfg", cascade = arrayOf(CascadeType.ALL), orphanRemoval = true) | ||
val comments: List<Comment> = mutableListOf() | ||
) |
28 changes: 28 additions & 0 deletions
28
app/backend/src/main/kotlin/com/gamelounge/backend/entity/Post.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.gamelounge.backend.entity | ||
import jakarta.persistence.* | ||
import lombok.NoArgsConstructor | ||
import java.time.Instant | ||
|
||
@Entity | ||
@Table(name = "posts") | ||
class Post( | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
val postId: Long? = null, | ||
|
||
val content: String = "", | ||
val creationDate: Instant = Instant.now(), | ||
val upvotes: Int = 0, | ||
val downvotes: Int = 0, | ||
val tags: String? = "", | ||
val category: String = "", | ||
val relatedGamePage: String? = "", | ||
val annotations: String? = "", | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "userId") | ||
val user: User? = null, | ||
|
||
@OneToMany(mappedBy = "post", cascade = arrayOf(CascadeType.ALL), orphanRemoval = true) | ||
val comments: List<Comment> = mutableListOf() | ||
) |
19 changes: 19 additions & 0 deletions
19
app/backend/src/main/kotlin/com/gamelounge/backend/entity/Tag.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.gamelounge.backend.entity | ||
|
||
import jakarta.persistence.* | ||
|
||
@Entity | ||
@Table(name = "tags") | ||
class Tag( | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
val tagId: Long = 0, | ||
|
||
val name: String = "", | ||
|
||
@ManyToMany(mappedBy = "tags") | ||
val posts: List<Post> = mutableListOf(), | ||
|
||
@ManyToMany(mappedBy = "tags") | ||
val lfgs: List<LFG> = mutableListOf() | ||
) |
43 changes: 28 additions & 15 deletions
43
app/backend/src/main/kotlin/com/gamelounge/backend/entity/User.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,34 @@ | ||
package com.gamelounge.backend.entity | ||
|
||
|
||
import jakarta.persistence.Entity | ||
import jakarta.persistence.Id | ||
import jakarta.persistence.Table | ||
import jakarta.persistence.* | ||
import lombok.Data | ||
import lombok.NoArgsConstructor | ||
|
||
@Entity | ||
@Table(name ="users") | ||
@Data | ||
@NoArgsConstructor | ||
class User( | ||
@Id val username: String, | ||
val email: String, | ||
val name: String, | ||
val surname: String, | ||
val image: ByteArray? = null, | ||
var passwordHash: ByteArray, | ||
var salt: ByteArray, | ||
){ | ||
constructor() : this("", "", "", "", null, ByteArray(0), ByteArray(0)) | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
val userId: Long = 0, | ||
|
||
val username: String = "", | ||
val email: String = "", | ||
val password: String = "", | ||
val profilePicture: String? = null, | ||
val about: String? = null, | ||
var passwordHash: ByteArray = ByteArray(0), | ||
var salt: ByteArray = ByteArray(0), | ||
|
||
@OneToMany(mappedBy = "user", cascade = [CascadeType.ALL], orphanRemoval = true) | ||
val posts: List<Post>? = mutableListOf(), | ||
|
||
@OneToMany(mappedBy = "user", cascade = [CascadeType.ALL], orphanRemoval = true) | ||
val games: List<Game>? = mutableListOf(), | ||
|
||
@OneToMany(mappedBy = "user", cascade = [CascadeType.ALL], orphanRemoval = true) | ||
val LFGs: List<LFG>? = mutableListOf(), | ||
|
||
} | ||
@ManyToMany(mappedBy = "user", cascade = [CascadeType.ALL]) | ||
val tags: List<Tag>? = mutableListOf() | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters