-
Notifications
You must be signed in to change notification settings - Fork 1
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 #57 from IT-Cotato/develop
Release: 0709 작업 내용 이전
- Loading branch information
Showing
29 changed files
with
505 additions
and
172 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
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
11 changes: 11 additions & 0 deletions
11
src/main/java/org/cotato/csquiz/api/member/dto/UpdatePhoneNumberRequest.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 org.cotato.csquiz.api.member.dto; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import jakarta.validation.constraints.Size; | ||
|
||
public record UpdatePhoneNumberRequest( | ||
@NotNull(message = "전화번호를 입력해주세요.") | ||
@Size(min = 11, max = 11, message = "'-'없이 11자리의 전화번호를 입력해주세요.") | ||
String phoneNumber | ||
) { | ||
} |
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/org/cotato/csquiz/api/session/dto/AddSessionPhotoRequest.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 org.cotato.csquiz.api.session.dto; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
public record AddSessionPhotoRequest( | ||
|
||
@NotNull | ||
Long sessionId, | ||
@NotNull | ||
MultipartFile photo | ||
) { | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/org/cotato/csquiz/api/session/dto/AddSessionPhotoResponse.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,17 @@ | ||
package org.cotato.csquiz.api.session.dto; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import org.cotato.csquiz.domain.generation.entity.SessionPhoto; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
public record AddSessionPhotoResponse( | ||
Long photoId, | ||
String photoUrl, | ||
Integer order | ||
) { | ||
public static AddSessionPhotoResponse from(SessionPhoto sessionPhoto) { | ||
return new AddSessionPhotoResponse(sessionPhoto.getId(), | ||
sessionPhoto.getS3Info().getUrl(), | ||
sessionPhoto.getOrder()); | ||
} | ||
} |
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
9 changes: 9 additions & 0 deletions
9
src/main/java/org/cotato/csquiz/api/session/dto/DeleteSessionPhotoRequest.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,9 @@ | ||
package org.cotato.csquiz.api.session.dto; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
|
||
public record DeleteSessionPhotoRequest( | ||
@NotNull | ||
Long photoId | ||
) { | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/org/cotato/csquiz/api/session/dto/SessionListPhotoInfoResponse.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,23 @@ | ||
package org.cotato.csquiz.api.session.dto; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import java.util.List; | ||
import org.cotato.csquiz.domain.generation.entity.SessionPhoto; | ||
|
||
public record SessionListPhotoInfoResponse( | ||
Long photoId, | ||
String photoUrl, | ||
Integer order | ||
) { | ||
public static SessionListPhotoInfoResponse from(SessionPhoto sessionPhoto) { | ||
return new SessionListPhotoInfoResponse(sessionPhoto.getId(), | ||
sessionPhoto.getS3Info().getUrl(), | ||
sessionPhoto.getOrder()); | ||
} | ||
|
||
public static List<SessionListPhotoInfoResponse> from(List<SessionPhoto> sessionPhotos) { | ||
return sessionPhotos.stream() | ||
.map(SessionListPhotoInfoResponse::from) | ||
.toList(); | ||
} | ||
} |
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
11 changes: 11 additions & 0 deletions
11
src/main/java/org/cotato/csquiz/api/session/dto/UpdateSessionPhotoOrderInfoRequest.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 org.cotato.csquiz.api.session.dto; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
|
||
public record UpdateSessionPhotoOrderInfoRequest( | ||
@NotNull | ||
Long photoId, | ||
@NotNull | ||
Integer order | ||
) { | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/org/cotato/csquiz/api/session/dto/UpdateSessionPhotoOrderRequest.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,9 @@ | ||
package org.cotato.csquiz.api.session.dto; | ||
|
||
import java.util.List; | ||
|
||
public record UpdateSessionPhotoOrderRequest( | ||
Long sessionId, | ||
List<UpdateSessionPhotoOrderInfoRequest> orderInfos | ||
) { | ||
} |
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
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
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
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
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
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,26 @@ | ||
package org.cotato.csquiz.common.util; | ||
|
||
import java.util.Arrays; | ||
import org.cotato.csquiz.common.error.ErrorCode; | ||
import org.cotato.csquiz.common.error.exception.ImageException; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
public class FileUtil { | ||
|
||
private static final String[] ALLOWED_IMAGE_FILE_EXTENSIONS = {"png", "jpg", "jpeg", "heif"}; | ||
|
||
public static String extractFileExtension(MultipartFile file) throws ImageException { | ||
String originalFilename = file.getOriginalFilename(); | ||
if (originalFilename == null || !originalFilename.contains(".")) { | ||
throw new ImageException(ErrorCode.FILE_EXTENSION_FAULT); | ||
} | ||
|
||
return originalFilename.substring(originalFilename.lastIndexOf(".") + 1); | ||
} | ||
|
||
public static void checkAllowedImageFileExtension(String fileExtension) throws ImageException { | ||
if (!Arrays.asList(ALLOWED_IMAGE_FILE_EXTENSIONS).contains(fileExtension)) { | ||
throw new ImageException(ErrorCode.FILE_EXTENSION_FAULT); | ||
} | ||
} | ||
} |
Oops, something went wrong.