-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #107 from SUIN-BUNDANG-LINE/SBL-225-ai-generate-log
[SBL-225] AI 초안 생성 로그를 저장하도록 수정
- Loading branch information
Showing
7 changed files
with
132 additions
and
7 deletions.
There are no files selected for viewing
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
18 changes: 18 additions & 0 deletions
18
src/main/kotlin/com/sbl/sulmun2yong/ai/adapter/AIGenerateLogAdapter.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,18 @@ | ||
package com.sbl.sulmun2yong.ai.adapter | ||
|
||
import com.sbl.sulmun2yong.ai.domain.AIGenerateLog | ||
import com.sbl.sulmun2yong.ai.entity.AIGenerateLogDocument | ||
import com.sbl.sulmun2yong.ai.repository.AIGenerateLogRepository | ||
import org.springframework.stereotype.Component | ||
|
||
@Component | ||
class AIGenerateLogAdapter( | ||
private val aiGenerateLogRepository: AIGenerateLogRepository, | ||
) { | ||
fun saveGenerateLog(aiGenerateLog: AIGenerateLog) = | ||
aiGenerateLogRepository.save( | ||
AIGenerateLogDocument.from( | ||
aiGenerateLog, | ||
), | ||
) | ||
} |
15 changes: 15 additions & 0 deletions
15
src/main/kotlin/com/sbl/sulmun2yong/ai/domain/AIGenerateLog.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,15 @@ | ||
package com.sbl.sulmun2yong.ai.domain | ||
|
||
import java.util.UUID | ||
|
||
class AIGenerateLog( | ||
val id: UUID, | ||
val surveyId: UUID, | ||
val makerId: UUID?, | ||
val userPrompt: String, | ||
val fileUrl: String?, | ||
val target: String, | ||
val groupName: String, | ||
val generatedSurvey: AIGeneratedSurvey, | ||
val visitorId: String?, | ||
) |
50 changes: 50 additions & 0 deletions
50
src/main/kotlin/com/sbl/sulmun2yong/ai/entity/AIGenerateLogDocument.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,50 @@ | ||
package com.sbl.sulmun2yong.ai.entity | ||
|
||
import com.sbl.sulmun2yong.ai.domain.AIGenerateLog | ||
import com.sbl.sulmun2yong.ai.domain.AIGeneratedSurvey | ||
import com.sbl.sulmun2yong.global.entity.BaseTimeDocument | ||
import org.springframework.data.annotation.Id | ||
import org.springframework.data.mongodb.core.mapping.Document | ||
import java.util.UUID | ||
|
||
@Document(collection = "aiGenerateLogs") | ||
data class AIGenerateLogDocument( | ||
@Id | ||
val id: UUID, | ||
val surveyId: UUID, | ||
val makerId: UUID?, | ||
val userPrompt: String, | ||
val fileUrl: String?, | ||
val target: String, | ||
val groupName: String, | ||
val generatedSurvey: AIGeneratedSurvey, | ||
val visitorId: String?, | ||
) : BaseTimeDocument() { | ||
companion object { | ||
fun from(aIGenerateLog: AIGenerateLog) = | ||
AIGenerateLogDocument( | ||
id = aIGenerateLog.id, | ||
surveyId = aIGenerateLog.surveyId, | ||
makerId = aIGenerateLog.makerId, | ||
userPrompt = aIGenerateLog.userPrompt, | ||
fileUrl = aIGenerateLog.fileUrl, | ||
target = aIGenerateLog.target, | ||
groupName = aIGenerateLog.groupName, | ||
generatedSurvey = aIGenerateLog.generatedSurvey, | ||
visitorId = aIGenerateLog.visitorId, | ||
) | ||
} | ||
|
||
fun toDomain() = | ||
AIGenerateLog( | ||
id = this.id, | ||
surveyId = this.surveyId, | ||
makerId = this.makerId, | ||
userPrompt = this.userPrompt, | ||
fileUrl = this.fileUrl, | ||
target = this.target, | ||
groupName = this.groupName, | ||
generatedSurvey = this.generatedSurvey, | ||
visitorId = this.visitorId, | ||
) | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/kotlin/com/sbl/sulmun2yong/ai/repository/AIGenerateLogRepository.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,9 @@ | ||
package com.sbl.sulmun2yong.ai.repository | ||
|
||
import com.sbl.sulmun2yong.ai.entity.AIGenerateLogDocument | ||
import org.springframework.data.mongodb.repository.MongoRepository | ||
import org.springframework.stereotype.Component | ||
import java.util.UUID | ||
|
||
@Component | ||
interface AIGenerateLogRepository : MongoRepository<AIGenerateLogDocument, UUID> |
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