Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.andlife.InvitationServer.controller

import com.andlife.InvitationServer.entity.Sample
import com.andlife.InvitationServer.response.BaseResponse
import com.andlife.InvitationServer.service.SampleService
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RestController
Expand All @@ -11,8 +12,9 @@ class SampleController(
) {

@GetMapping("/")
fun getSamples(): List<Sample> {
return sampleService.getAllSamples()
fun getSamples(): BaseResponse<List<Sample>> {
val samples = sampleService.getAllSamples()
return BaseResponse.success(samples)
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.andlife.InvitationServer.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

@Entity
@Table(name = "announcement_sections")
class AnnouncementSection(
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
val id: Long = 0,

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "invitation_id")
val invitation: Invitation,

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

@Column(nullable = false)
val content: String,

@Column(name = "display_order", nullable = false)
val displayOrder: Int,
): BaseCreatedEntity()
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.andlife.InvitationServer.entity

import jakarta.persistence.Column
import jakarta.persistence.EntityListeners
import jakarta.persistence.MappedSuperclass
import org.hibernate.annotations.CreationTimestamp
import org.hibernate.annotations.UpdateTimestamp
import org.springframework.data.jpa.domain.support.AuditingEntityListener
import java.time.LocalDateTime

@MappedSuperclass
@EntityListeners(AuditingEntityListener::class)
abstract class BaseCreatedEntity {
@CreationTimestamp
@Column(name = "created_at", nullable = false, updatable = false)
val createdAt: LocalDateTime = LocalDateTime.now()
}

@MappedSuperclass
abstract class BaseTimeEntity : BaseCreatedEntity() {
@UpdateTimestamp
@Column(name = "updated_at", nullable = false)
var updatedAt: LocalDateTime = LocalDateTime.now()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
package com.andlife.InvitationServer.entity

import jakarta.persistence.CascadeType
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.OneToMany
import jakarta.persistence.Table

@Entity
@Table(name = "guestbooks")
class GuestBook(
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
val id: Long = 0,

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "invitation_id", nullable = false)
val invitation: Invitation,

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id", nullable = false)
val user: User,

@Column(name = "text_content", columnDefinition = "TEXT", nullable = false)
var textContent: String,

@OneToMany(mappedBy = "guestBook", cascade = [CascadeType.ALL])
val images: MutableList<GuestBookImage> = mutableListOf(),

@OneToMany(mappedBy = "guestBook", cascade = [CascadeType.ALL])
val audios: MutableList<GuestBookAudio> = mutableListOf(),

@OneToMany(mappedBy = "guestBook", cascade = [CascadeType.ALL])
val videos: MutableList<GuestBookVideo> = mutableListOf()
) : BaseTimeEntity()

@Entity
@Table(name = "guestbook_images")
class GuestBookImage(
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
val id: Long = 0,

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "guestbook_post_id", nullable = false)
val guestBook: GuestBook,

@Column(name = "image_url", nullable = false)
val imageUrl: String,

@Column(name = "display_order", nullable = false)
val displayOrder: Int = 0
)

@Entity
@Table(name = "guestbook_audios")
class GuestBookAudio(
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
val id: Long = 0,

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "guestbook_post_id", nullable = false)
val guestBook: GuestBook,

@Column(name = "audio_url", nullable = false)
val audioUrl: String,

@Column(name = "duration_seconds", nullable = false)
val durationSeconds: Int,

@Column(name = "display_order", nullable = false)
val displayOrder: Int = 0
)

@Entity
@Table(name = "guestbook_videos")
class GuestBookVideo(
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
val id: Long = 0,

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "guestbook_post_id", nullable = false)
val guestBook: GuestBook,

@Column(name = "video_url", nullable = false)
val videoUrl: String,

@Column(name = "thumbnail_url", nullable = false)
val thumbnailUrl: String,


@Column(name = "duration_seconds", nullable = false)
val durationSeconds: Int,

@Column(name = "display_order", nullable = false)
val displayOrder: Int = 0,

@OneToMany(mappedBy = "video", cascade = [CascadeType.ALL])
val previewThumbnails: MutableList<VideoPreviewThumbnail> = mutableListOf()
)


@Entity
@Table(name = "video_preview_thumbnails")
class VideoPreviewThumbnail(
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
val id: Long = 0,

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "guestbook_video_id", nullable = false)
val video: GuestBookVideo,

@Column(name = "thumbnail_url", nullable = false)
val thumbnailUrl: String,

@Column(name = "time_seconds", nullable = false)
val timeSeconds: Double
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package com.andlife.InvitationServer.entity

import com.andlife.InvitationServer.util.StringListConverter
import jakarta.persistence.Column
import jakarta.persistence.Convert
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 java.time.LocalDate
import java.time.LocalTime

@Entity
@Table(name = "invitations")
class Invitation(
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
val id: Long = 0,

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "host_id", nullable = false)
val host: User,

@Column(nullable = false)
var title: String,

@Column(name = "display_host_name", nullable = false)
var displayHostName: String,

@Convert(converter = StringListConverter::class)
@Column(name = "thumbnail_urls")
var thumbnailUrls: List<String> = emptyList(),

@Column(name = "invitation_date", nullable = false)
val invitationDate: LocalDate,

@Column(name = "start_time", nullable = false)
val startTime: LocalTime,

@Column(name = "end_time")
val endTime: LocalTime? = null,

@Column(name = "place_name", nullable = false)
var placeName: String,

@Column(nullable = false)
var address: String,

@Column(nullable = false)
val lat: Double,

@Column(nullable = false)
val lng: Double,

@Column(name = "location_guide")
var locationGuide: String? = null
) : BaseTimeEntity()
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.andlife.InvitationServer.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.OneToOne
import jakarta.persistence.Table

@Entity
@Table(name = "invitation_cards")
class InvitationCard(
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
val id: Long = 0,

@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "invitation_id", nullable = false)
val invitation: Invitation,

@Column(name = "content_json", columnDefinition = "TEXT")
var contentJson: String,

@Column(name = "background_image_url")
var backgroundImageUrl: String? = null
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.andlife.InvitationServer.entity

import jakarta.persistence.*
import org.hibernate.annotations.CreationTimestamp
import java.time.LocalDateTime

@Entity
@Table(
name = "invitation_participants",
uniqueConstraints = [
UniqueConstraint(
name = "uk_invitation_user",
columnNames = ["invitation_id", "user_id"]
)
]
)
class InvitationParticipant(
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
val id: Long = 0,

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "invitation_id", nullable = false)
val invitation: Invitation,

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id", nullable = false)
val user: User,

@CreationTimestamp
@Column(name = "joined_at", nullable = false, updatable = false)
val joinedAt: LocalDateTime = LocalDateTime.now()
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.andlife.InvitationServer.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.OneToOne
import jakarta.persistence.Table

@Entity
@Table(name = "thanks_cards")
class ThanksCard(
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
val id: Long = 0,

@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "invitation_id", nullable = false)
val invitation: Invitation,

@Column(name = "content_json", columnDefinition = "TEXT")
var contentJson: String,

@Column(name = "background_image_url")
var backgroundImageUrl: String? = null
): BaseTimeEntity()
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.andlife.InvitationServer.entity

import jakarta.persistence.Column
import jakarta.persistence.Entity
import jakarta.persistence.GeneratedValue
import jakarta.persistence.GenerationType
import jakarta.persistence.Table
import jakarta.persistence.Id

@Entity
@Table(name = "users")
class User(
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
val id: Long,

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

@Column(nullable = false)
val name: String,

@Column(name = "profile_image_url")
val profileImageUrl: String? = null,
): BaseTimeEntity()
Loading