-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/Sanbo-Sillok/Sanbo-Sillo…
…k-Server into develop
- Loading branch information
Showing
8 changed files
with
71 additions
and
7 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
src/main/java/com/sanbosillok/sanbosillokserver/api/image/dto/ImagePathResponse.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,12 @@ | ||
package com.sanbosillok.sanbosillokserver.api.image.dto; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class ImagePathResponse { | ||
private String imagePath; | ||
|
||
public ImagePathResponse(String imagePath) { | ||
this.imagePath = imagePath; | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/com/sanbosillok/sanbosillokserver/api/image/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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.sanbosillok.sanbosillokserver.api.image.service; | ||
|
||
import com.sanbosillok.sanbosillokserver.api.image.dto.ImagePathResponse; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.UUID; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class ImageService { | ||
|
||
public ImagePathResponse upload(String path, MultipartFile file) { | ||
String uuid = UUID.randomUUID().toString(); | ||
String fileName = file.getOriginalFilename(); | ||
assert fileName != null; | ||
String fileExtension = fileName.substring(fileName.lastIndexOf('.')); | ||
|
||
File saveFile = new File(path + uuid + fileExtension); | ||
|
||
try { | ||
file.transferTo(saveFile); | ||
return new ImagePathResponse(path + uuid + fileExtension); | ||
} catch (IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} |
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
3 changes: 3 additions & 0 deletions
3
src/main/java/com/sanbosillok/sanbosillokserver/api/member/dto/JoinRequest.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,14 @@ | ||
package com.sanbosillok.sanbosillokserver.api.member.dto; | ||
|
||
import lombok.Data; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
@Data | ||
public class JoinRequest { | ||
|
||
private String username; | ||
|
||
private String password; | ||
|
||
private MultipartFile studentIdImage; | ||
} |
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