-
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.
[Feat] 모듈화 및 데이터베이스 연동 - #14
- Loading branch information
Showing
13 changed files
with
200 additions
and
27 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
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
30 changes: 30 additions & 0 deletions
30
manager/src/main/java/com/analyzer/sbom/domain/Reference.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,30 @@ | ||
package com.analyzer.sbom.domain; | ||
|
||
import com.analyzer.sbom.dto.request.ReferenceRequestDto; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import javax.persistence.*; | ||
|
||
@Entity | ||
@Getter | ||
@Table(name = "reference_tb") | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class Reference { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(name = "cve") | ||
private String cveId; | ||
|
||
@Column(name = "reference_url") | ||
private String referenceUrl; | ||
|
||
public Reference(ReferenceRequestDto requestDto) { | ||
this.cveId = requestDto.getCveId(); | ||
this.referenceUrl = requestDto.getReferenceUrl(); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
manager/src/main/java/com/analyzer/sbom/domain/Suggestion.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,33 @@ | ||
package com.analyzer.sbom.domain; | ||
|
||
import com.analyzer.sbom.dto.request.SuggestionRequestDto; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import javax.persistence.*; | ||
|
||
@Entity | ||
@Getter | ||
@Table(name = "suggestion_tb") | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class Suggestion { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(name = "cve") | ||
private String cveId; | ||
|
||
private String suggestion; | ||
|
||
@Column(name = "suggestion_url") | ||
private String suggestionUrl; | ||
|
||
public Suggestion(SuggestionRequestDto requestDto) { | ||
this.cveId = requestDto.getCveId(); | ||
this.suggestion = requestDto.getSuggestion(); | ||
this.suggestionUrl = requestDto.getSuggestionUrl(); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
manager/src/main/java/com/analyzer/sbom/dto/request/ReferenceRequestDto.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,19 @@ | ||
package com.analyzer.sbom.dto.request; | ||
|
||
import com.analyzer.sbom.domain.Reference; | ||
import lombok.Getter; | ||
|
||
import javax.validation.constraints.NotBlank; | ||
|
||
@Getter | ||
public class ReferenceRequestDto { | ||
@NotBlank | ||
private String cveId; | ||
|
||
@NotBlank | ||
private String referenceUrl; | ||
|
||
public Reference toEntity(ReferenceRequestDto requestDto) { | ||
return new Reference(requestDto); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
manager/src/main/java/com/analyzer/sbom/dto/request/SuggestionRequestDto.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 com.analyzer.sbom.dto.request; | ||
|
||
import com.analyzer.sbom.domain.Suggestion; | ||
import lombok.Getter; | ||
|
||
import javax.validation.constraints.NotBlank; | ||
|
||
@Getter | ||
public class SuggestionRequestDto { | ||
|
||
@NotBlank | ||
private String cveId; | ||
|
||
@NotBlank | ||
private String suggestion; | ||
|
||
@NotBlank | ||
private String suggestionUrl; | ||
|
||
public Suggestion toEntity(SuggestionRequestDto requestDto) { | ||
return new Suggestion(requestDto); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
manager/src/main/java/com/analyzer/sbom/dto/response/ReferenceResponseDto.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,28 @@ | ||
package com.analyzer.sbom.dto.response; | ||
|
||
import com.analyzer.sbom.domain.Reference; | ||
import lombok.Getter; | ||
|
||
import javax.validation.constraints.NotBlank; | ||
|
||
@Getter | ||
public class ReferenceResponseDto { | ||
@NotBlank | ||
private Long id; | ||
|
||
@NotBlank | ||
private String cveId; | ||
|
||
@NotBlank | ||
private String referenceUrl; | ||
|
||
private ReferenceResponseDto(Reference reference) { | ||
this.id = reference.getId(); | ||
this.cveId = reference.getCveId(); | ||
this.referenceUrl = reference.getReferenceUrl(); | ||
} | ||
|
||
public static ReferenceResponseDto from(Reference reference) { | ||
return new ReferenceResponseDto(reference); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
manager/src/main/java/com/analyzer/sbom/dto/response/SuggestionResponseDto.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,33 @@ | ||
package com.analyzer.sbom.dto.response; | ||
|
||
import com.analyzer.sbom.domain.Suggestion; | ||
import lombok.Getter; | ||
|
||
import javax.validation.constraints.NotBlank; | ||
|
||
@Getter | ||
public class SuggestionResponseDto { | ||
|
||
@NotBlank | ||
private Long id; | ||
|
||
@NotBlank | ||
private String cveId; | ||
|
||
@NotBlank | ||
private String suggestion; | ||
|
||
@NotBlank | ||
private String suggestionUrl; | ||
|
||
private SuggestionResponseDto(Suggestion suggestion) { | ||
this.id = suggestion.getId(); | ||
this.cveId = suggestion.getCveId(); | ||
this.suggestion = suggestion.getSuggestion(); | ||
this.suggestionUrl = suggestion.getSuggestionUrl(); | ||
} | ||
|
||
public static SuggestionResponseDto from(Suggestion suggestion) { | ||
return new SuggestionResponseDto(suggestion); | ||
} | ||
} |
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
File renamed without changes.