Skip to content

Commit

Permalink
memo content 필드 변경 (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
kih00 authored Jan 27, 2025
1 parent b042f8e commit 22f1069
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class MemoEntity(
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
val id: Long? = null,
@Column(name = "content", nullable = false)
@Column(name = "content", nullable = false, columnDefinition = "LONGTEXT")
var content: String,
@Column(name = "locked", nullable = false)
var locked: Boolean = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class UserController(
@Operation(summary = "사용자 회원가입")
@PostMapping("/auth/register")
fun register(@RequestBody request: RegisterRequest): ResponseEntity<Unit> {
userService.register(request.email, request.password)
userService.register(request.email, request.password, request.nickname)
userService.sendCodeToEmail(request.email)
return ResponseEntity.status(HttpStatus.CREATED).build()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ package com.wafflestudio.toyproject.memoWithTags.user.dto
sealed class UserRequest {
data class RegisterRequest(
val email: String,
val password: String
val password: String,
val nickname: String
) : UserRequest()

data class VerifyEmailRequest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,16 @@ class UserService(
@Transactional
fun register(
email: String,
password: String
password: String,
nickname: String
): User {
if (userRepository.findByEmail(email) != null) throw EmailAlreadyExistsException()
val encryptedPassword = BCrypt.hashpw(password, BCrypt.gensalt())
// 메일 인증이 이루어지기 전까지 User의 verified 필드는 false이다.
val userEntity = userRepository.save(
UserEntity(
email = email,
nickname = nickname,
hashedPassword = encryptedPassword,
createdAt = Instant.now()
)
Expand Down

0 comments on commit 22f1069

Please sign in to comment.