Skip to content

Commit

Permalink
Merge pull request #77 from SWM-Flash/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
ChoiWonYu authored Oct 5, 2024
2 parents c08ff0b + af42399 commit 9fd2842
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@ jobs:
AWS_REGION: ap-northeast-2
run: |
aws elasticbeanstalk create-application-version --application-name flash-application-dev --version-label ${{ github.sha }} --source-bundle S3Bucket=$AWS_S3_BUCKET,S3Key="dev/Dockerrun-${{ github.sha }}.aws.json"
aws elasticbeanstalk update-environment --application-name flash-application-dev --environment-name Flash-application-dev-env --version-label ${{ github.sha }}
aws elasticbeanstalk update-environment --application-name flash-application-dev --environment-name Flash-application-dev-env-1 --version-label ${{ github.sha }}
2 changes: 1 addition & 1 deletion .github/workflows/prod.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI/CD
name: production CI/CD

on:
push:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.first.flash.account.member.application.MemberService;
import com.first.flash.account.member.domain.Member;
import com.first.flash.climbing.solution.application.dto.SolutionResponseDto;
import com.first.flash.climbing.solution.application.dto.UnregisteredMemberSolutionCreateRequest;
import com.first.flash.climbing.solution.domain.Solution;
import com.first.flash.climbing.solution.domain.SolutionRepository;
import com.first.flash.climbing.solution.domain.SolutionSavedEvent;
Expand Down Expand Up @@ -41,4 +42,18 @@ public void updateUploaderInfo(final UUID uploaderId, final String nickName,
final String instagramId, final String profileImageUrl) {
solutionRepository.updateUploaderInfo(uploaderId, nickName, instagramId, profileImageUrl);
}

@Transactional
public SolutionResponseDto saveUnregisteredMemberSolution(final UUID problemId,
final UnregisteredMemberSolutionCreateRequest requestDto) {
UUID id = AuthUtil.getId();
Member member = memberService.findById(id);

Solution solution = Solution.of(requestDto.nickName(), requestDto.review(),
requestDto.instagramId(), requestDto.videoUrl(), problemId, member.getId(),
requestDto.profileImageUrl());
Solution savedSolution = solutionRepository.save(solution);
Events.raise(SolutionSavedEvent.of(savedSolution.getProblemId()));
return SolutionResponseDto.toDto(savedSolution);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.first.flash.climbing.solution.application.dto;

import jakarta.validation.constraints.NotEmpty;

public record UnregisteredMemberSolutionCreateRequest(
@NotEmpty(message = "닉네임은 필수입니다.") String nickName,
@NotEmpty(message = "인스타그램 아이디는 필수입니다.") String instagramId,
String review, String profileImageUrl,
@NotEmpty(message = "비디오 URL은 필수입니다.") String videoUrl) {

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.first.flash.climbing.solution.application.dto.SolutionResponseDto;
import com.first.flash.climbing.solution.application.dto.SolutionUpdateRequestDto;
import com.first.flash.climbing.solution.application.dto.SolutionsResponseDto;
import com.first.flash.climbing.solution.application.dto.UnregisteredMemberSolutionCreateRequest;
import com.first.flash.climbing.solution.domain.dto.SolutionCreateRequestDto;
import com.first.flash.climbing.solution.infrastructure.dto.DetailSolutionDto;
import io.swagger.v3.oas.annotations.Operation;
Expand Down Expand Up @@ -101,6 +102,30 @@ public ResponseEntity<SolutionResponseDto> createSolution(@PathVariable final UU
solutionCreateRequestDto));
}

@Operation(summary = "없는 유저의 영상으로 해설 업로드", description = "없는 유저의 영상으로 해설 업로드")
@ApiResponses(value = {
@ApiResponse(responseCode = "201", description = "성공적으로 해설을 업로드함",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = SolutionResponseDto.class))),
@ApiResponse(responseCode = "400", description = "유효하지 않은 요청 형식",
content = @Content(mediaType = "application/json", examples = {
@ExampleObject(name = "요청값 누락", value = "{\"videoUrl\": \"비디오 URL은 필수입니다.\"}"),
})),
@ApiResponse(responseCode = "404", description = "문제를 찾을 수 없음",
content = @Content(mediaType = "application/json", examples = {
@ExampleObject(name = "문제 없음", value = "{\"error\": \"아이디가 0190c558-9063-7050-b4fc-eb421e3236b3인 문제를 찾을 수 없습니다.\"}")
}))
})
@PostMapping("admin/problems/{problemId}/solutions")
public ResponseEntity<SolutionResponseDto> createUnregisteredMemberSolution(
@PathVariable final UUID problemId,
@Valid @RequestBody final UnregisteredMemberSolutionCreateRequest createRequestDto) {

return ResponseEntity.status(HttpStatus.CREATED)
.body(
solutionSaveService.saveUnregisteredMemberSolution(problemId,
createRequestDto));
}

@Operation(summary = "해설 수정", description = "특정 해설 정보 수정")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "성공적으로 해설을 수정함",
Expand Down

0 comments on commit 9fd2842

Please sign in to comment.