Skip to content

Commit

Permalink
Merge pull request #33 from SafeNet-2024/feature/add-security
Browse files Browse the repository at this point in the history
[refactor] ์—”ํ‹ฐํ‹ฐ ์ปฌ๋Ÿผ ์ˆ˜์ • ๋ฐ message ์ €์žฅ์‹œ receiver ์ €์žฅ
  • Loading branch information
Yeon-chae authored Jun 13, 2024
2 parents c541df3 + f2b1fec commit 7c5331b
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,14 @@
public class File {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "files_id")
@Column(name = "file_id")
private Long id;

@Enumerated(EnumType.STRING)
@Column(name = "file_type", nullable = false)
@Column(nullable = false)
private FileType fileType;

@Lob
@Column(nullable = false)
private String fileUrl;

@CreationTimestamp
@Column(name = "created_at", nullable = false, updatable = false)
private LocalDateTime createdAt;
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
@Entity
@Table(name = "member")
public class Member extends BaseTimeEntity implements UserDetails {
@Getter
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "member_id")
Expand All @@ -40,10 +41,9 @@ public class Member extends BaseTimeEntity implements UserDetails {
@Column(name = "name", nullable = false, unique = true, length = 100)
private String name;

@Column(name = "phoneNumber")
private String phoneNumber;

@Column(name = "pwd",nullable = false)
@Column(nullable = false)
@NotNull
private String pwd;

Expand All @@ -69,10 +69,6 @@ public class Member extends BaseTimeEntity implements UserDetails {
@JsonIgnore
private List<PostLike> postLikeList;

public Long getId() {
return id;
}

public void updateProfile(String name, String phoneNumber, String password, Region region) {
this.name = name;
this.phoneNumber = phoneNumber;
Expand All @@ -89,25 +85,30 @@ public Collection<? extends GrantedAuthority> getAuthorities() {
public String getPassword() {
return this.pwd;
}

@Override
public String getUsername() {
return this.email;
}

// ๊ณ„์ • ๋งŒ๋ฃŒ๋˜์—ˆ๋Š”์ง€ (true - ๋งŒ๋ฃŒ ์•ˆ๋จ)
@Override
public boolean isAccountNonExpired() {
return true;
}

// ๊ณ„์ • ์ž ๊ฒจ์žˆ๋Š”์ง€ (true - ์•ˆ์ž ๊น€)
@Override
public boolean isAccountNonLocked() {
return true;
}

// ๊ณ„์ • ๋น„๋ฐ€๋ฒˆํ˜ธ ๋งŒ๋ฃŒ๋˜์—ˆ๋Š”์ง€ (true - ๋งŒ๋ฃŒ X)
@Override
public boolean isCredentialsNonExpired() {
return true;
}

// ๊ณ„์ • ํ™œ์„ฑํ™” ์ƒํƒœ์ธ์ง€ (true - ํ™œ์„ฑํ™”)
@Override
public boolean isEnabled() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public class Message {
@Column(nullable = false)
private String sender;

private String receiver;
// @Column(nullable = false)
// private String receiver;

@Column(nullable = false)
private String message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ public void handleMessage(String roomId, String username, MessageDto messageDto)
.sender(messageDto.getSender())
.roomId(messageDto.getRoomId())
.message(messageDto.getMessage())
.sentTime(LocalDateTime.now().toString())
.build();

// Websocket์— ๋ฐœํ–‰๋œ ๋ฉ”์‹œ์ง€๋ฅผ redis๋กœ ๋ฐœํ–‰ํ•œ๋‹ค(publish)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class Post {
private LocalDateTime created;

@UpdateTimestamp
@Column(nullable = false)
@Column(name = "updated_at")
private LocalDateTime updated;

@Enumerated(EnumType.STRING)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ public class PostLike {

@CreationTimestamp
@Column(name = "created_at", nullable = false, updatable = false)
private LocalDateTime createdAt;
private LocalDateTime created;

@UpdateTimestamp
@Column(nullable = false)
@Column(name = "updated_at")
private LocalDateTime updated;

@ManyToOne(fetch = LAZY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ public class Region {
@Column(name = "region_id")
private Long id;

@Column(length = 30, nullable = false)
@Column(length = 50, nullable = false)
private String city;

@Column(length = 30)
@Column(length = 50)
private String county;

@Column(length = 30)
@Column(length = 50)
private String district;

@OneToMany(mappedBy = "region", cascade = CascadeType.ALL, orphanRemoval = true)
Expand Down

0 comments on commit 7c5331b

Please sign in to comment.