-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from kakao-tech-campus-2nd-step3/develop
3주차 develop -> master
- Loading branch information
Showing
40 changed files
with
1,844 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/main/java/com/example/team1_be/DTO/AttendUrlResponseDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.example.team1_be.DTO; | ||
|
||
public class AttendUrlResponseDTO { | ||
String attendUrl; | ||
|
||
public String getAttendUrl() { | ||
return attendUrl; | ||
} | ||
|
||
public void setAttendUrl(String attendUrl) { | ||
this.attendUrl = attendUrl; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
package com.example.team1_be.DTO; | ||
|
||
import com.example.team1_be.entity.UserEntity; | ||
import java.util.Collection; | ||
import java.util.Collections; | ||
import java.util.Map; | ||
import org.springframework.security.core.GrantedAuthority; | ||
import org.springframework.security.core.authority.SimpleGrantedAuthority; | ||
import org.springframework.security.core.userdetails.UserDetails; | ||
import org.springframework.security.oauth2.core.user.OAuth2User; | ||
|
||
public class AuthDTO { | ||
|
||
// OAuth2에서 가져온 유저 정보 | ||
public static class OAuthAttributes { | ||
|
||
private Map<String, Object> attributes; | ||
private String nameAttributeKey; | ||
private String name; | ||
private String email; | ||
private String picture; | ||
|
||
public OAuthAttributes(Map<String, Object> attributes, String nameAttributeKey, String name, | ||
String email, | ||
String picture) { | ||
this.attributes = attributes; | ||
this.nameAttributeKey = nameAttributeKey; | ||
this.name = name; | ||
this.email = email; | ||
this.picture = picture; | ||
} | ||
|
||
public Map<String, Object> getAttributes() { | ||
return attributes; | ||
} | ||
|
||
public String getNameAttributeKey() { | ||
return nameAttributeKey; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public String getEmail() { | ||
return email; | ||
} | ||
|
||
public String getPicture() { | ||
return picture; | ||
} | ||
|
||
public static OAuthAttributes ofGoogle(String usernameAttributeName, | ||
Map<String, Object> attributes) { | ||
return new OAuthAttributes(attributes, usernameAttributeName, | ||
(String) attributes.get("name"), (String) attributes.get("email"), | ||
(String) attributes.get("picture")); | ||
} | ||
} | ||
|
||
// OAuth2User 반환용 | ||
public record PrincipalDetails( | ||
UserEntity user, | ||
Map<String, Object> attributes, | ||
String attributeKey) implements OAuth2User, UserDetails { | ||
|
||
public UserEntity getUser() { | ||
return user; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return attributes.get(attributeKey).toString(); | ||
} | ||
|
||
@Override | ||
public Map<String, Object> getAttributes() { | ||
return attributes; | ||
} | ||
|
||
@Override | ||
public Collection<? extends GrantedAuthority> getAuthorities() { | ||
return Collections.singletonList( | ||
new SimpleGrantedAuthority(user.getRole().getKey())); | ||
} | ||
|
||
@Override | ||
public String getPassword() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public String getUsername() { | ||
return user.getRole().getKey(); | ||
} | ||
|
||
@Override | ||
public boolean isAccountNonExpired() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean isAccountNonLocked() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean isCredentialsNonExpired() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean isEnabled() { | ||
return true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
package com.example.team1_be.DTO; | ||
|
||
import com.example.team1_be.entity.Guest; | ||
import com.example.team1_be.entity.ProjectOption; | ||
import com.example.team1_be.entity.User; | ||
import com.example.team1_be.util.page.PageParam; | ||
import java.time.LocalDateTime; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class ProjectDTO { | ||
|
||
public static class getList extends PageParam { | ||
|
||
} | ||
|
||
public static class create { | ||
|
||
private String name; | ||
|
||
private Object viewType; | ||
|
||
private Integer isDelete; | ||
|
||
private User user; | ||
|
||
private List<Guest> guests; | ||
|
||
private List<ProjectOption> options; | ||
|
||
private LocalDateTime startDate; | ||
|
||
private LocalDateTime endDate; | ||
|
||
public create() { | ||
} | ||
|
||
public create(String name, Object viewType, Integer isDelete, User user, | ||
LocalDateTime startDate, | ||
LocalDateTime endDate, | ||
List<Guest> guests, | ||
List<ProjectOption> options) { | ||
this.name = name; | ||
this.viewType = viewType; | ||
this.isDelete = isDelete; | ||
this.user = user; | ||
this.startDate = startDate; | ||
this.endDate = endDate; | ||
|
||
if (guests == null) { | ||
this.guests = new ArrayList<>(); | ||
} else { | ||
this.guests = guests; | ||
} | ||
|
||
if (options == null) { | ||
this.options = new ArrayList<>(); | ||
} else { | ||
this.options = options; | ||
} | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public Object getViewType() { | ||
return viewType; | ||
} | ||
|
||
public Integer getIsDelete() { | ||
return isDelete; | ||
} | ||
|
||
public User getUser() { | ||
return user; | ||
} | ||
|
||
public List<Guest> getGuests() { | ||
return guests; | ||
} | ||
|
||
public List<ProjectOption> getOptions() { | ||
return options; | ||
} | ||
|
||
public LocalDateTime getStartDate() { | ||
return startDate; | ||
} | ||
|
||
public LocalDateTime getEndDate() { | ||
return endDate; | ||
} | ||
|
||
} | ||
|
||
public static class update { | ||
|
||
private String name; | ||
|
||
private Object viewType; | ||
|
||
private User user; | ||
|
||
private List<Guest> guests; | ||
|
||
private List<ProjectOption> options; | ||
|
||
private LocalDateTime startDate; | ||
|
||
private LocalDateTime endDate; | ||
|
||
public update() { | ||
} | ||
|
||
public update(String name, Object viewType, User user, | ||
LocalDateTime startDate, | ||
LocalDateTime endDate, | ||
List<Guest> guests, | ||
List<ProjectOption> options) { | ||
this.name = name; | ||
this.viewType = viewType; | ||
this.user = user; | ||
this.startDate = startDate; | ||
this.endDate = endDate; | ||
|
||
if (guests == null) { | ||
this.guests = new ArrayList<>(); | ||
} else { | ||
this.guests = guests; | ||
} | ||
|
||
if (options == null) { | ||
this.options = new ArrayList<>(); | ||
} else { | ||
this.options = options; | ||
} | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public Object getViewType() { | ||
return viewType; | ||
} | ||
|
||
public User getUser() { | ||
return user; | ||
} | ||
|
||
public List<Guest> getGuests() { | ||
return guests; | ||
} | ||
|
||
public List<ProjectOption> getOptions() { | ||
return options; | ||
} | ||
|
||
public LocalDateTime getStartDate() { | ||
return startDate; | ||
} | ||
|
||
public LocalDateTime getEndDate() { | ||
return endDate; | ||
} | ||
|
||
} | ||
|
||
} | ||
|
Oops, something went wrong.