Skip to content

Commit

Permalink
fix : rename variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
nookcoder committed Aug 9, 2023
1 parent b47a114 commit 8d9ca9f
Showing 1 changed file with 73 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,18 @@ public AwsBluePrintDto getAwsBlueprint(String uuid) {
throw new RuntimeException("awsBluePrintById is null");
}

List<AwsArea> awsAreas = awsAreaRepository.findAllByBluePrint(awsBluePrintById);
List<AwsComponent> awsComponents = awsComponentRepository.findAllByBluePrint(awsBluePrintById);
List<ComponentLine> componentLines = componentLineRepository.findAllByBluePrint(awsBluePrintById);
AwsBluePrintDto awsBluePrintDto = new AwsBluePrintDto();
awsBluePrintDto.setName(awsBluePrintById.getName());
awsBluePrintDto.setStatus(awsBluePrintById.getStatus());
awsBluePrintDto.setUuid(awsBluePrintById.getUuid());
awsBluePrintDto.setAreas(AwsBluePrintDto.awsAreaDtosMapper(awsAreas));
awsBluePrintDto.setComponents(AwsBluePrintDto.awsComponentDtosMapper(awsComponents));
awsBluePrintDto.setLinks(AwsBluePrintDto.componentLinkDtoListMapper(componentLines));
return awsBluePrintDto;
}
List<AwsArea> awsAreas = awsAreaRepository.findAllByBluePrint(awsBluePrintById);
List<AwsComponent> awsComponents = awsComponentRepository.findAllByBluePrint(awsBluePrintById);
List<ComponentLine> componentLines = componentLineRepository.findAllByBluePrint(awsBluePrintById);
AwsBluePrintDto awsBluePrintDto = new AwsBluePrintDto();
awsBluePrintDto.setName(awsBluePrintById.getName());
awsBluePrintDto.setStatus(awsBluePrintById.getStatus());
awsBluePrintDto.setUuid(awsBluePrintById.getUuid());
awsBluePrintDto.setAreas(AwsBluePrintDto.awsAreaDtosMapper(awsAreas));
awsBluePrintDto.setComponents(AwsBluePrintDto.awsComponentDtosMapper(awsComponents));
awsBluePrintDto.setLinks(AwsBluePrintDto.componentLinkDtoListMapper(componentLines));
return awsBluePrintDto;
}

@Override
public List<AwsBluePrintListDto> getMyAwsBlueprints(String oauthId) {
Expand All @@ -79,20 +79,20 @@ public List<AwsBluePrintListDto> getMyAwsBlueprints(String oauthId) {
throw new RuntimeException("member is null");
}

List<AwsBluePrint> awsBluePrints = awsBluePrintRepository.findAwsBluePrintsByMember(member);
List<AwsBluePrintListDto> awsBluePrintDtos = new ArrayList<>();
for (AwsBluePrint awsBluePrint : awsBluePrints) {
AwsBluePrintListDto dto = new AwsBluePrintListDto();
dto.setName(awsBluePrint.getName());
dto.setUuid(awsBluePrint.getUuid());
dto.setId(awsBluePrint.getId());
dto.setCreatedAt(awsBluePrint.getCreated_at());
dto.setStatus(awsBluePrint.getStatus());
dto.setPresignedUrl(awsS3Helper.getPresignedUrl(awsBluePrint.getKeyName()));
awsBluePrintDtos.add(dto);
}
return awsBluePrintDtos;
}
List<AwsBluePrint> awsBluePrints = awsBluePrintRepository.findAwsBluePrintsByMember(member);
List<AwsBluePrintListDto> awsBluePrintDtos = new ArrayList<>();
for (AwsBluePrint awsBluePrint : awsBluePrints) {
AwsBluePrintListDto dto = new AwsBluePrintListDto();
dto.setName(awsBluePrint.getName());
dto.setUuid(awsBluePrint.getUuid());
dto.setId(awsBluePrint.getId());
dto.setCreatedAt(awsBluePrint.getCreated_at());
dto.setStatus(awsBluePrint.getStatus());
dto.setPresignedUrl(awsS3Helper.getPresignedUrl(awsBluePrint.getKeyName()));
awsBluePrintDtos.add(dto);
}
return awsBluePrintDtos;
}

