-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#18 - 테이블 스키마 뷰에서 필요한 추가 enum 및 dto 구현
테이블 스키마 뷰에서 프론트에 전달할 일부 데이터와 파일 출력 버튼을 고려한 데이터 구조를 추가함.
- Loading branch information
Showing
3 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
src/main/java/uno/fastcampus/testdata/domain/constant/ExportFileType.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,5 @@ | ||
package uno.fastcampus.testdata.domain.constant; | ||
|
||
public enum ExportFileType { | ||
CSV, TSV, JSON, SQL_INSERT; | ||
} |
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
34 changes: 34 additions & 0 deletions
34
src/main/java/uno/fastcampus/testdata/dto/request/TableSchemaExportRequest.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,34 @@ | ||
package uno.fastcampus.testdata.dto.request; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import uno.fastcampus.testdata.domain.constant.ExportFileType; | ||
import uno.fastcampus.testdata.dto.TableSchemaDto; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
// TODO: 스프링 부트 3.4를 쓸 수 있게 되면, record로 되돌리는 것을 검토하기 | ||
@NoArgsConstructor | ||
@AllArgsConstructor(staticName = "of") | ||
@Data | ||
public class TableSchemaExportRequest { | ||
|
||
private String schemaName; | ||
private Integer rowCount; | ||
private ExportFileType fileType; | ||
private List<SchemaFieldRequest> schemaFields; | ||
|
||
public TableSchemaDto toDto(String userId) { | ||
return TableSchemaDto.of( | ||
schemaName, | ||
userId, | ||
null, | ||
schemaFields.stream() | ||
.map(SchemaFieldRequest::toDto) | ||
.collect(Collectors.toUnmodifiableSet()) | ||
); | ||
} | ||
|
||
} |