-
Notifications
You must be signed in to change notification settings - Fork 0
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 #17 from AWS-Cloud-School-6/16-feat-member-keyclass
16 feat member keyclass
- Loading branch information
Showing
13 changed files
with
268 additions
and
143 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
13 changes: 13 additions & 0 deletions
13
src/main/java/AIWA/MCPBackend_Member/Dto/AddAwsAndGcpKeyRequestDto.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 AIWA.MCPBackend_Member.Dto; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
public class AddAwsAndGcpKeyRequestDto { | ||
private String email; | ||
private String accessKey; | ||
private String secretKey; | ||
private String gcpKeyContent; | ||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/AIWA/MCPBackend_Member/Dto/AiwaKeyResponseDto.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,25 @@ | ||
package AIWA.MCPBackend_Member.Dto; | ||
|
||
import AIWA.MCPBackend_Member.Entity.AiwaKey; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
public class AiwaKeyResponseDto { | ||
|
||
private String companyName; // 회사 이름 (AWS, GCP 등) | ||
private String accessKey; // Access Key (AWS의 경우만 있을 수 있음) | ||
private String secretKey; // Secret Key (AWS의 경우만 있을 수 있음) | ||
private String gcpKeyPath; // GCP Key Path (GCP의 경우만 있을 수 있음) | ||
|
||
// Entity -> DTO 변환 메서드 | ||
public static AiwaKeyResponseDto toDto(AiwaKey aiwaKey) { | ||
AiwaKeyResponseDto dto = new AiwaKeyResponseDto(); | ||
dto.setCompanyName(aiwaKey.getCompanyName()); | ||
dto.setAccessKey(aiwaKey.getAccessKey()); | ||
dto.setSecretKey(aiwaKey.getSecretKey()); | ||
dto.setGcpKeyPath(aiwaKey.getGcpKeyPath()); | ||
return dto; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
src/main/java/AIWA/MCPBackend_Member/Dto/DeleteKeyRequestDto.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,11 @@ | ||
package AIWA.MCPBackend_Member.Dto; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
public class DeleteKeyRequestDto { | ||
private Long memberId; | ||
private String companyName; // AWS 또는 GCP | ||
} |
19 changes: 0 additions & 19 deletions
19
src/main/java/AIWA/MCPBackend_Member/Dto/MemberCredentialDTO.java
This file was deleted.
Oops, something went wrong.
12 changes: 4 additions & 8 deletions
12
src/main/java/AIWA/MCPBackend_Member/Dto/MemberDeleteRequestDto.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 |
---|---|---|
@@ -1,14 +1,10 @@ | ||
package AIWA.MCPBackend_Member.Dto; | ||
|
||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@NoArgsConstructor // 기본 생성자 추가 | ||
@Setter | ||
public class MemberDeleteRequestDto { | ||
private String email; // final 제거 | ||
|
||
public MemberDeleteRequestDto(String email) { | ||
this.email = email; | ||
} | ||
} | ||
private String email; | ||
} |
14 changes: 5 additions & 9 deletions
14
src/main/java/AIWA/MCPBackend_Member/Dto/MemberRequestDto.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 |
---|---|---|
@@ -1,16 +1,12 @@ | ||
package AIWA.MCPBackend_Member.Dto; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
public class MemberRequestDto { | ||
private final String name; | ||
private final String password; | ||
private final String email; | ||
|
||
public MemberRequestDto(String name, String password, String email) { | ||
this.name = name; | ||
this.password = password; | ||
this.email = email; | ||
} | ||
private String name; | ||
private String email; | ||
private String password; | ||
} |
46 changes: 32 additions & 14 deletions
46
src/main/java/AIWA/MCPBackend_Member/Dto/MemberResponseDto.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 |
---|---|---|
@@ -1,22 +1,40 @@ | ||
package AIWA.MCPBackend_Member.Dto; | ||
|
||
|
||
import AIWA.MCPBackend_Member.Entity.Member; | ||
import lombok.Data; | ||
import AIWA.MCPBackend_Member.Entity.AiwaKey; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
@Data | ||
@Getter | ||
@Setter | ||
public class MemberResponseDto { | ||
private String userName; | ||
private String email; | ||
private String accessKey; | ||
|
||
public MemberResponseDto(String userName, String email, String accessKey) { | ||
this.userName = userName; | ||
this.email = email; | ||
this.accessKey = accessKey; | ||
} | ||
|
||
private Long id; // 회원 ID | ||
private String name; // 회원 이름 | ||
private String email; // 회원 이메일 | ||
|
||
@JsonIgnore // 비밀번호는 반환하지 않음 | ||
private String password; // 회원 비밀번호 | ||
|
||
private List<AiwaKeyResponseDto> aiwaKeys; // 회원이 관리하는 회사들의 키 정보 리스트 | ||
|
||
// Entity -> DTO 변환 메서드 | ||
public static MemberResponseDto toDto(Member member) { | ||
return new MemberResponseDto(member.getName(), member.getEmail(), member.getAccess_key()); | ||
MemberResponseDto memberResponseDto = new MemberResponseDto(); | ||
memberResponseDto.setId(member.getId()); | ||
memberResponseDto.setName(member.getName()); | ||
memberResponseDto.setEmail(member.getEmail()); | ||
memberResponseDto.setPassword(member.getPassword()); // 비밀번호는 필요 없다면 제외 가능 | ||
|
||
// AiwaKey 리스트를 AiwaKeyResponseDto 리스트로 변환 | ||
List<AiwaKeyResponseDto> aiwaKeyResponseDtoList = member.getAiwaKeys().stream() | ||
.map(AiwaKeyResponseDto::toDto) | ||
.collect(Collectors.toList()); | ||
memberResponseDto.setAiwaKeys(aiwaKeyResponseDtoList); | ||
|
||
return memberResponseDto; | ||
} | ||
} | ||
} |
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,37 @@ | ||
package AIWA.MCPBackend_Member.Entity; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
@Entity | ||
@Getter | ||
@Setter | ||
@NoArgsConstructor | ||
public class AiwaKey { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "aiwa_key_id") | ||
private Long id; | ||
|
||
@Column(nullable = false) | ||
private String companyName; | ||
|
||
private String accessKey; | ||
private String secretKey; | ||
private String gcpKeyPath; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "member_id") | ||
private Member member; | ||
|
||
public AiwaKey(String companyName, String accessKey, String secretKey, String gcpKeyPath, Member member) { | ||
this.companyName = companyName; | ||
this.accessKey = accessKey; | ||
this.secretKey = secretKey; | ||
this.gcpKeyPath = gcpKeyPath; | ||
this.member = member; | ||
} | ||
} |
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
Oops, something went wrong.