-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/14 user entity #30
base: dev
Are you sure you want to change the base?
Conversation
fix : κ΅¬κΈ μ€νμΌ νμμ λ§κ² μμ
@devmelonlee @dongyoungs Conflictsλ¬Έμ ν΄κ²°ν΄μ£ΌμΈμ~ |
// μ€μ¨κ±° μ μ μΌμ μ μ μμ΄λ 0 λ°ν | ||
return 0L; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
κ΅Ώκ΅Ώ μ’μ΅λλ€
@GetMapping("/create") | ||
public void createDevUser(@RequestParam String email, @RequestParam String password) { | ||
log.info("email, password : " + email + " " + password); | ||
|
||
UserCreateDTO userCreateDTO = new UserCreateDTO(email, password); | ||
devLoginService.execute(userCreateDTO); | ||
|
||
// model.addAttribute("email", email); | ||
// model.addAttribute("password",password); | ||
|
||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RequestParamμΌλ‘ κ°μ΄ λκ°λ λ€μ΄κ°λ κ²μ μ’μ§ μμ΅λλ€
passwordλ λλμ± uriμ νμλλ©΄ μ’μ§ μκ² μ£
email, passwordλ₯Ό νλμ DTOλ‘ λ°λλ€λ©΄ μ’κ² μ£ ?
dto ν¨ν€μ§μ UserCreateRequestμ κ°μ μ΄λ¦μ DTOλ₯Ό λ§λ€μ΄ λ°μ보μΈμ!
tify νλ‘μ νΈμ PostFavorAnswerRequest ν΄λμ€λ₯Ό μ°Έκ³ ν΄λ³΄μΈμ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
λ€ μ°Έκ³ νκ² μ΅λλ€
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
νμΈνμ΅λλ€ μΆν API ν리νμ€νΈμ λ°μν΄μ μ¬λ¦¬κ² μ΅λλ€
public class UserCreateDTO { | ||
private final String email; | ||
private final String password; | ||
|
||
// @QueryProjection | ||
public UserCreateDTO(String email, String password) { | ||
this.email = email; | ||
this.password = password; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μ’μ΅λλ€
μμμ λ§ν UserCreateRequestμμ ν΅ν©μ κ³ λ €ν΄λ³΄μΈμ
public void execute(UserCreateDTO userCreateDTO) { | ||
User user = | ||
User.builder() | ||
.email(userCreateDTO.getEmail()) | ||
.password(userCreateDTO.getPassword()) | ||
.role(AccountRole.ADMIN) | ||
.build(); | ||
userAdaptor.save(user); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@builder ν¨ν΄μΌλ‘ ꡬνν κ² μ’μ΅λλ€
public class UserUtils { | ||
|
||
private final UserAdaptor userAdaptor; | ||
|
||
public Long getUserId() { | ||
return SecurityUtils.getCurrentUserId(); | ||
} | ||
|
||
public User getUser() { | ||
return userAdaptor.query(SecurityUtils.getCurrentUserId()); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Utils classλ‘ μμ£Ό μ¨μΌνλ λ©μλλ₯Ό λ°λ‘ ꡬνν΄λμ κ² μ’λ€μ
@Getter | ||
@MappedSuperclass | ||
@EntityListeners(value = {AuditingEntityListener.class}) | ||
public abstract class AbstractTimeStamp { | ||
|
||
@Column( | ||
name = "created_at", | ||
nullable = false, | ||
columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | ||
@CreationTimestamp | ||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd hh:mm:ss") | ||
private Timestamp createdAt; | ||
|
||
@Column( | ||
name = "updated_at", | ||
nullable = false, | ||
columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | ||
@UpdateTimestamp | ||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd hh:mm:ss") | ||
private Timestamp updatedAt; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AbstractTimeStamp μΆμν΄λμ€λ₯Ό μ΄μ©ν΄μ
μ΄λ€ κΈ°λ₯μ ꡬνν κ±ΈκΉμ?
|
||
@Getter | ||
@Entity | ||
@Table(name = "user") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
λͺ¨λ Table μ΄λ¦μ κ²½μ° mysql optionκ³Ό κ²ΉμΉ μνμ μ€μ΄κ³
ν΅μΌμ±μ μν΄
tbl_user
μ κ°μ΄ μμ ν΄μ£ΌμΈμ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
λ€ μμ νκ² μ΅λλ€.
@Enumerated(EnumType.ORDINAL) | ||
@Column(nullable = false, name = "role", columnDefinition = "varchar(32) default 'USER'") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enum νμ μ΄ mysqlμμ varcharλ‘ λ³νμ§ μλ κ²μ μ΄λ°μμΌλ‘ μ€λ₯λ₯Ό μ‘λ κ² μ’μ΅λλ€.
boolean etc_param1; | ||
|
||
boolean etc_param2; | ||
|
||
boolean etc_param3; | ||
|
||
boolean etc_param4; | ||
|
||
boolean etc_param5; | ||
|
||
boolean etc_param6; | ||
|
||
boolean etc_param7; | ||
|
||
boolean etc_param8; | ||
|
||
boolean etc_param9; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μ μ΄λΆλΆμ μ£Όμμ²λ¦¬λ₯Ό λ¨Όμ ν΄λλκ²....
μ΄λ¨μ§?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
λ€!
@Column( | ||
name = "updated_at", | ||
nullable = false, | ||
columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | ||
@UpdateTimestamp | ||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd hh:mm:ss") | ||
private Timestamp createdAt; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μ΄ μ½λκ° μ λ¦¬λ·°λ€ μ€ μ΄λ€ νλμ λ΅μ΄ λ μ μκ² λ€μ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
γ γ γ λ΅!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μ κΈνκ²νλλΌ κΈ°κ» μΆμν΄λμ€ λ§λ κ±° κ°κ³Όνλ€μ μμ νκ² μ΅λλ€
private LoginType loginType; | ||
|
||
@NotNull | ||
@Column(name = "fail_cnt", nullable = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
컬λΌμ μ΄λ¦κ°μ κ²½μ° μΉ΄λ©μΌμ΄μ€λ₯Ό μλμΌλ‘ λ°κΏμ£ΌκΈ° λλ¬Έμ μ΄λ κ² λ€ μΈ νμλ μλ΅λλ€
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
νμΈνμ΅λλ€
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
νμΈνμ΅λλ€
π PR Summary
μ μ κ΄λ ¨ μν°ν° μΆκ°
π² Working Branch
feat/ user
π² TODOs
κ°λ°μ© μ μ μμ± API μΆκ°
Related Issues