Repository navigation
Step6 #153
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
Merged
Merged
Step6 #153
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,94 @@ | ||
| package codesquad.domain; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonIgnore; | ||
| import support.domain.AbstractEntity; | ||
|
|
||
| import javax.persistence.*; | ||
| import javax.validation.constraints.Size; | ||
|
|
||
| @Entity | ||
| public class Attachment extends AbstractEntity { | ||
|
|
||
| @ManyToOne | ||
| @JsonIgnore | ||
| @JoinColumn(foreignKey = @ForeignKey(name = "fk_attachment_issue")) | ||
| private Issue issue; | ||
|
|
||
| @ManyToOne | ||
| @JoinColumn(foreignKey = @ForeignKey(name = "fk_attachment_writer")) | ||
| private User writer; | ||
|
|
||
| @Size(max = 260) | ||
| String originalFileName; | ||
|
|
||
| @Size(max = 32) | ||
| String storedFileName; | ||
|
|
||
| String path; | ||
|
|
||
| public Attachment() { | ||
|
|
||
| } | ||
|
|
||
| public Attachment(Issue issue, String originalFileName, String storedFileName, String path) { | ||
| this.issue = issue; | ||
| this.originalFileName = originalFileName; | ||
| this.storedFileName = storedFileName; | ||
| this.path = path; | ||
| } | ||
|
|
||
| public void writerBy(User loginUser) { | ||
| this.writer = loginUser; | ||
| } | ||
|
|
||
| public Issue getIssue() { | ||
| return issue; | ||
| } | ||
|
|
||
| public void setIssue(Issue issue) { | ||
| this.issue = issue; | ||
| } | ||
|
|
||
| public User getWriter() { | ||
| return writer; | ||
| } | ||
|
|
||
| public void setWriter(User writer) { | ||
| this.writer = writer; | ||
| } | ||
|
|
||
| public String getOriginalFileName() { | ||
| return originalFileName; | ||
| } | ||
|
|
||
| public void setOriginalFileName(String originalFileName) { | ||
| this.originalFileName = originalFileName; | ||
| } | ||
|
|
||
| public String getStoredFileName() { | ||
| return storedFileName; | ||
| } | ||
|
|
||
| public void setStoredFileName(String storedFileName) { | ||
| this.storedFileName = storedFileName; | ||
| } | ||
|
|
||
| public String getPath() { | ||
| return path; | ||
| } | ||
|
|
||
| public void setPath(String path) { | ||
| this.path = path; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "Attachment{" + | ||
| "issue=" + issue + | ||
| ", writer=" + writer + | ||
| ", originalFileName='" + originalFileName + '\'' + | ||
| ", storedFileName='" + storedFileName + '\'' + | ||
| ", path='" + path + '\'' + | ||
| '}'; | ||
| } | ||
| } |
This file contains hidden or 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,6 @@ | ||
| package codesquad.domain; | ||
|
|
||
| import org.springframework.data.jpa.repository.JpaRepository; | ||
|
|
||
| public interface AttachmentRepository extends JpaRepository<Attachment, Long> { | ||
| } |
This file contains hidden or 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 hidden or 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
47 changes: 47 additions & 0 deletions
47
src/main/java/codesquad/domain/response/UploadFileResponse.java
This file contains hidden or 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,47 @@ | ||
| package codesquad.domain.response; | ||
|
|
||
| public class UploadFileResponse { | ||
| private String fileName; | ||
| private String fileDownloadUri; | ||
| private String fileType; | ||
| private long size; | ||
|
|
||
| public UploadFileResponse(String fileName, String fileDownloadUri, String fileType, long size) { | ||
| this.fileName = fileName; | ||
| this.fileDownloadUri = fileDownloadUri; | ||
| this.fileType = fileType; | ||
| this.size = size; | ||
| } | ||
|
|
||
| public String getFileName() { | ||
| return fileName; | ||
| } | ||
|
|
||
| public void setFileName(String fileName) { | ||
| this.fileName = fileName; | ||
| } | ||
|
|
||
| public String getFileDownloadUri() { | ||
| return fileDownloadUri; | ||
| } | ||
|
|
||
| public void setFileDownloadUri(String fileDownloadUri) { | ||
| this.fileDownloadUri = fileDownloadUri; | ||
| } | ||
|
|
||
| public String getFileType() { | ||
| return fileType; | ||
| } | ||
|
|
||
| public void setFileType(String fileType) { | ||
| this.fileType = fileType; | ||
| } | ||
|
|
||
| public long getSize() { | ||
| return size; | ||
| } | ||
|
|
||
| public void setSize(long size) { | ||
| this.size = size; | ||
| } | ||
| } | ||
13 changes: 13 additions & 0 deletions
13
src/main/java/codesquad/exception/FileStorageException.java
This file contains hidden or 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 codesquad.exception; | ||
|
|
||
| import org.omg.SendingContext.RunTime; | ||
|
|
||
| public class FileStorageException extends RuntimeException { | ||
| public FileStorageException(String message) { | ||
| super(message); | ||
| } | ||
|
|
||
| public FileStorageException(String message, Throwable cause) { | ||
| super(message, cause); | ||
| } | ||
| } |
11 changes: 11 additions & 0 deletions
11
src/main/java/codesquad/exception/MyFileNotFoundException.java
This file contains hidden or 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 codesquad.exception; | ||
|
|
||
| public class MyFileNotFoundException extends RuntimeException { | ||
| public MyFileNotFoundException(String message) { | ||
| super(message); | ||
| } | ||
|
|
||
| public MyFileNotFoundException(String message, Throwable cause) { | ||
| super(message, cause); | ||
| } | ||
| } |
2 changes: 1 addition & 1 deletion
2
.../codesquad/UnAuthenticationException.java → .../exception/UnAuthenticationException.java
This file contains hidden or 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
2 changes: 1 addition & 1 deletion
2
...java/codesquad/UnAuthorizedException.java → ...quad/exception/UnAuthorizedException.java
This file contains hidden or 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
16 changes: 16 additions & 0 deletions
16
src/main/java/codesquad/property/FileStorageProperties.java
This file contains hidden or 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,16 @@ | ||
| package codesquad.property; | ||
|
|
||
| import org.springframework.boot.context.properties.ConfigurationProperties; | ||
|
|
||
| @ConfigurationProperties(prefix = "file") | ||
| public class FileStorageProperties { | ||
| private String uploadDir; | ||
|
|
||
| public String getUploadDir() { | ||
| return uploadDir; | ||
| } | ||
|
|
||
| public void setUploadDir(String uploadDir) { | ||
| this.uploadDir = uploadDir; | ||
| } | ||
| } |
This file contains hidden or 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: 1 addition & 2 deletions
3
src/main/java/codesquad/security/LoginUserHandlerMethodArgumentResolver.java
This file contains hidden or 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
5 changes: 2 additions & 3 deletions
5
src/main/java/codesquad/security/RestSecurityControllerAdvice.java
This file contains hidden or 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
4 changes: 2 additions & 2 deletions
4
src/main/java/codesquad/security/SecurityControllerAdvice.java
This file contains hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
생성자 활용해 객체를 생성하기 때문에 굳이 setter 메소드가 필요없지 않을까?