> For the complete documentation index, see [llms.txt](https://trip-itinerary-sns-api.gitbook.io/toyproject-03/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trip-itinerary-sns-api.gitbook.io/toyproject-03/trip/undefined-3.md).

# 여행 댓글

여행 댓글 등록, 삭제 api

## 여행 댓글을 등록합니다.&#x20;

<mark style="color:green;">`POST`</mark> `http://localhost:8080/trip/{tripId}/reply`

선택한 여행에 댓글을 등록합니다.

#### Path Parameters

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

#### Request Body

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

{% tabs %}
{% tab title="200: OK 댓글 등록 성공" %}

```json
{
    "status": "OK",
    "msg": "댓글이 등록되었습니다.",
    "data": {
        "replyId": 16,
        "userId": 1,
        "tripId": 19,
        "content": "테스트 댓글10"
    }
}
```

{% endtab %}

{% tab title="404: Not Found 여행 정보가 없음" %}

```json
{
    "status": "NOT_FOUND",
    "code": "NO_SUCH_TRIP",
    "msg": "해당하는 여행 정보가 없습니다."
}
```

{% endtab %}

{% tab title="400: Bad Request 댓글 공백 입력시" %}

```
{
    "status": "BAD_REQUEST",
    "code": "BAD_REQUEST",
    "msg": "댓글을 채워주세요."
}
```

{% endtab %}
{% endtabs %}

## 여행 댓글을 수정합니다.&#x20;

<mark style="color:orange;">`PUT`</mark> `http://localhost:8080/trip/{tripId}/reply/{replyId}`

내가 작성한  댓글을 수정합니다.

#### Path Parameters

| Name                                     | Type | Description |
| ---------------------------------------- | ---- | ----------- |
| tripId<mark style="color:red;">\*</mark> | Long |             |
| replyId                                  | Long |             |

#### Request Body

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

{% tabs %}
{% tab title="200: OK 댓글 수정 성공" %}

```json
{
    "status": "OK",
    "msg": "댓글이 성공적으로 수정되었습니다.",
    "data": {
        "replyId": 13,
        "userId": 2,
        "tripId": 19,
        "content": "댓글 수정 test"
    }
}
```

{% endtab %}

{% tab title="400: Bad Request 다른 사용자의 댓글을 수정하려할때" %}

```json
{
    "status": "BAD_REQUEST",
    "code": "INVALID_REPLY_OPERATION",
    "msg": "댓글 작업이 유효하지 않습니다."
}
```

{% endtab %}

{% tab title="404: Not Found 삭제된 댓글을 수정" %}

```json
{
    "status": "NOT_FOUND",
    "code": "REPLY_NOT_FOUND",
    "msg": "댓글을 찾을 수 없습니다."
}
```

{% endtab %}

{% tab title="400: Bad Request 댓글 공백 입력시 " %}

```
{
    "status": "BAD_REQUEST",
    "code": "BAD_REQUEST",
    "msg": "댓글을 채워주세요."
}
```

{% endtab %}
{% endtabs %}

## 여행 댓글을 조회합니다.

<mark style="color:blue;">`GET`</mark> `http://localhost:8080/trip/{tripId}/reply`

해당 여행의 댓글 목록을 조회합니다.

#### Path Parameters

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

{% tabs %}
{% tab title="200: OK 댓글 조회 성공" %}

````json
```json
{
    "status": "OK",
    "msg": "댓글 성공적으로 조회되었습니다.",
    "data": [
        {
            "replyId": 6,
            "userId": 2,
            "tripId": 19,
            "content": "테스트 댓글"
        },
        {
            "replyId": 7,
            "userId": 2,
            "tripId": 19,
            "content": "테스트 댓글2"
        }
    ]    
}

````

{% endtab %}
{% endtabs %}

## 여행 댓글을 삭제합니다.&#x20;

<mark style="color:red;">`DELETE`</mark> `http://localhost:8080/api/trip/{tripId}/reply/{replyId}`

내가 등록한 댓글을 삭제합니다.

#### Path Parameters

| Name                                      | Type | Description |
| ----------------------------------------- | ---- | ----------- |
| tripId<mark style="color:red;">\*</mark>  | Long |             |
| replyId<mark style="color:red;">\*</mark> | Long |             |

{% tabs %}
{% tab title="200: OK 댓글 삭제 성공" %}

```json
{
    "status": "OK",
    "msg": "댓글이 성공적으로 삭제되었습니다.",
    "data": null
}
```

{% endtab %}

{% tab title="404: Not Found 없는 댓글 삭제" %}

```json
{
    "status": "NOT_FOUND",
    "code": "REPLY_NOT_FOUND",
    "msg": "댓글을 찾을 수 없습니다."
}
```

{% endtab %}

{% tab title="400: Bad Request 다른 사용자의 댓글 삭제" %}

```json
{
    "status": "BAD_REQUEST",
    "code": "INVALID_REPLY_OPERATION",
    "msg": "댓글 작업이 유효하지 않습니다."
}
```

{% endtab %}
{% endtabs %}
