Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 2 additions & 0 deletions src/main/kotlin/team/cklob/mudda/MuddaApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package team.cklob.mudda

import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
import org.springframework.data.jpa.repository.config.EnableJpaAuditing

@EnableJpaAuditing
@SpringBootApplication
class MuddaApplication

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package team.cklob.mudda.domain.block.domain.entity

import jakarta.persistence.Column
import jakarta.persistence.Entity
import jakarta.persistence.FetchType
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 jakarta.persistence.UniqueConstraint
import team.cklob.mudda.domain.member.domain.entity.Member
import team.cklob.mudda.global.common.entity.BaseCreatedAtEntity

@Entity
@Table(
name = "tbl_block",
uniqueConstraints = [
UniqueConstraint(
name = "uq_block_blocker_blocked",
columnNames = ["blocker_id", "blocked_id"],
),
],
)
class Block(
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "blocker_id", nullable = false)
val blocker: Member,

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "blocked_id", nullable = false)
val blocked: Member,

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
val id: Long? = null,
) : BaseCreatedAtEntity()
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package team.cklob.mudda.domain.block.domain.repository

import org.springframework.data.jpa.repository.JpaRepository
import team.cklob.mudda.domain.block.domain.entity.Block

interface BlockRepository : JpaRepository<Block, Long> {
fun existsByBlockerIdAndBlockedId(blockerId: Long, blockedId: Long): Boolean
fun findByBlockerId(blockerId: Long): List<Block>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package team.cklob.mudda.domain.friend.domain.entity

import jakarta.persistence.Column
import jakarta.persistence.Entity
import jakarta.persistence.EnumType
import jakarta.persistence.Enumerated
import jakarta.persistence.FetchType
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 jakarta.persistence.UniqueConstraint
import team.cklob.mudda.domain.friend.domain.type.FriendRequestStatus
import team.cklob.mudda.domain.member.domain.entity.Member
import team.cklob.mudda.global.common.entity.BaseCreatedAtEntity
import java.time.LocalDateTime

@Entity
@Table(
name = "tbl_friend",
uniqueConstraints = [
UniqueConstraint(
name = "uq_friend_requester_receiver",
columnNames = ["requester_id", "receiver_id"],
),
],
)
class Friend(
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "requester_id", nullable = false)
val requester: Member,

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "receiver_id", nullable = false)
val receiver: Member,

@Enumerated(EnumType.STRING)
@Column(nullable = false, length = 20)
var status: FriendRequestStatus,

@Column(name = "accepted_at")
var acceptedAt: LocalDateTime? = null,

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
val id: Long? = null,
) : BaseCreatedAtEntity()
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package team.cklob.mudda.domain.friend.domain.repository

import org.springframework.data.jpa.repository.JpaRepository
import team.cklob.mudda.domain.friend.domain.entity.Friend
import java.util.Optional

