diff --git a/sql/discussion.sql b/sql/discussion.sql index 05d079e..d53ca4f 100644 --- a/sql/discussion.sql +++ b/sql/discussion.sql @@ -3,11 +3,12 @@ CREATE TABLE `discussion` ( `id` bigint NOT NULL AUTO_INCREMENT, `uid` bigint NOT NULL COMMENT 'uid', + `email` varchar(512) DEFAULT NULL COMMENT '이메일', `type` varchar(32) NOT NULL COMMENT '문의하기 유형', `title` varchar(512) NOT NULL COMMENT '문의하기 제목', `content` text NOT NULL COMMENT '문의하기 본문', - `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '생성일', - `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '수정일', + `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '생성일', + `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '수정일', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=200000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; CREATE INDEX idx__uid ON discussion (uid); diff --git a/src/main/kotlin/com/hero/alignlab/domain/discussion/application/DiscussionService.kt b/src/main/kotlin/com/hero/alignlab/domain/discussion/application/DiscussionService.kt index 596015a..5d3e963 100644 --- a/src/main/kotlin/com/hero/alignlab/domain/discussion/application/DiscussionService.kt +++ b/src/main/kotlin/com/hero/alignlab/domain/discussion/application/DiscussionService.kt @@ -17,6 +17,7 @@ class DiscussionService( suspend fun create(user: AuthUser, request: DiscussionRequest): DiscussionResponse { val discussion = Discussion( uid = user.uid, + email = request.email, type = request.type, title = request.title, content = request.content, diff --git a/src/main/kotlin/com/hero/alignlab/domain/discussion/domain/Discussion.kt b/src/main/kotlin/com/hero/alignlab/domain/discussion/domain/Discussion.kt index ed2999b..a9fe16a 100644 --- a/src/main/kotlin/com/hero/alignlab/domain/discussion/domain/Discussion.kt +++ b/src/main/kotlin/com/hero/alignlab/domain/discussion/domain/Discussion.kt @@ -14,6 +14,9 @@ class Discussion( @Column(name = "uid") val uid: Long, + @Column(name = "email") + val email: String? = null, + @Column(name = "type") @Enumerated(EnumType.STRING) val type: DiscussionType, diff --git a/src/main/kotlin/com/hero/alignlab/domain/discussion/model/request/DiscussionRequest.kt b/src/main/kotlin/com/hero/alignlab/domain/discussion/model/request/DiscussionRequest.kt index 820a518..19e657b 100644 --- a/src/main/kotlin/com/hero/alignlab/domain/discussion/model/request/DiscussionRequest.kt +++ b/src/main/kotlin/com/hero/alignlab/domain/discussion/model/request/DiscussionRequest.kt @@ -3,6 +3,8 @@ package com.hero.alignlab.domain.discussion.model.request import com.hero.alignlab.domain.discussion.domain.vo.DiscussionType data class DiscussionRequest( + /** 이메일, nullable하게 데이터를 받음. */ + val email: String? = null, /** 문의하기 유형 */ val type: DiscussionType, /** 문의하기 제목 */ diff --git a/src/main/kotlin/com/hero/alignlab/domain/discussion/model/response/DiscussionResponse.kt b/src/main/kotlin/com/hero/alignlab/domain/discussion/model/response/DiscussionResponse.kt index 5ec97d3..05130cb 100644 --- a/src/main/kotlin/com/hero/alignlab/domain/discussion/model/response/DiscussionResponse.kt +++ b/src/main/kotlin/com/hero/alignlab/domain/discussion/model/response/DiscussionResponse.kt @@ -7,6 +7,7 @@ import java.time.LocalDateTime data class DiscussionResponse( val id: Long, val uid: Long, + val email: String?, val type: DiscussionType, val title: String, val content: String, @@ -18,6 +19,7 @@ data class DiscussionResponse( return DiscussionResponse( id = discussion.id, uid = discussion.uid, + email = discussion.email, type = discussion.type, title = discussion.title, content = discussion.content,