@Override
public void store(AwsBluePrintDto awsBluePrintDto, String provision, String userId) throws JsonProcessingException {
Expand Down Expand Up @@ -129,53 +129,53 @@ public boolean delete(String uuid) {
return true;
}

@Override
public boolean updateBluePrintScope(BluePrintScope scope, String uuid, String userId) {
AwsBluePrint awsBluePrintByUuid = awsBluePrintRepository.findAwsBluePrintByUuid(uuid);
if (awsBluePrintByUuid == null || !awsBluePrintByUuid.getMember().getOauthId().equals(userId)) {
return false;
}
awsBluePrintByUuid.setScope(scope);
awsBluePrintRepository.save(awsBluePrintByUuid);
return true;
}

// Blueprint 저장
private AwsBluePrint saveBlueprint(AwsBluePrintDto awsBluePrintDto, String provision, String userId) {
Member member = memberRepository.findMemberByOauthId(userId);
ProvisionStatus status;
if (parseBoolean(provision)) {
status = ProvisionStatus.PROVISIONING;
} else {
status = ProvisionStatus.PENDING;
}
// BluePrint 저장
String keyname = saveThumbnail(awsBluePrintDto, member);// thumbnail 저장

AwsBluePrint awsBluePrint = new AwsBluePrint();
awsBluePrint.setUuid(awsBluePrintDto.getUuid());
awsBluePrint.setName(awsBluePrintDto.getName());
awsBluePrint.setStatus(status);
awsBluePrint.setMember(member);
awsBluePrint.setScope(BluePrintScope.PRIVATE);
awsBluePrint.setKeyName(keyname);

return awsBluePrintRepository.save(awsBluePrint);
}

// thumbnail 저장
private String saveThumbnail(AwsBluePrintDto bluePrint, Member member) {
String objectKey = _getObjectKey(member.getOauthId(), bluePrint.getUuid());
try {
byte[] svgContent = Base64.getDecoder().decode(awsBluePrintDto.getSvgFile());
MultipartFile svgFile = new MockMultipartFile("file", objectKey, "image/svg+xml", svgContent);
awsS3Helper.putS3Object(svgFile, objectKey);
} catch (Exception e) {
logger.error("thumbnail upload failed: {}", e.getMessage());
}

return objectKey;
}
@Override
public boolean updateBluePrintScope(BluePrintScope scope, String uuid, String userId) {
AwsBluePrint awsBluePrintByUuid = awsBluePrintRepository.findAwsBluePrintByUuid(uuid);
if (awsBluePrintByUuid == null || !awsBluePrintByUuid.getMember().getOauthId().equals(userId)) {
return false;
}
awsBluePrintByUuid.setScope(scope);
awsBluePrintRepository.save(awsBluePrintByUuid);
return true;
}

// Blueprint 저장
private AwsBluePrint saveBlueprint(AwsBluePrintDto awsBluePrintDto, String provision, String userId) {
Member member = memberRepository.findMemberByOauthId(userId);
ProvisionStatus status;
if (parseBoolean(provision)) {
status = ProvisionStatus.PROVISIONING;
} else {
status = ProvisionStatus.PENDING;
}
// BluePrint 저장
String keyname = saveThumbnail(awsBluePrintDto, member);// thumbnail 저장

AwsBluePrint awsBluePrint = new AwsBluePrint();
awsBluePrint.setUuid(awsBluePrintDto.getUuid());
awsBluePrint.setName(awsBluePrintDto.getName());
awsBluePrint.setStatus(status);
awsBluePrint.setMember(member);
awsBluePrint.setScope(BluePrintScope.PRIVATE);
awsBluePrint.setKeyName(keyname);

return awsBluePrintRepository.save(awsBluePrint);
}

// thumbnail 저장
private String saveThumbnail(AwsBluePrintDto bluePrint, Member member) {
String objectKey = _getObjectKey(member.getOauthId(), bluePrint.getUuid());
try {
byte[] svgContent = Base64.getDecoder().decode(bluePrint.getSvgFile());
MultipartFile svgFile = new MockMultipartFile("file", objectKey, "image/svg+xml", svgContent);
awsS3Helper.putS3Object(svgFile, objectKey);
} catch (Exception e) {
logger.error("thumbnail upload failed: {}", e.getMessage());
}

return objectKey;
}

// ComponentLine 저장
private void saveComponentLines(AwsBluePrint blueprint, List<ComponentLineDto> lines) {
Expand Down

0 comments on commit 8d9ca9f

Please sign in to comment.