dnd-side-project / dnd-mentee-3rd-6-repo

dnd 3기 6조 문서
2 stars 4 forks source link

피드 API #78

Closed chaeyun17 closed 3 years ago

chaeyun17 commented 4 years ago

태그 조회

요청

GET /api/tags

응답

[
    {
        "id": 1,
        "name": "냥이보고가세요"
    },
    {
        "id": 2,
        "name": "찾아주세요냥이"
    }
]

피드 조회

요청

GET /api/feeds 파라미터

응답

{
  "pageNumber": 0,
  "pageSize": 10,
  "totalPages": 50,
  "isLast": false,
  "isFirst": true,
  "contents": [
    {
      "id": 1,
      "content": "연탄이는 오늘도 식빵 굽굽",
      "tag": {
        "id": 1,
        "name": "태그명1"
      },
      "images": [
        {
          "id": 1,
          "url": "/img-files/1"
        },
        {
          "id": 2,
          "url": "/img-files/2"
        }
      ],
      "author": {
        "id": 1,
        "nickName": "연탄범벅 연탄이네",
        "profileImg": "/img-files/3",
        "addressName": "분당구 정자 2동"
      },
      "comments": [
        {
          "id": 1,
          "content": "넘 귀여운거 아닌가요?!",
          "numberOfLikes": 10,
          "numberOfReplies": 1,
          "createdDateTime": "2020-01-02T21:23:00",
          "timeDesc": "3시간 전",
          "isLike": false,
          "author": {
            "id": 1,
            "nickName": "연탄범벅 연탄이네",
            "profileImg": "/img-files/3",
            "addressName": "수지구 풍덕천동"
          },
          "replies": [
            {
              "id": 1,
              "content": "까미랑 보리랑",
              "numberOfLikes": 3,
              "isLike": true,
              "createdDateTime": "2020-01-02T21:23:00",
              "timeDesc": "5시간 전",
              "author": {
                "id": 1,
                "nickName": "연탄범벅 연탄이네",
                "profileImg": "/img-files/3",
                "addressName": "수지구 풍덕천동"
              }
            }
          ]
        }
      ],
      "isLike": false,
      "numberOfLikes": 15,
      "numberOfComments": 6,
      "createdDateTime": "2020-01-02T21:23:00",
      "timeDesc": "6시간전"
    },
    {
      "id": 2,
      "content": "아롱이가 오랜만에 손에 쭙쭙이를",
      "tag": {
        "id": 1,
        "name": "태그명1"
      },
      "images": [
        {
          "id": 1,
          "url": "/img-files/10"
        },
        {
          "id": 2,
          "url": "/img-files/11"
        }
      ],
      "author": {
        "id": 1,
        "nickName": "아롱이네",
        "profileImg": "/img-files/3",
        "addressName": "서초구 서초1동"
      },
      "comments": [
        {
          "id": 1,
          "content": "넘 귀여운거 아닌가요?!",
          "numberOfLikes": 10,
          "numberOfReplies": 1,
          "createdDateTime": "2020-01-02T21:23:00",
          "timeDesc": "3시간 전",
          "author": {
            "id": 1,
            "nickName": "연탄범벅 연탄이네",
            "profileImg": "/img-files/3",
            "addressName": "수지구 풍덕천동"
          },
          "replies": {
            "id": 1,
            "content": "까미랑 보리랑",
            "numberOfLikes": 3,
            "createdDateTime": "2020-01-02T21:23:00",
            "timeDesc": "5시간 전",
            "author": {
              "id": 1,
              "nickName": "연탄범벅 연탄이네",
              "profileImg": "/img-files/3",
              "addressName": "수지구 풍덕천동"
            }
          }
        }
      ],
      "isLike": true,
      "numberOfLikes": 15,
      "numberOfComments": 6,
      "createdDateTime": "2020-01-02T21:23:00",
      "timeDesc": "6시간전"
    }
  ]
}

피드 작성하기

요청

POST /api/feeds Content-Type Multipart-form-data Authorization Bearer {accessToken}

응답

{
  "id": 1,
  "content": "연탄이는 오늘도 식빵 굽굽",
  "images": [
    {
      "id": 1,
      "url": "/img-files/1"
    },
    {
      "id": 2,
      "url": "/img-files/2"
    }
  ],
  "author": {
    "id": 1,
    "nickName": "연탄범벅 연탄이네",
    "profileImg": "/img-files/3",
    "addressName": "분당구 정자 2동"
  },
 "tag": {"id": 1, "name": "태그이름1"},
  "comments": [],
  "isLike": false,
  "numberOfLikes": 0,
  "numberOfComments": 0,
  "createdDateTime": "2020-01-02T21:23:00",
  "timeDesc": "1초 전"
}

특정 피드 조회하기

요청

GET /api/feeds/1 Authorization Bearer {accessToken}

응답

