-
Notifications
You must be signed in to change notification settings - Fork 3
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 #81 from jenny0325/main
내가 쓴 글 보기(#80), 코드 정리
- Loading branch information
Showing
22 changed files
with
341 additions
and
46 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
27 changes: 27 additions & 0 deletions
27
src/main/java/com/example/marumaru_sparta_verspring/dto/user/UserPostDto.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,27 @@ | ||
package com.example.marumaru_sparta_verspring.dto.user; | ||
|
||
import com.example.marumaru_sparta_verspring.domain.articles.Post; | ||
import com.example.marumaru_sparta_verspring.domain.user.User; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
import java.time.format.DateTimeFormatter; | ||
|
||
|
||
@Getter | ||
@Setter | ||
public class UserPostDto { | ||
private long idx; | ||
private String title; | ||
private User user; | ||
private String createdAt; //생성시간 | ||
|
||
public UserPostDto(Post post , User user){ | ||
this.idx = post.getIdx(); | ||
this.title = post.getTitle(); | ||
this.user = user; | ||
this.createdAt = post.getCreatedAt().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); | ||
} | ||
} | ||
|
||
|
4 changes: 4 additions & 0 deletions
4
src/main/java/com/example/marumaru_sparta_verspring/repository/MeetRepository.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,7 +1,11 @@ | ||
package com.example.marumaru_sparta_verspring.repository; | ||
|
||
import com.example.marumaru_sparta_verspring.domain.meets.Meet; | ||
import com.example.marumaru_sparta_verspring.domain.profile.Profile; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.List; | ||
|
||
public interface MeetRepository extends JpaRepository<Meet, Long> { | ||
List<Meet> findByUserId(Long userId); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
.wrapper { | ||
width: 1140px; | ||
margin: 0 auto; | ||
max-width: 100%; | ||
padding: 0 15px; | ||
} | ||
|
||
.form { | ||
padding-top: 30px; | ||
margin-bottom: 30px; | ||
} | ||
|
||
.form .header { | ||
margin-bottom: 35px; | ||
padding-bottom: 35px; | ||
border-bottom: 1px solid #ddd; | ||
} | ||
|
||
.form .header .title { | ||
font-size: 25px; | ||
font-weight: bold; | ||
color: #1259a7; | ||
} | ||
|
||
.post_list_wrap { | ||
padding: 10px 150px; | ||
} | ||
|
||
.post_list_head, | ||
.post_list_body .item { | ||
padding: 10px 0; | ||
font-size: 0; | ||
} | ||
|
||
.post_list_head { | ||
border-top: 2px solid #3DB2FF; | ||
border-bottom: 1px solid; | ||
} | ||
|
||
.post_list_body .item { | ||
border-bottom: 1px solid; | ||
} | ||
|
||
.post_list_head > div, | ||
.post_list_body .item > div { | ||
display: inline-block; | ||
font-size: 14px; | ||
text-align: center; | ||
} | ||
|
||
.post_list .title { | ||
width: 60%; | ||
} | ||
|
||
.post_list .post_list_body .title { | ||
text-align: left; | ||
} | ||
|
||
.post_list .author { | ||
width: 15%; | ||
} | ||
|
||
.post_list .date { | ||
width: 15%; | ||
} |
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,4 +1,4 @@ | ||
ody { | ||
body { | ||
font-family: sans-serif; | ||
} | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
$(document).ready(function () { | ||
|
||
if (localStorage.getItem('token')) { | ||
$.ajaxPrefilter(function (options, originalOptions, jqXHR) { | ||
jqXHR.setRequestHeader('Authorization', 'Bearer ' + localStorage.getItem('token')); | ||
|
||
}); | ||
} else { | ||
alert('로그인을 해주세요') | ||
location.replace('/login') | ||
} | ||
|
||
$.ajax({ | ||
type: "GET", | ||
url: `/user/posts`, | ||
contentType: 'application/json; charset=utf-8', | ||
data: {}, | ||
success: function (response) { | ||
for(let i=0; i<response.length;i++){ | ||
let temp_html=` | ||
<div class="title"><a href="/posts/detail/${response[i]['idx']}">${response[i]['title']}</a></div> | ||
<div class="author">${response[i]['user']['username']}</div> | ||
<div class="date">${response[i]['createdAt']}</div>` | ||
$('#post_list').append(temp_html) | ||
} | ||
} | ||
}) | ||
}) | ||
|
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
Oops, something went wrong.