forked from UMC-EWHA/umc-spring-3rd
-
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.
UMC-EWHA#16 Feat : Upload Create, Read, Update board
- Loading branch information
Showing
11 changed files
with
176 additions
and
10 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
32 changes: 32 additions & 0 deletions
32
SpringBootTemplate/src/main/java/com/example/demo/src/board/BoardProvider.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 |
---|---|---|
@@ -1,15 +1,47 @@ | ||
package com.example.demo.src.board; | ||
|
||
import com.example.demo.config.BaseException; | ||
import com.example.demo.src.board.model.GetPostRes; | ||
import com.example.demo.src.user.model.GetUserRes; | ||
import com.example.demo.utils.JwtService; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.List; | ||
|
||
import static com.example.demo.config.BaseResponseStatus.DATABASE_ERROR; | ||
|
||
@Service | ||
public class BoardProvider { | ||
private final BoardDao boardDao; | ||
private final JwtService jwtService; | ||
|
||
final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
|
||
@Autowired | ||
public BoardProvider(BoardDao boardDao, JwtService jwtService) { | ||
this.boardDao = boardDao; | ||
this.jwtService = jwtService; | ||
} | ||
|
||
public List<GetPostRes> getPosts() throws BaseException { | ||
try { | ||
List<GetPostRes> getPostRes = boardDao.getPosts(); | ||
return getPostRes; | ||
} catch (Exception exception) { | ||
throw new BaseException(DATABASE_ERROR); | ||
} | ||
} | ||
|
||
public List<GetPostRes> getPostByWriter(String writer) throws BaseException { | ||
try { | ||
List<GetPostRes> getPostRes = boardDao.getPostsByWriter(writer); | ||
return getPostRes; | ||
} catch (Exception exception) { | ||
throw new BaseException(DATABASE_ERROR); | ||
} | ||
} | ||
|
||
} |
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
15 changes: 15 additions & 0 deletions
15
SpringBootTemplate/src/main/java/com/example/demo/src/board/model/GetPostRes.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,15 @@ | ||
package com.example.demo.src.board.model; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
@AllArgsConstructor | ||
public class GetPostRes { | ||
private int postIdx; | ||
private String title; | ||
private String writer; | ||
private String content; | ||
} |
12 changes: 12 additions & 0 deletions
12
SpringBootTemplate/src/main/java/com/example/demo/src/board/model/PatchPostReq.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,12 @@ | ||
package com.example.demo.src.board.model; | ||
|
||
import lombok.*; | ||
|
||
@Getter | ||
@Setter | ||
@AllArgsConstructor | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class PatchPostReq { | ||
private int postIdx; | ||
private String content; | ||
} |
15 changes: 15 additions & 0 deletions
15
SpringBootTemplate/src/main/java/com/example/demo/src/board/model/Post.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,15 @@ | ||
package com.example.demo.src.board.model; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
@AllArgsConstructor | ||
public class Post { | ||
private int postIdx; | ||
private String title; | ||
private String writer; | ||
private String content; | ||
} |
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
Binary file not shown.
Binary file not shown.