{
    "id": 23,
    "content": "안녕하세요 본문입니다.",
    "images": [
        {
            "id": 103,
            "url": "/api/imgfiles/103"
        },
        {
            "id": 104,
            "url": "/api/imgfiles/104"
        }
    ],
    "author": {
        "id": 28,
        "nickName": "어드민2",
        "profileImg": "/api/imgfiles/5",
        "addressName": "부산광역시 해운대구 우동"
    },
    "isLike": false,
    "numberOfLikes": 0,
    "numberOfComments": 2,
    "createdDateTime": "2020-09-05T21:10:36.336326",
    "timeDesc": "어제",
    "comments": [
        {
            "id": 10,
            "content": "안녕하세요.2",
            "numberOfLikes": 0,
            "replies": [
                {
                    "id": 8,
                    "content": "넘 귀여운거 아닌가요?!",
                    "numberOfLikes": 0,
                    "createdDateTime": "2020-09-06T03:21:21.963283",
                    "timeDesc": "2 분 전",
                    "author": {
                        "id": 28,
                        "nickName": "어드민2",
                        "profileImg": "/api/imgfiles/5",
                        "addressName": "부산광역시 해운대구 우동"
                    },
                    "like": false
                }
            ],
            "numberOfReplies": 1,
            "isLike": false,
            "createdDateTime": "2020-09-05T21:10:48.772064",
            "timeDesc": "어제",
            "author": {
                "id": 28,
                "nickName": "어드민2",
                "profileImg": "/api/imgfiles/5",
                "addressName": "부산광역시 해운대구 우동"
            }
        },
        {
            "id": 11,
            "content": "안녕하세요.2",
            "numberOfLikes": 0,
            "replies": [],
            "numberOfReplies": 0,
            "isLike": false,
            "createdDateTime": "2020-09-06T03:12:37.962670",
            "timeDesc": "11 분 전",
            "author": {
                "id": 28,
                "nickName": "어드민2",
                "profileImg": "/api/imgfiles/5",
                "addressName": "부산광역시 해운대구 우동"
            }
        }
    ]
}

피드 수정하기

요청

PUT /api/feeds/1 Content-Type Multipart-form-data Authorization Bearer {accessToken}

응답

{
    "id": 4,
    "content": "수정본문입니다.",
    "tag": {
            "id": 1,
            "name": "냥이보고가세요"
        },
    "images": [
        {
            "id": 23,
            "url": "/api/imgfiles/23"
        },
        {
            "id": 24,
            "url": "/api/imgfiles/24"
        },
        {
            "id": 34,
            "url": "/api/imgfiles/34"
        },
        {
            "id": 35,
            "url": "/api/imgfiles/35"
        }
    ],
    "author": {
        "id": 28,
        "nickName": "어드민2",
        "profileImg": "/api/imgfiles/5",
        "addressName": "부산광역시 해운대구 우동"
    },
    "comments": [
        {
            "id": 3,
            "content": "ddd",
            "numberOfLikes": 0,
            "replies": [],
            "numberOfReplies": 0,
            "isLike": false,
            "createdDateTime": "2020-01-02T03:04:05",
            "timeDesc": "3 일 전",
            "author": {
                "id": 26,
                "nickName": "홍길동",
                "profileImg": "/api/imgfiles/5",
                "addressName": "부산광역시 해운대구 우동",
                "cats": []
            }
        }
    ],
    "isLike": true,
    "numberOfLikes": 3,
    "numberOfComments": 1,
    "createdDateTime": "2020-09-05T00:38:41.153905",
    "timeDesc": "12 시간 전",
    "cat": {
        "id": 4,
        "name": "냥이1",
        "features": "밥잘먹",
        "kindName": "페르시안",
        "gender": "MALE",
        "birthday": "2019-01-02",
        "neutralized": "TRUE",
        "weight": 3.5,
        "profileImgUrl": null
    }
}

피드 삭제하기

요청

DELETE /api/feeds/1

응답

{
    "id": 2,
    "content": "",
    "tag": null,
    "images": [],
    "author": {
        "id": 0,
        "nickName": "",
        "profileImg": "",
        "addressName": ""
    },
    "comments": [],
    "isLike": false,
    "numberOfLikes": 0,
    "numberOfComments": 0,
    "createdDateTime": null,
    "timeDesc": "0분전",
    "cat": null
}
jjunnnys commented 4 years ago

특정 피드 조회는 검색으로 찾는 피드인가요?🤔

chaeyun17 commented 4 years ago

메모 삭제 시, id 반환

chaeyun17 commented 4 years ago

@jjunnnys 피드 조회,수정,삭제,한개조회 API 사용가능합니다.

피드 조회 API 에서 페이지네이션만 적용되어 있으며, 다른 파라미터는 아직 구현이 안되어있습니다. 구현 예정입니다.

jjunnnys commented 4 years ago

피드 작성 시에 고양이 프로필이 필요한데 어떻게 하면 좋을까요??🤔 @chaeyun17