-
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 pull request #22 from Hooking-CEOS/jiwon
✨[feat] 파일 api 생성
- Loading branch information
Showing
10 changed files
with
287 additions
and
16 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
19 changes: 19 additions & 0 deletions
19
src/main/java/shop/hooking/hooking/dto/request/FolderReqDto.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 shop.hooking.hooking.dto.request; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
import shop.hooking.hooking.entity.Folder; | ||
|
||
import java.util.List; | ||
|
||
@Data | ||
@Builder | ||
public class FolderReqDto { | ||
private Long folderId; | ||
|
||
@Builder | ||
public FolderReqDto(Long folderId){ | ||
this.folderId=folderId; | ||
|
||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/shop/hooking/hooking/dto/request/ScrapReqDto.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 shop.hooking.hooking.dto.request; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import shop.hooking.hooking.entity.Card; | ||
import shop.hooking.hooking.entity.Folder; | ||
|
||
|
||
@Getter | ||
@NoArgsConstructor | ||
public class ScrapReqDto { | ||
private Long cardId; | ||
private Long folderId; | ||
private String folderName; | ||
|
||
@Builder | ||
public ScrapReqDto(Card card, Folder folder){ | ||
this.cardId=card.getId(); | ||
this.folderId = folder.getId(); | ||
this.folderName = folder.getName(); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/shop/hooking/hooking/dto/response/FolderResDto.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 shop.hooking.hooking.dto.response; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import shop.hooking.hooking.entity.Card; | ||
import shop.hooking.hooking.entity.Folder; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
@Data | ||
@Builder | ||
public class FolderResDto { | ||
private List<Folder> folders; | ||
|
||
@Builder | ||
public FolderResDto(List<Folder> folders){ | ||
this.folders=folders; | ||
|
||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/shop/hooking/hooking/dto/response/ScrapResDto.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,21 @@ | ||
package shop.hooking.hooking.dto.response; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import shop.hooking.hooking.entity.Card; | ||
import shop.hooking.hooking.entity.Folder; | ||
|
||
|
||
@Getter | ||
@NoArgsConstructor | ||
public class ScrapResDto { | ||
private Long cardId; | ||
private Long folderId; | ||
|
||
@Builder | ||
public ScrapResDto(Card card, Folder folder){ | ||
this.cardId=card.getId(); | ||
this.folderId = folder.getId(); | ||
} | ||
} |
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,32 @@ | ||
package shop.hooking.hooking.entity; | ||
|
||
import lombok.*; | ||
import javax.persistence.*; | ||
|
||
@Getter | ||
@Setter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Entity | ||
@Table(name = "contain") | ||
public class Contain { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "contain_id") | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name="foler_id") | ||
private Folder folder; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name="scrap_id") | ||
private Scrap scrap; | ||
|
||
|
||
|
||
@Builder | ||
public Contain(Folder folder, Scrap scrap) { | ||
this.folder=folder; | ||
this.scrap=scrap; | ||
} | ||
} |
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,32 @@ | ||
package shop.hooking.hooking.entity; | ||
|
||
import lombok.*; | ||
import javax.persistence.*; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Getter | ||
@Setter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Entity | ||
@Table(name = "folder") | ||
public class Folder { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "folder_id") | ||
private Long id; | ||
|
||
@Column(name = "name") | ||
private String name; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id") | ||
private User user; | ||
|
||
@Builder | ||
public Folder(User user, String name) { | ||
this.user = user; | ||
this.name = name; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/shop/hooking/hooking/repository/ContainRepository.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,16 @@ | ||
package shop.hooking.hooking.repository; | ||
|
||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import shop.hooking.hooking.entity.Contain; | ||
import shop.hooking.hooking.entity.Scrap; | ||
import shop.hooking.hooking.entity.User; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
public interface ContainRepository extends JpaRepository<Contain, Long> { | ||
|
||
|
||
List<Contain> findByFolderId(Long folderId); | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/shop/hooking/hooking/repository/FolderRepository.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,14 @@ | ||
package shop.hooking.hooking.repository; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import shop.hooking.hooking.entity.Folder; | ||
import shop.hooking.hooking.entity.User; | ||
|
||
import java.util.*; | ||
|
||
public interface FolderRepository extends JpaRepository<Folder, Long>{ | ||
|
||
Optional<Folder> findFolderById(Long aLong); | ||
|
||
List<Folder> findByUser(User user); | ||
} |
Oops, something went wrong.