-
Notifications
You must be signed in to change notification settings - Fork 3
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 #477 from Kernel360/develop
2024-11-27 test
- Loading branch information
Showing
37 changed files
with
335 additions
and
109 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
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
21 changes: 11 additions & 10 deletions
21
api/src/main/java/org/badminton/api/application/league/LeagueParticipationFacade.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 |
---|---|---|
@@ -1,25 +1,26 @@ | ||
package org.badminton.api.application.league; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.badminton.domain.domain.clubmember.service.ClubMemberService; | ||
import org.badminton.domain.domain.league.LeagueParticipantService; | ||
import org.badminton.domain.domain.league.info.LeagueParticipantCancelInfo; | ||
import org.badminton.domain.domain.league.info.LeagueParticipantInfo; | ||
import org.springframework.stereotype.Service; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Slf4j | ||
@Service | ||
@RequiredArgsConstructor | ||
public class LeagueParticipationFacade { | ||
private final LeagueParticipantService leagueParticipantService; | ||
private final ClubMemberService clubMemberService; | ||
private final LeagueParticipantService leagueParticipantService; | ||
private final ClubMemberService clubMemberService; | ||
|
||
public LeagueParticipantInfo participateInLeague(String memberToken, String clubToken, Long leagueId) { | ||
return leagueParticipantService.participantInLeague(memberToken, clubToken, leagueId); | ||
} | ||
public LeagueParticipantInfo participateInLeague(String memberToken, String clubToken, Long leagueId) { | ||
return leagueParticipantService.participantInLeague(memberToken, clubToken, leagueId); | ||
} | ||
|
||
public LeagueParticipantCancelInfo cancelParticipateInLeague(String clubToken, String memberToken, Long leagueId) { | ||
return leagueParticipantService.participantLeagueCancel(memberToken, clubToken, leagueId); | ||
} | ||
public LeagueParticipantCancelInfo cancelParticipateInLeague(String clubToken, String memberToken, Long leagueId) { | ||
return leagueParticipantService.cancelLeagueParticipation(memberToken, clubToken, leagueId); | ||
} | ||
} |
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
29 changes: 29 additions & 0 deletions
29
api/src/main/java/org/badminton/api/aws/s3/service/ImageConversionService.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,29 @@ | ||
package org.badminton.api.aws.s3.service; | ||
|
||
import java.io.ByteArrayOutputStream; | ||
import java.io.IOException; | ||
|
||
import org.badminton.api.common.exception.EmptyFileException; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import com.sksamuel.scrimage.ImmutableImage; | ||
import com.sksamuel.scrimage.metadata.ImageMetadata; | ||
import com.sksamuel.scrimage.webp.WebpWriter; | ||
|
||
@Service | ||
public class ImageConversionService { | ||
|
||
public byte[] convertToWebP(MultipartFile file) { | ||
try { | ||
ImmutableImage image = ImmutableImage.loader().fromStream(file.getInputStream()); | ||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); | ||
WebpWriter writer = WebpWriter.DEFAULT; | ||
writer.write(image, ImageMetadata.fromStream(file.getInputStream()), outputStream); | ||
return outputStream.toByteArray(); | ||
} catch (IOException exception) { | ||
throw new EmptyFileException(exception); | ||
} | ||
|
||
} | ||
} |
3 changes: 1 addition & 2 deletions
3
api/src/main/java/org/badminton/api/aws/s3/service/ImageService.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 |
---|---|---|
@@ -1,11 +1,10 @@ | ||
|
||
package org.badminton.api.aws.s3.service; | ||
|
||
import org.badminton.api.aws.s3.model.dto.ImageUploadRequest; | ||
|
||
public interface ImageService { | ||
String uploadFile(ImageUploadRequest file); | ||
|
||
String makeFileName(String originalFilename); | ||
String makeFileName(String newFileExtension); | ||
} | ||
|
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
14 changes: 14 additions & 0 deletions
14
api/src/main/java/org/badminton/api/common/exception/FileSizeOverException.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,14 @@ | ||
package org.badminton.api.common.exception; | ||
|
||
import org.badminton.domain.common.error.ErrorCode; | ||
import org.badminton.domain.common.exception.BadmintonException; | ||
|
||
public class FileSizeOverException extends BadmintonException { | ||
public FileSizeOverException(long fileSize) { | ||
super(ErrorCode.FILE_SIZE_OVER, "[입력한 파일 사이즈 : " + fileSize + ", 최대 파일 사이즈 : 2.5MB]"); | ||
} | ||
|
||
public FileSizeOverException(Exception exception) { | ||
super(ErrorCode.FILE_SIZE_OVER, exception); | ||
} | ||
} |
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
Oops, something went wrong.