Skip to content

Commit

Permalink
refactor: change type of CommentsAddDTO#copilotId from String to Long
Browse files Browse the repository at this point in the history
  • Loading branch information
Handiwork committed Feb 22, 2024
1 parent c77be4f commit 22856f5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ data class CommentsAddDTO(
@field:NotBlank(message = "请填写评论内容")
val message: String,
// 评论的作业id
@field:NotBlank(message = "作业id不可为空")
val copilotId: String,
val copilotId: Long,
// 子评论来源评论id(回复评论)
val fromCommentId: String? = null,
val notification: Boolean = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class CommentsAreaService(
* @param commentsAddDTO CommentsRequest
*/
fun addComments(userId: String, commentsAddDTO: CommentsAddDTO) {
val copilotId = commentsAddDTO.copilotId.toLong()
val copilotId = commentsAddDTO.copilotId
val message = commentsAddDTO.message
val copilotOptional = copilotRepository.findByCopilotId(copilotId)
Assert.isTrue(StringUtils.isNotBlank(message), "评论不可为空")
Expand Down Expand Up @@ -171,8 +171,10 @@ class CommentsAreaService(
val dislikeCountChange: Long

val ratingOptional =
ratingRepository.findByTypeAndKeyAndUserId(Rating.KeyType.COMMENT,
commentsArea.id!!, userId)
ratingRepository.findByTypeAndKeyAndUserId(
Rating.KeyType.COMMENT,
commentsArea.id!!, userId
)
// 判断该用户是否存在评分
if (ratingOptional != null) {
// 如果评分发生变化则更新
Expand Down

0 comments on commit 22856f5

Please sign in to comment.