Skip to content
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

Open
wants to merge 8 commits into
base: dev
Choose a base branch
from
Open

Feat/14 user entity #30

wants to merge 8 commits into from

Conversation

dongyoungs
Copy link

@dongyoungs dongyoungs commented Sep 15, 2023

πŸ“ PR Summary

μœ μ € κ΄€λ ¨ μ—”ν„°ν‹° μΆ”κ°€

🌲 Working Branch

feat/ user

🌲 TODOs

개발용 μœ μ € 생성 API μΆ”κ°€

Related Issues

@donsonioc2010
Copy link
Member

@devmelonlee @dongyoungs Conflicts문제 ν•΄κ²°ν•΄μ£Όμ„Έμš”~

// μŠ€μ›¨κ±° μœ μ €μΌμ‹œ μœ μ € 아이디 0 λ°˜ν™˜
return 0L;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

κ΅Ώκ΅Ώ μ’‹μŠ΅λ‹ˆλ‹€

Comment on lines +21 to +32
@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);

}
}
Copy link
Contributor

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 클래슀λ₯Ό μ°Έκ³ ν•΄λ³΄μ„Έμš”

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

λ„€ μ°Έκ³ ν•˜κ² μŠ΅λ‹ˆλ‹€

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ν™•μΈν–ˆμŠ΅λ‹ˆλ‹€ μΆ”ν›„ API ν”Œλ¦¬ν€˜μŠ€νŠΈμ‹œ λ°˜μ˜ν•΄μ„œ μ˜¬λ¦¬κ² μŠ΅λ‹ˆλ‹€

Comment on lines +7 to +16
public class UserCreateDTO {
private final String email;
private final String password;

// @QueryProjection
public UserCreateDTO(String email, String password) {
this.email = email;
this.password = password;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

μ’‹μŠ΅λ‹ˆλ‹€
μœ„μ—μ„œ λ§ν•œ UserCreateRequestμ™€μ˜ 톡합을 κ³ λ €ν•΄λ³΄μ„Έμš”

Comment on lines +18 to +26
public void execute(UserCreateDTO userCreateDTO) {
User user =
User.builder()
.email(userCreateDTO.getEmail())
.password(userCreateDTO.getPassword())
.role(AccountRole.ADMIN)
.build();
userAdaptor.save(user);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@builder νŒ¨ν„΄μœΌλ‘œ κ΅¬ν˜„ν•œ 것 μ’‹μŠ΅λ‹ˆλ‹€

Comment on lines +10 to +21
public class UserUtils {

private final UserAdaptor userAdaptor;

public Long getUserId() {
return SecurityUtils.getCurrentUserId();
}

public User getUser() {
return userAdaptor.query(SecurityUtils.getCurrentUserId());
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Utils class둜 자주 μ¨μ•Όν•˜λŠ” λ©”μ†Œλ“œλ₯Ό λ”°λ‘œ κ΅¬ν˜„ν•΄λ†“μ€ 것 μ’‹λ„€μš”

Comment on lines +14 to +34
@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;
}
Copy link
Contributor

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")
Copy link
Contributor

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와 같이 μˆ˜μ •ν•΄μ£Όμ„Έμš”

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

λ„€ μˆ˜μ •ν•˜κ² μŠ΅λ‹ˆλ‹€.

Comment on lines +28 to +29
@Enumerated(EnumType.ORDINAL)
@Column(nullable = false, name = "role", columnDefinition = "varchar(32) default 'USER'")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enum νƒ€μž…μ΄ mysqlμ—μ„œ varchar둜 λ³€ν•˜μ§€ μ•ŠλŠ” 것을 μ΄λŸ°μ‹μœΌλ‘œ 였λ₯˜λ₯Ό μž‘λŠ” 것 μ’‹μŠ΅λ‹ˆλ‹€.

Comment on lines 24 to 40
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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

음 이뢀뢄은 μ£Όμ„μ²˜λ¦¬λ₯Ό λ¨Όμ € ν•΄λ†“λŠ”κ²Œ....
어떨지?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

λ„€!

Comment on lines +42 to +48
@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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 μ½”λ“œκ°€ μœ„ 리뷰듀 쀑 μ–΄λ–€ ν•˜λ‚˜μ˜ 닡이 될 수 μžˆκ² λ„€μš”

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

γ…Žγ…Žγ…Žλ„΅!

Copy link
Author

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

컬럼의 이름같은 경우 μΉ΄λ©œμΌ€μ΄μŠ€λ₯Ό μžλ™μœΌλ‘œ λ°”κΏ”μ£ΌκΈ° λ•Œλ¬Έμ— μ΄λ ‡κ²Œ λ‹€ μ“Έ ν•„μš”λŠ” μ—†λ‹΅λ‹ˆλ‹€

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ν™•μΈν–ˆμŠ΅λ‹ˆλ‹€

Copy link
Contributor

@devmelonlee devmelonlee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ν™•μΈν–ˆμŠ΅λ‹ˆλ‹€

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants