Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.3.0 #283

Merged
merged 27 commits into from
May 3, 2024
Merged

1.3.0 #283

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d835de9
#273 [feat] 디자이너 정보 조회 성공코드
hellozo0 Apr 21, 2024
d57c1ea
#273 [fix] 안쓰는 주석 제거
hellozo0 Apr 21, 2024
c57ef3a
#273 [feat] 마이페이지 조회 디자이너 정보 응답바디
hellozo0 Apr 21, 2024
17134b1
#273 [feat] 디자이너 정보 조회 기능 구현
hellozo0 Apr 21, 2024
7af5837
#273 [feat] 모델정보 조회 성공코드
hellozo0 Apr 21, 2024
12ec64a
#273 [fear] 모델 마이페이지 정보 조회 dto
hellozo0 Apr 21, 2024
3279ffe
#273 [fix] swagger에 보이는 dto 수정
hellozo0 Apr 21, 2024
e7e60d8
#273 [feat] 마이페이지 수정 _ 모델 정보 조회 기능 구현
hellozo0 Apr 21, 2024
de022d9
#273 [feat] Slashed 전화 번호 패턴 함수 만들기
hellozo0 Apr 21, 2024
800f59c
#273 [feat] GUI에 fit한 데이터 형태로 변경
hellozo0 Apr 21, 2024
085f88e
Merge pull request #276 from TEAM-MODDY/feat/#273
hellozo0 Apr 21, 2024
2f3df7f
#274 [feat] 모델 정보 수정 상태 코드
hellozo0 Apr 21, 2024
1f46be7
#274 [feat] 사용하지 않는 import 삭제
hellozo0 Apr 21, 2024
6cd1024
#274 [feat] model 정보 update 함수 작성
hellozo0 Apr 21, 2024
fb31538
#274 [feat] 안쓰는 코드들 삭제 및 작은 수정
hellozo0 Apr 21, 2024
8299976
#274 [feat] 모델 정보 수정 request, + validation
hellozo0 Apr 21, 2024
7559c9f
#274 [feat] 모델 정보 수정 기능 구현
hellozo0 Apr 21, 2024
d777d44
Merge pull request #278 from TEAM-MODDY/feat/#274
hellozo0 Apr 21, 2024
bc5cda7
#275 [feat] 디자이너 정보 수정 상태 코드
hellozo0 Apr 21, 2024
106e59e
#275 [feat] 사용하지 않는 파일 삭제
hellozo0 Apr 21, 2024
c92aecd
#275 [feat] designer 정보 업데이트 함수 생성
hellozo0 Apr 21, 2024
ba4ecb9
#275 [feat] 디자이너 정보 수정할 request 생성
hellozo0 Apr 21, 2024
6a741eb
#275 [feat] 코드 줄이기
hellozo0 Apr 21, 2024
9ea06da
#275 [feat] 디자이너 정보 수정하기 기능 구현
hellozo0 Apr 21, 2024
519cc99
Merge pull request #279 from TEAM-MODDY/feat/#275
hellozo0 Apr 21, 2024
63ddc9a
#280 [feat] null로 올 경우는 수정 안했다는 의미이기 때문에 기존의 이미지 삭제안함
hellozo0 Apr 24, 2024
6f4c675
Merge pull request #281 from TEAM-MODDY/feat/#280
hellozo0 Apr 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ public enum SuccessCode {
GET_PRE_SIGNED_URL_SUCCESS(HttpStatus.OK, "제안서 다운로드 url 생성 성공"),
GET_APPLICATION_IMG_URL_SUCCESS(HttpStatus.OK, "지원서 이미지 url 가져오기 성공"),
CHECK_VALID_APPLICATION_SUCCESS(HttpStatus.OK, "유효한 지원서 입니다."),
APPLICATION_DELETE_SUCCESS(HttpStatus.OK, "지원서 삭제하기 성공");
APPLICATION_DELETE_SUCCESS(HttpStatus.OK, "지원서 삭제하기 성공"),
FIND_DESIGNER_INFO_SUCCESS(HttpStatus.OK, "디자이너 정보 조회 성공"),
FIND_MODEL_INFO_SUCCESS(HttpStatus.OK, "모델 정보 조회 성공"),
MODEL_UPDATE_SUCCESS(HttpStatus.OK,"모델 정보 수정 성공"),
DESIGNER_UPDATE_SUCCESS(HttpStatus.OK,"디자이너 정보 수정 성공");

private final HttpStatus httpStatus;
private final String message;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.moddy.server.controller.designer;

import com.moddy.server.common.dto.ErrorResponse;
import com.moddy.server.common.dto.SuccessNonDataResponse;
import com.moddy.server.common.dto.SuccessResponse;
import com.moddy.server.common.exception.enums.SuccessCode;
import com.moddy.server.config.resolver.user.UserId;
import com.moddy.server.controller.designer.dto.request.DesignerCreateRequest;
import com.moddy.server.controller.designer.dto.request.DesignerUpdateRequest;
import com.moddy.server.controller.designer.dto.response.UserCreateResponse;
import com.moddy.server.service.designer.DesignerRegisterService;
import io.swagger.v3.oas.annotations.Operation;
Expand All @@ -19,6 +21,7 @@
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
Expand All @@ -44,4 +47,21 @@ SuccessResponse<UserCreateResponse> createDesigner(
@Valid @RequestPart("designerInfo") DesignerCreateRequest designerInfo) {
return SuccessResponse.success(SuccessCode.DESIGNER_CREATE_SUCCESS, designerRegisterService.createDesigner(designerId, designerInfo, profileImg));
}

@Operation(summary = "[JWT] 디자이너 마이페이지 수정 API", description = "디자이너 마이페이지 수정 API입니다.")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "디자이너 마이페이지 수정 성공"),
@ApiResponse(responseCode = "401", description = "인증오류 입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "404", description = "유효하지 않은 값을 입력했습니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "500", description = "서버 내부 오류", content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
@PutMapping(consumes = {MediaType.APPLICATION_JSON_VALUE, MediaType.MULTIPART_FORM_DATA_VALUE})
@SecurityRequirement(name = "JWT Auth")
public SuccessNonDataResponse updateModel(
@Parameter(hidden = true) @UserId Long designerId,
@RequestPart(value = "profileImg", required = false) MultipartFile profileImg,
@RequestPart(value = "designerUpdateInfo") @Valid DesignerUpdateRequest designerUpdateInfo){
designerRegisterService.updateDesigner(designerId, profileImg, designerUpdateInfo);
return SuccessNonDataResponse.success(SuccessCode.DESIGNER_UPDATE_SUCCESS);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.moddy.server.common.dto.SuccessResponse;
import com.moddy.server.common.exception.enums.SuccessCode;
import com.moddy.server.config.resolver.user.UserId;
import com.moddy.server.controller.designer.dto.response.DesignerMyPageResponse;
import com.moddy.server.controller.model.dto.DesignerInfoOpenChatDto;
import com.moddy.server.service.designer.DesignerRetrieveService;
import io.swagger.v3.oas.annotations.Operation;
Expand Down Expand Up @@ -41,4 +42,19 @@ public SuccessResponse<DesignerInfoOpenChatDto> getDesignerOpenChatInfo(
@Parameter(name = "designerId", description = "디자이너아이디") @PathVariable(value = "designerId") Long designerId) {
return SuccessResponse.success(SuccessCode.OPEN_CHAT_GET_SUCCESS, designerRetrieveService.getDesignerOpenChatInfo(designerId));
}

@Operation(summary = "[JWT] 마이페이지 디자이너 정보 조회", description = "마이페이지 수정시 디자이너 정보 조회입니다")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "디자이너 정보 조회 성공", content = @Content(schema = @Schema(implementation = DesignerMyPageResponse.class))),
@ApiResponse(responseCode = "401", description = "인증 오류 입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "500", description = "서버 내부 오류 입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
})
@GetMapping()
@SecurityRequirement(name = "JWT Auth")
public SuccessResponse<DesignerMyPageResponse> getDesignerInfo(
@Parameter(hidden = true) @UserId Long designerId){
return SuccessResponse.success(SuccessCode.FIND_DESIGNER_INFO_SUCCESS, designerRetrieveService.getDesignerInfo(designerId));
}


}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.moddy.server.controller.designer.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.*;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.moddy.server.controller.designer.dto.request;

import com.moddy.server.common.validation.unique_dayofweek.UniqueDayOfWeek;
import com.moddy.server.controller.designer.dto.HairShopDto;
import com.moddy.server.controller.designer.dto.PortfolioDto;
import com.moddy.server.domain.day_off.DayOfWeek;
import com.moddy.server.domain.designer.HairShop;
import com.moddy.server.domain.designer.Portfolio;
import com.moddy.server.domain.user.Gender;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;

import java.util.List;

@NotNull
public record DesignerUpdateRequest(
@Schema(example = "introduction")
@NotNull
@Size(min = 0, max = 200, message = "introduction은 1~200 글자수 사이의 글자입니다.")
String introduction,
@Schema(example = "안현주")
@NotNull
@Size(min = 0, max = 5, message = "name은 1~5 글자수 사이의 글자입니다.")
String name,
@Schema(example = "MALE")
@NotNull
@Enumerated(EnumType.STRING)
Gender gender,
@Valid
HairShopDto hairShop,
@UniqueDayOfWeek
List<DayOfWeek> dayOffs,
@Valid
PortfolioDto portfolio,
@Schema(example = "http://.kakao")
@NotNull
String kakaoOpenChatUrl
) {
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.moddy.server.controller.designer.dto.response;

import com.moddy.server.domain.designer.HairShop;
import com.moddy.server.domain.designer.Portfolio;

import java.util.List;

public record DesignerMyPageResponse(
String profileImgUrl,
String introduction,
String name,
String gender,
String phoneNumber,
HairShop hairShop,
List<String> dayOffs,
Portfolio portfolio,
String kakaoOpenChatUrl
) {
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package com.moddy.server.controller.model;

import com.moddy.server.common.dto.ErrorResponse;
import com.moddy.server.common.dto.SuccessNonDataResponse;
import com.moddy.server.common.dto.SuccessResponse;
import com.moddy.server.common.exception.enums.SuccessCode;
import com.moddy.server.config.resolver.user.UserId;
import com.moddy.server.controller.designer.dto.response.UserCreateResponse;
import com.moddy.server.controller.model.dto.request.ModelCreateRequest;
import com.moddy.server.controller.model.dto.request.ModelUpdateRequest;
import com.moddy.server.service.model.ModelRegisterService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
Expand All @@ -18,6 +20,7 @@
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
Expand All @@ -44,4 +47,21 @@ public SuccessResponse<UserCreateResponse> createModel(
@Valid @RequestBody ModelCreateRequest modelCreateRequest) {
return SuccessResponse.success(SuccessCode.MODEL_CREATE_SUCCESS, modelRegisterService.createModel(userId, modelCreateRequest));
}

@Operation(summary = "[JWT] 모델 마이페이지 수정 API", description = "모델 마이페이지 수정 API입니다.")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "모델 마이페이지 수정 성공"),
@ApiResponse(responseCode = "401", description = "인증오류 입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "404", description = "유효하지 않은 값을 입력했습니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "500", description = "서버 내부 오류", content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
@PutMapping
@SecurityRequirement(name = "JWT Auth")
public SuccessNonDataResponse updateModel(
@Parameter(hidden = true) @UserId Long modelId,
@Valid @RequestBody ModelUpdateRequest modelUpdateRequest) {
modelRegisterService.updateModel(modelId, modelUpdateRequest);
return SuccessNonDataResponse.success(SuccessCode.MODEL_UPDATE_SUCCESS);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.moddy.server.config.resolver.user.UserId;
import com.moddy.server.controller.auth.dto.response.RegionResponse;
import com.moddy.server.controller.model.dto.response.ApplicationUserDetailResponse;
import com.moddy.server.controller.model.dto.response.ModelMyPageResponse;
import com.moddy.server.service.model.ModelRetrieveService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
Expand Down Expand Up @@ -52,4 +53,17 @@ public SuccessResponse<List<RegionResponse>> getRegionList() {
public SuccessResponse<ApplicationUserDetailResponse> getUserDetailInApplication(@Parameter(hidden = true) @UserId final Long modelId) {
return SuccessResponse.success(SuccessCode.CREATE_MODEL_APPLICATION_SUCCESS, modelRetrieveService.getModelDetailInApplication(modelId));
}

@Operation(summary = "[JWT] 마이페이지 모델 정보 조회", description = "마이페이지 수정시 모델 정보 조회입니다")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "모델 정보 조회 성공", content = @Content(schema = @Schema(implementation = ModelMyPageResponse.class))),
@ApiResponse(responseCode = "401", description = "인증 오류 입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "500", description = "서버 내부 오류 입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
})
@GetMapping()
@SecurityRequirement(name = "JWT Auth")
public SuccessResponse<ModelMyPageResponse> getDesignerInfo(
@Parameter(hidden = true) @UserId Long modelId) {
return SuccessResponse.success(SuccessCode.FIND_MODEL_INFO_SUCCESS, modelRetrieveService.getModelInfo(modelId));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@NotNull
public record ModelCreateRequest(
@Schema(description = "모델 회원가입 유저 이름 예시입니다.", example ="안현주")
@Size(min = 0, max = 10, message = "name은 1~10 글자수 사이의 글자입니다.")
@Size(min = 0, max = 10, message = "name은 1~5 글자수 사이의 글자입니다.")
String name,
@Schema(description = "모델 회원가입 유저 나이 예시입니다.", example ="2000")
@NotBlank
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.moddy.server.controller.model.dto.request;

import com.moddy.server.common.validation.prefer_regions.ValidPreferRegions;
import com.moddy.server.common.validation.year.ValidYear;
import com.moddy.server.domain.user.Gender;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;

import java.util.List;

@NotNull
public record ModelUpdateRequest(
@Schema(description = "모델 회원가입 유저 이름 예시입니다.", example ="안현주")
@Size(min = 0, max = 5, message = "name은 1~5 글자수 사이의 글자입니다.")
String name,
@Schema(description = "모델 회원가입 유저 나이 예시입니다.", example ="2000")
@NotBlank
@ValidYear
String year,
@Schema(description = "모델 회원가입 유저 성별 예시입니다.", example ="FEMALE")
@Enumerated(EnumType.STRING)
@NotNull
Gender gender,
@Schema(description = "모델 회원가입 선호 지역 예시입니다.", example ="[\"3\", \"15\"]")
@ValidPreferRegions
List<Long> preferRegions
) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.moddy.server.controller.model.dto.response;

import java.util.List;

public record ModelMyPageResponse(
String name,
String year,
String gender,
String phoneNumber,
List<String> preferRegions
) {
}
9 changes: 8 additions & 1 deletion src/main/java/com/moddy/server/domain/designer/Designer.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.moddy.server.domain.designer;

import com.moddy.server.controller.designer.dto.request.DesignerUpdateRequest;
import com.moddy.server.domain.user.User;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;

@Entity
Expand All @@ -27,4 +27,11 @@ public class Designer extends User {

@NotNull
private String kakaoOpenChatUrl;

public void update(HairShop hairShop, Portfolio portfolio, String introduction, String kakaoOpenChatUrl){
this.hairShop = hairShop;
this.portfolio = portfolio;
this.introduction = introduction;
this.kakaoOpenChatUrl = kakaoOpenChatUrl;
}
}
6 changes: 5 additions & 1 deletion src/main/java/com/moddy/server/domain/model/Model.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import lombok.Getter;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;

import java.time.LocalDateTime;
Expand All @@ -20,9 +19,14 @@ public class Model extends User {

@NotNull
private String year;

public int getAge() {
LocalDateTime currentDateTime = LocalDateTime.now();
Integer age = currentDateTime.getYear() - Integer.parseInt(this.year) + 1;
return age;
}

public void update(String year){
this.year = year;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.Optional;

@Repository
public interface ModelJpaRepository extends JpaRepository<Model, Long> {

@Modifying(clearAutomatically = true)
@Query(value = "insert into model (id, year) VALUES (:id, :year)", nativeQuery = true)
void modelRegister(@Param("id") Long id, @Param("year") String year);

}

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.moddy.server.domain.BaseTimeEntity;
import com.moddy.server.domain.model.Model;
import com.moddy.server.domain.region.Region;
import com.moddy.server.domain.user.User;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
Expand All @@ -15,7 +14,6 @@
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

@Entity
@Getter
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/moddy/server/domain/user/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,8 @@ public void update(String name, Gender gender, String phoneNumber, Boolean isMar
this.profileImgUrl = profileImgUrl;
this.role = role;
}

public String getSlashedPhoneNumber(String phoneNumber){
return phoneNumber.substring(0, 3) + "-" + phoneNumber.substring(3, 7) + "-" + phoneNumber.substring(7);
}
}
Loading
Loading