-
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 'dev' of github.com:LikelionUniv/Server into stag/admin
- Loading branch information
Showing
10 changed files
with
117 additions
and
51 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,57 @@ | ||
plugins { | ||
id 'java-library' | ||
id 'org.springframework.boot' version '2.7.13' | ||
id 'io.spring.dependency-management' version '1.0.15.RELEASE' | ||
id 'java-library' | ||
id 'org.springframework.boot' version '2.7.13' | ||
id 'io.spring.dependency-management' version '1.0.15.RELEASE' | ||
} | ||
|
||
allprojects { | ||
group = 'likelion.univ' | ||
version = '0.0.1-SNAPSHOT' | ||
group = 'likelion.univ' | ||
version = '0.0.1-SNAPSHOT' | ||
|
||
java { | ||
sourceCompatibility = 17 | ||
targetCompatibility = 17 | ||
} | ||
repositories { | ||
mavenCentral() | ||
} | ||
dependencies { | ||
java { | ||
sourceCompatibility = 17 | ||
targetCompatibility = 17 | ||
} | ||
repositories { | ||
mavenCentral() | ||
} | ||
dependencies { | ||
// implementation 'org.springframework.boot:spring-boot-starter' | ||
// annotationProcessor('org.springframework.boot:spring-boot-configuration-processor:3.0.4') | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
mavenCentral() | ||
} | ||
tasks.named('test') { | ||
useJUnitPlatform() | ||
useJUnitPlatform() | ||
} | ||
|
||
/* subprojects의 내용은 하위 모듈에 모두 적용하는 설정 */ | ||
subprojects { | ||
apply plugin: 'java' | ||
apply plugin: 'org.springframework.boot' | ||
apply plugin: 'io.spring.dependency-management' | ||
apply plugin: 'java' | ||
apply plugin: 'org.springframework.boot' | ||
apply plugin: 'io.spring.dependency-management' | ||
|
||
configurations { | ||
compileOnly { | ||
extendsFrom annotationProcessor | ||
} | ||
} | ||
dependencies { | ||
implementation 'org.springframework.boot:spring-boot-starter' | ||
testImplementation 'org.springframework.boot:spring-boot-starter-test' | ||
compileOnly 'org.projectlombok:lombok' | ||
annotationProcessor 'org.projectlombok:lombok' | ||
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor") | ||
} | ||
test { | ||
useJUnitPlatform() | ||
} | ||
configurations { | ||
compileOnly { | ||
extendsFrom annotationProcessor | ||
} | ||
} | ||
dependencies { | ||
implementation 'org.springframework.boot:spring-boot-starter-web' | ||
implementation 'org.springframework.boot:spring-boot-starter' | ||
testImplementation 'org.springframework.boot:spring-boot-starter-test' | ||
compileOnly 'org.projectlombok:lombok' | ||
annotationProcessor 'org.projectlombok:lombok' | ||
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor") | ||
} | ||
test { | ||
useJUnitPlatform() | ||
} | ||
} | ||
bootJar { | ||
enabled = false | ||
enabled = false | ||
} | ||
|
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
9 changes: 9 additions & 0 deletions
9
...astructure/src/main/java/likelion/univ/email/exception/CanNotReadAttachmentException.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 likelion.univ.email.exception; | ||
|
||
import likelion.univ.exception.base.BaseException; | ||
|
||
public class CanNotReadAttachmentException extends BaseException { | ||
public CanNotReadAttachmentException() { | ||
super(EmailErrorCode.CAN_NOT_READ_ATTACHMENT); | ||
} | ||
} |
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
49 changes: 49 additions & 0 deletions
49
likelion-infrastructure/src/main/java/likelion/univ/email/util/FileUploadUtil.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,49 @@ | ||
package likelion.univ.email.util; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.OutputStream; | ||
import likelion.univ.email.exception.CanNotReadAttachmentException; | ||
import org.apache.commons.fileupload.FileItem; | ||
import org.apache.commons.fileupload.disk.DiskFileItem; | ||
import org.springframework.core.io.ClassPathResource; | ||
import org.springframework.core.io.Resource; | ||
import org.springframework.web.multipart.MultipartFile; | ||
import org.springframework.web.multipart.commons.CommonsMultipartFile; | ||
|
||
public class FileUploadUtil { | ||
|
||
public static MultipartFile convertPngToMultipartFile(String filePath) { | ||
Resource resource = new ClassPathResource(filePath); | ||
|
||
try { | ||
InputStream inputStream = resource.getInputStream(); | ||
FileItem fileItem = new DiskFileItem( | ||
resource.getFilename(), | ||
"image/png", | ||
false, | ||
resource.getFilename(), | ||
(int) resource.contentLength(), | ||
new File(System.getProperty("java.io.tmpdir")) | ||
); | ||
|
||
try (OutputStream os = fileItem.getOutputStream()) { | ||
byte[] buffer = new byte[1024]; | ||
int bytesRead; | ||
while ((bytesRead = inputStream.read(buffer)) != -1) { | ||
os.write(buffer, 0, bytesRead); | ||
} | ||
} finally { | ||
inputStream.close(); | ||
} | ||
|
||
MultipartFile multipartFile = new CommonsMultipartFile(fileItem); | ||
|
||
return multipartFile; | ||
} catch (IOException e) { | ||
throw new CanNotReadAttachmentException(); | ||
} | ||
} | ||
|
||
} |
Binary file added
BIN
+126 KB
likelion-infrastructure/src/main/resources/attachment/hackathon/12th_hackathon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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