interface FriendRepository : JpaRepository<Friend, Long> {
fun findByRequesterIdOrReceiverId(requesterId: Long, receiverId: Long): List<Friend>
fun findByRequesterIdAndReceiverId(requesterId: Long, receiverId: Long): Optional<Friend>
fun existsByRequesterIdAndReceiverId(requesterId: Long, receiverId: Long): Boolean
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package team.cklob.mudda.domain.friend.domain.type

enum class FriendRequestStatus {
PENDING,
ACCEPTED,
REJECTED,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package team.cklob.mudda.domain.friend.domain.type

enum class FriendRequestType {
RECEIVED,
SENT,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package team.cklob.mudda.domain.friend.domain.type

enum class FriendStatus {
NONE,
FRIEND,
REQUESTED,
RECEIVED,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package team.cklob.mudda.domain.media.domain.entity

import jakarta.persistence.Column
import jakarta.persistence.Entity
import jakarta.persistence.EnumType
import jakarta.persistence.Enumerated
import jakarta.persistence.FetchType
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 team.cklob.mudda.domain.media.domain.type.MediaType
import team.cklob.mudda.domain.timecapsule.domain.entity.TimeCapsule
import team.cklob.mudda.global.common.entity.BaseCreatedAtEntity

@Entity
@Table(name = "tbl_media")
class Media(
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "time_capsule_id", nullable = false)
val timeCapsule: TimeCapsule,

@Enumerated(EnumType.STRING)
@Column(name = "media_type", nullable = false, length = 20)
val mediaType: MediaType,

@Column(name = "media_url", nullable = false, length = 255)
val mediaUrl: String,

@Column(name = "s3_key", nullable = false, length = 255)
val s3Key: String,

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
val id: Long? = null,
) : BaseCreatedAtEntity()
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package team.cklob.mudda.domain.media.domain.repository

import org.springframework.data.jpa.repository.JpaRepository
import team.cklob.mudda.domain.media.domain.entity.Media

interface MediaRepository : JpaRepository<Media, Long>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package team.cklob.mudda.domain.media.domain.type

enum class MediaTargetType {
PROFILE,
CAPSULE,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package team.cklob.mudda.domain.media.domain.type

enum class MediaType {
IMAGE,
VIDEO,
VOICE,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package team.cklob.mudda.domain.member.domain.entity

import jakarta.persistence.Column
import jakarta.persistence.Entity
import jakarta.persistence.GeneratedValue
import jakarta.persistence.GenerationType
import jakarta.persistence.Id
import jakarta.persistence.Table
import team.cklob.mudda.global.common.entity.BaseTimeEntity

@Entity
@Table(name = "tbl_member")
class Member(
@Column(nullable = false, length = 30)
var name: String,

@Column(nullable = false, unique = true, length = 30)
var nickname: String,

@Column(nullable = false, unique = true, length = 255)
val email: String,

@Column(name = "profile_image_url", length = 255)
var profileImageUrl: String? = null,

@Column(length = 100)
var bio: String? = null,

@Column(name = "profile_visibility", nullable = false, length = 20)
var profileVisibility: String,

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
val id: Long? = null,
) : BaseTimeEntity()
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package team.cklob.mudda.domain.member.domain.repository

import org.springframework.data.jpa.repository.JpaRepository
import team.cklob.mudda.domain.member.domain.entity.Member
import java.util.Optional

interface MemberRepository : JpaRepository<Member, Long> {
fun existsByEmail(email: String): Boolean
fun existsByNickname(nickname: String): Boolean
fun findByEmail(email: String): Optional<Member>
fun findByNickname(nickname: String): Optional<Member>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package team.cklob.mudda.domain.member.domain.type

enum class Gender {
MALE,
FEMALE,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package team.cklob.mudda.domain.member.domain.type

enum class OAuthProvider {
KAKAO,
GOOGLE,
APPLE,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package team.cklob.mudda.domain.notification.domain.entity

import jakarta.persistence.Column
import jakarta.persistence.Entity
import jakarta.persistence.EnumType
import jakarta.persistence.Enumerated
import jakarta.persistence.FetchType
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 team.cklob.mudda.domain.member.domain.entity.Member
import team.cklob.mudda.domain.notification.domain.type.NotificationType
import team.cklob.mudda.domain.timecapsule.domain.entity.TimeCapsule
import team.cklob.mudda.global.common.entity.BaseCreatedAtEntity

@Entity
@Table(name = "tbl_notification")
class Notification(
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "recipient_id", nullable = false)
val recipient: Member,

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "time_capsule_id")
val timeCapsule: TimeCapsule? = null,

@Enumerated(EnumType.STRING)
@Column(name = "notification_type", nullable = false, length = 30)
val notificationType: NotificationType,

@Column(nullable = false, length = 255)
val title: String,

@Column(nullable = false, length = 255)
val body: String,

@Column(name = "is_read", nullable = false)
var isRead: Boolean = false,

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
val id: Long? = null,
) : BaseCreatedAtEntity()
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package team.cklob.mudda.domain.notification.domain.repository

import org.springframework.data.jpa.repository.JpaRepository
import team.cklob.mudda.domain.notification.domain.entity.Notification

interface NotificationRepository : JpaRepository<Notification, Long> {
fun findByRecipientIdOrderByCreatedAtDesc(recipientId: Long): List<Notification>
fun findByRecipientIdAndIsReadFalseOrderByCreatedAtDesc(recipientId: Long): List<Notification>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package team.cklob.mudda.domain.notification.domain.type

enum class NotificationTargetType {
CAPSULE,
MEMBER,
FRIEND_REQUEST,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package team.cklob.mudda.domain.notification.domain.type

enum class NotificationType {
CAPSULE_OPENED,
CAPSULE_RECEIVED,
FRIEND_REQUESTED,
FRIEND_ACCEPTED,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package team.cklob.mudda.domain.report.domain.entity

import jakarta.persistence.Column
import jakarta.persistence.Entity
import jakarta.persistence.FetchType
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 jakarta.persistence.UniqueConstraint
import team.cklob.mudda.domain.member.domain.entity.Member
import team.cklob.mudda.global.common.entity.BaseCreatedAtEntity

@Entity
@Table(
name = "tbl_report",
uniqueConstraints = [
UniqueConstraint(
name = "uq_report_reporter_target",
columnNames = ["reporter_id", "target_type", "target_id"],
),
],
)
class Report(
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "reporter_id", nullable = false)
val reporter: Member,

@Column(name = "target_type", nullable = false, length = 30)
val targetType: String,

@Column(name = "target_id", nullable = false)
val targetId: Long,

@Column(nullable = false, length = 30)
val reason: String,

@Column(length = 500)
val description: String? = null,

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
val id: Long? = null,
) : BaseCreatedAtEntity()
Loading