# Contents API

## Likes

<mark style="color:green;">`POST`</mark> `/content/likes`

Content Likes

#### Path Parameters

| Name                                       | Type   | Description |
| ------------------------------------------ | ------ | ----------- |
| idUser\*<mark style="color:red;">\*</mark> | String | User Id     |

#### Headers

| Name                                       | Type | Description |
| ------------------------------------------ | ---- | ----------- |
| cookie\*<mark style="color:red;">\*</mark> |      | accessToken |

{% tabs %}
{% tab title="200: OK Response content like OK" %}

```javascript
{
  "likes" : [
      { 
        "id" : PK,
        "content_type" : "movie",
        "content_category" : "동기부여",
        "content_name" : "성공적인 삶",
        "content_image": "https://allforyou.s3.amazonaws.com...",
        "like": 12
      }, ...
  ],
  "message" : "successfully click like"
}
```

{% endtab %}

{% tab title="500: Internal Server Error Response server error" %}

```javascript
{
    "data" null,
    "message" : "server error"
}
```

{% endtab %}
{% endtabs %}

## Data Type(Select 1) Category(Select 2) Individual Page

<mark style="color:blue;">`GET`</mark> `/contents/:categoryname/:typename/:sort`

첫번째 필터링(해당 타입),  두번째 필터링(해당 카테고리) 이 완료된 콘텐츠를 최신 순, 좋아요 순으로 조회하는 페이지

#### Query Parameters

| Name       | Type   | Description                          |
| ---------- | ------ | ------------------------------------ |
| type\*     | String | type name(movie, book, video, music) |
| category\* | String | category name(도전, 멘토, 동기부여 등 총 7개)   |

{% tabs %}
{% tab title="200: OK Response Data Type, Category Individual Page OK" %}

```javascript
{
    "content_type": "book",
    "content_category" : "동기부여",
    "contentInfo": {
        "id": PK,
        "content_name" : "성공적인 삶"
        "content_image": "https://allforyou.s3.amazonaws.com...",
        "content_creator": "JsonKim",
        "content_explanation": "성공은 멀리 있지 않다..."
        "like" : 12
        "createdAt": "2021-12-21T10:55:30.000Z",
        "updatedAt": "2021-12-21T10:55:30.000Z",
        "user_id": 1
    },
    "message" : "successfully viewed the data type (date) individual page"
}
```

{% endtab %}

{% tab title="500: Internal Server Error Response server error" %}

```javascript
{
    "data" null,
    "message" : "server error"
}
```

{% endtab %}
{% endtabs %}

## Data Type Individual Page

<mark style="color:blue;">`GET`</mark> `/contents/:typename`

해당 타입(책,영화,음악,동영상 중 택 1) 콘텐츠만 조회하는 페이지

#### Query Parameters

| Name   | Type   | Description                          |
| ------ | ------ | ------------------------------------ |
| type\* | String | type name(movie, book, video, music) |

{% tabs %}
{% tab title="200: OK Response Data Type Individual Page OK" %}

```javascript
{
    "content_type": "book",
    "contentInfo": {
        "id": PK,
        "content_category" : "동기부여",
        "content_name" : "성공적인 삶"
        "content_image": "https://allforyou.s3.amazonaws.com...",
        "content_creator": "JsonKim",
        "content_explanation": "성공은 멀리 있지 않다..."
        "like" : 12
        "createdAt": "2021-12-21T10:55:30.000Z",
        "updatedAt": "2021-12-21T10:55:30.000Z",
        "user_id": 1
    },
    "message" : "successfully viewed the data type individual page"
}
```

{% endtab %}

{% tab title="500: Internal Server Error Response server error" %}

```javascript
{
    "data" null,
    "message" : "server error"
}
```

{% endtab %}
{% endtabs %}

## Category Individual Page

<mark style="color:blue;">`GET`</mark> `/contents/categoryname`

해당 카테고리 콘텐츠만 조회하는 페이지

#### Query Parameters

| Name       | Type   | Description                        |
| ---------- | ------ | ---------------------------------- |
| category\* | String | category name(도전, 멘토, 동기부여 등 총 7개) |

{% tabs %}
{% tab title="200: OK Response Category Individual Page OK" %}

```javascript
{
    "content_category" : "우울 극복",
    "contentInfo": {
        "id": PK,
        "content_type": "book",
        "content_name" : "결국 당신은 이길 것이다"
        "content_image": "https://allforyou.s3.amazonaws.com...",
        "content_creator": "ParkCoding",
        "content_explanation": "인생을 송두리째 바꾼 가장 특별한 경험..."
        "like" : 20
        "createdAt": "2021-12-20T05:55:30.000Z",
        "updatedAt": "2021-12-20T05:55:30.000Z",
        "user_id": 1
    },
    "message" : "successfully viewed the category individual page"
}
```

{% endtab %}

{% tab title="500: Internal Server Error Response server error" %}

```javascript
{
    "data" null,
    "message" : "server error"
}
```

{% endtab %}
{% endtabs %}

## Content Detail Page

<mark style="color:blue;">`GET`</mark> `/contents/:contentsId`

해당 콘텐츠의 상세 페이지

#### Path Parameters

| Name                                          | Type   | Description |
| --------------------------------------------- | ------ | ----------- |
| idContent\*<mark style="color:red;">\*</mark> | String | Content Id  |

{% tabs %}
{% tab title="200: OK Response content detail page OK" %}

```javascript
{
    "contentInfo": {
        "id": PK,
        "content_type": "book",
        "content_category" : "우울 극복",
        "content_name" : "결국 당신은 이길 것이다"
        "content_image": "https://allforyou.s3.amazonaws.com...",
        "content_creator": "ParkCoding",
        "content_explanation": "인생을 송두리째 바꾼 가장 특별한 경험..."
        "like" : 20
        "createdAt": "2021-12-20T05:55:30.000Z",
        "updatedAt": "2021-12-20T05:55:30.000Z",
        "user_id": 1
    },
    "message" : "successfully viewed the details page"
}
```

{% endtab %}

{% tab title="500: Internal Server Error Response server error" %}

```javascript
{
    "data" null,
    "message" : "server error"
}
```

{% endtab %}
{% endtabs %}

## Content Show All

<mark style="color:blue;">`GET`</mark> `/contents`

콘텐츠 메인 페이지

{% tabs %}
{% tab title="200: OK Response contents show all OK" %}

```javascript
{
{
  "data" : [
      { 
        "id" : PK,
        "content_type" : "movie",
        "content_category" : "동기부여",
        "content_name" : "성공적인 삶",
        "content_image": "https://allforyou.s3.amazonaws.com...",
        "like" : 12
      },
      { 
        "id" : PK,
        "content_type" : "book",
        "content_category" : "우울 극복",
        "content_name" : "결국 당신은 이길 것이다",
        "content_image": "https://allforyou.s3.amazonaws.com...",
        "like" : 20
      },...
  ],
  "message" : "successfully contents show all"
}
```

{% endtab %}

{% tab title="500: Internal Server Error Response server error" %}

```javascript
{
    "data" null,
    "message" : "server error"
}
```

{% endtab %}
{% endtabs %}
