Skip to content

Commit

Permalink
Fix: user entity nullable false
Browse files Browse the repository at this point in the history
  • Loading branch information
bin-pro committed Jul 21, 2024
1 parent 0b4210a commit 87b466a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/main/java/com/blackshoe/esthete/entity/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class User {
@Column(columnDefinition = "BINARY(16)", name = "user_uuid", unique = true)
private UUID userId;

@Column(name = "profile_img_url", nullable = false, columnDefinition = "VARCHAR(250) default 'default'")
@Column(name = "profile_img_url", columnDefinition = "VARCHAR(250) default 'default'")
private String profileImgUrl;

@Column(name = "nickname")
Expand Down Expand Up @@ -57,9 +57,10 @@ public class User {
private List<Purchasing> purchasings = new ArrayList();

@Builder
public User(UUID userId, String nickname){
public User(UUID userId, String nickname,LocalDateTime createdAt) {
this.userId = userId;
this.nickname = nickname;
this.createdAt = createdAt;
}

public void setUserId(UUID userId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.util.List;
import java.util.UUID;

Expand Down Expand Up @@ -47,6 +48,7 @@ public void createUser(String payload, Acknowledgment acknowledgment) {

User user = User.builder()
.nickname(userCreate.getNickname())
.createdAt(LocalDateTime.now())
.build();

user.setUserId(userId);
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ CREATE TABLE IF NOT EXISTS `users` (
`user_id` BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
`user_uuid` BINARY(16) NOT NULL UNIQUE,
`profile_img_url` VARCHAR(250) NULL DEFAULT 'https://d1g6qszf7cmafu.cloudfront.net/default/profile.png',
`nickname` VARCHAR(50) NOT NULL,
`nickname` VARCHAR(50) NULL,
`created_at` DATETIME(6) NULL,
`updated_at` DATETIME(6) NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Expand Down

0 comments on commit 87b466a

Please sign in to comment.