Skip to content

Commit

Permalink
refactor: DTO to Record Type
Browse files Browse the repository at this point in the history
  • Loading branch information
U-Geon committed Oct 14, 2024
1 parent 191b912 commit ff2f092
Showing 7 changed files with 26 additions and 27 deletions.
27 changes: 16 additions & 11 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -49,14 +49,19 @@ jobs:
docker build -t ${{ secrets.DOCKER_USER }}/wssrs .
docker push ${{ secrets.DOCKER_USER }}/wssrs
- name: Deploy to EC2
uses: appleboy/ssh-action@master
with:
key: ${{ secrets.EC2_PRIVATE_KEY }} # pem key
host: ${{ secrets.EC2_HOST }} # ec2 ip
username: ${{ secrets.EC2_USER }} # ec2에서 whoami 명령어로 확인
script: |
sudo docker rm -f $(sudo docker ps -q) || true
sudo docker pull ${{ secrets.DOCKER_REPOSITORY }}/${{ secrets.DOCKER_IMAGE }}
sudo docker system prune -f
sudo docker run -d --rm -p 8080:8080 ${{ secrets.DOCKER_REPOSITORY }} / ${{ secrets.DOCKER_IMAGE }}
run-docker-image-on-ec2:
needs: application-build
runs-on: self-hosted

steps:
- name: docker pull
run: sudo docker pull ${{ secrets.DOCKER_USER }}/wssrs:latest

- name: docker stop container
run: sudo docker stop clerker:latest || true

- name: docker run new container
run: sudo docker run --name github-actions-demo --rm -d -p 8080:8080 ${{ secrets.DOCKER_USER }}/wssrs:latest

- name: delete old docker image
run: sudo docker image prune -f
Original file line number Diff line number Diff line change
@@ -84,7 +84,7 @@ public ResponseEntity<PasswordUpdateResponseDTO> updatePassword(
public ResponseEntity<ReissueAccessTokenResponseDTO> reissueAccessToken(
@RequestBody @Valid ReissueAccessTokenRequestDTO requestDTO,
@AuthenticationPrincipal Member member) {
return ResponseEntity.ok().body(authService.reissueAccessToken(requestDTO.getRefreshToken(), member));
return ResponseEntity.ok().body(authService.reissueAccessToken(requestDTO.refreshToken(), member));
}

// logout
Original file line number Diff line number Diff line change
@@ -2,10 +2,7 @@

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import lombok.Getter;
import lombok.Setter;

@Getter @Setter
public record PasswordUpdateRequestDTO(
@Pattern(regexp = "^(?=.*[a-zA-Z])(?=.*\\d)(?=.*[~!@#$%^&*()_+`\\-={}|:\";'<>?,./]).{8,}$", message = "영문자, 숫자, 특수문자를 각각 최소 1개 이상 사용해주세요.")
@NotBlank(message = "비밀번호를 입력해주세요.")
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package bootcamp.wssrs.domain.Member.dto.request;

import jakarta.validation.constraints.NotBlank;
import lombok.Getter;
import lombok.Setter;

@Getter @Setter
public record ReissueAccessTokenRequestDTO(
@NotBlank(message = "토큰이 존재하지 않습니다.")
String refreshToken
8 changes: 4 additions & 4 deletions src/main/java/bootcamp/wssrs/domain/Member/entity/Member.java
Original file line number Diff line number Diff line change
@@ -78,10 +78,10 @@ public void setPassword(@NotNull String password, PasswordEncoder encoder) {

public static Member createUser(@NotNull SignupRequestDTO request, PasswordEncoder encoder) {
return Member.builder()
.studentId(request.getStudentId())
.password(encoder.encode(request.getPassword()))
.username(request.getUsername())
.email(request.getEmail())
.studentId(request.studentId())
.password(encoder.encode(request.password()))
.username(request.username())
.email(request.email())
.role(Role.USER)
.build();
}
Original file line number Diff line number Diff line change
@@ -47,9 +47,9 @@ public class Recruit {

public static Recruit create(UserRecruitRequestDTO requestDTO) {
return Recruit.builder()
.code(requestDTO.getCode())
.phoneNum(requestDTO.getPhoneNum())
.isUnion(requestDTO.getIsUnion())
.code(requestDTO.code())
.phoneNum(requestDTO.phoneNum())
.isUnion(requestDTO.isUnion())
.isConfirmed(false)
.build();
}
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ public void create(@Valid UserRecruitRequestDTO requestDTO, Member member, Long
recruit.setMember(member);
recruit.setNotice(notice);

Day day = dayService.create(requestDTO.getDay());
Day day = dayService.create(requestDTO.day());
recruit.setDay(day);

recruitRepository.save(recruit);
@@ -53,7 +53,7 @@ public List<RecruitsResponseDTO> findRecruitInNotice(Long noticeId) {
// 근무 확정
@Transactional
public void confirm(AdminConfirmRequestDTO requestDTO) {
recruitRepository.findAllById(requestDTO.getRecruitIds())
recruitRepository.findAllById(requestDTO.recruitIds())
.forEach(recruit -> recruit.setIsConfirmed(!recruit.getIsConfirmed()));
}

0 comments on commit ff2f092

Please sign in to comment.