> For the complete documentation index, see [llms.txt](https://minseokgos-organization.gitbook.io/api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://minseokgos-organization.gitbook.io/api/reference/api/post.md).

# Post

## 게시물 등록

## 게시물 등록

<mark style="color:green;">`POST`</mark> `http://localhost:8080/posts/write`

회원이 게시물을 등록할 수 있도록 합니다.

#### Headers

| Name                                    | Type   | Description    |
| --------------------------------------- | ------ | -------------- |
| token<mark style="color:red;">\*</mark> | String | 로그인 시 발급받은 JWT |

#### Request Body

| Name                                      | Type    | Description |
| ----------------------------------------- | ------- | ----------- |
| title<mark style="color:red;">\*</mark>   | String  | 게시물 제목      |
| content<mark style="color:red;">\*</mark> | String  | 게시물 내용      |
| time<mark style="color:red;">\*</mark>    | String  | 원하는 공유 시간대  |
| people<mark style="color:red;">\*</mark>  | Integer | 원하는 공유 인원   |
| place<mark style="color:red;">\*</mark>   | String  | 원하는 공유 장소   |
| menu<mark style="color:red;">\*</mark>    | String  | 원하는 메`뉴`    |

{% tabs %}
{% tab title="200: OK 게시물 등록 성공" %}

```json
{
    "success": true,
    "response": null,
    "error": null
}
```

{% endtab %}

{% tab title="400: Bad Request 잘못된 요청" %}

```json
{
    "success": false,
    "response": null,
    "error": {
        "message": "해당 요청은 잘못되었습니다.",
        "status": 400
    }
}
```

{% endtab %}

{% tab title="401: Unauthorized 인증되지 않았을 때" %}

```json
{
    "success": false,
    "response": null,
    "error": {
        "message": "인증되지 않았습니다.",
	"status": 401
    }
}
```

{% endtab %}

{% tab title="500: Internal Server Error 서버의 알 수 없는 에러" %}

```json
{
    "success": false,
    "response": null,
    "error": {
        "message": "서버의 알 수 없는 에러입니다.",
        "status": 500
    }
}
```

{% endtab %}
{% endtabs %}

## 전체 게시물 조회

## 전체 게시물 조회

<mark style="color:blue;">`GET`</mark> `http://localhost:8080/posts`

전체 게시물을 화면에 로딩 합니다.

{% tabs %}
{% tab title="200: OK 전체 게시물 조회 성공" %}

```json
{
    "success": true,
    "response": {
        "posts": [    //게시물 리스트 시작
        {
            "idx": 1,
            "image": "https://postfiles.pstatic.net/MjAyMDA5MDdfMjM2/MDAxNTk5NDUwMDU3MTMx.R3LJwbRiMdZcwnqlJ4nRG5EbSi8KLyYMBdbgbw95dHog.VKCpNcHkFkAGL8bGiZTAM8zWyoGJtVvVA0tz7s-y82wg.JPEG.gaonnuri51/Untitled-1.jpg?type=w966",
            "title": "굽네치킨 나눠드실 분?",
            "time": "17시~22시",
            "place" "연산동",
            "people": 2
        },
        {
            "idx": 2,
            "image": "놀자포차 가게 상표 링크"
            "title": "놀자포차에서 한잔 하실 분",
            "time": "17시~22시",
            "place" "밀양캠퍼스 앞",
            "people": 9999
        },
        ... ]    //게시물 리스트 끝
    },
    "error": null
}
```

{% endtab %}

{% tab title="400: Bad Request 잘못된 요청" %}

```json
{
    "success": false,
    "response": null,
    "error": {
        "message": "해당 요청은 잘못되었습니다.",
        "status": 400
    }
}
```

{% endtab %}

{% tab title="500: Internal Server Error 서버의 알 수 없는 에러" %}

```json
{
    "success": false,
    "response": null,
    "error": {
        "message": "서버의 알 수 없는 에러입니다.",
        "status": 500
    }
}
```

{% endtab %}
{% endtabs %}

## 게시물 조회

## 게시물 조회

<mark style="color:blue;">`GET`</mark> `http://localhost:8080/posts/{id}`

개별 게시물을 조회합니다.

{% tabs %}
{% tab title="200: OK 게시물 조회 성공" %}

```json
{
    "success": true,
    "response": {
        "idx": 1,
        "title": "굽네치킨 나눠드실 분?",
        "content": "같이 드실분 찾습니다. 자메이카 통다리 두 조각씩 먹어요.",
        "author": "MinseokGo",
        "address": "연산동"
        "createAt": "2시간 전",
        "time": "17시~22시",
        "place" "연산동",
        "people": 2,
        "options": [
            {
                "idx": 1,
                "optionName": "뼈치킨",
                "quantity": 5
            },
            {
                "idx": 10,
                "optionName": "콜라 라지 변경",
                "quantity": 5
            }
        ]
        "image": "https://postfiles.pstatic.net/MjAyMDA5MDdfMjM2/MDAxNTk5NDUwMDU3MTMx.R3LJwbRiMdZcwnqlJ4nRG5EbSi8KLyYMBdbgbw95dHog.VKCpNcHkFkAGL8bGiZTAM8zWyoGJtVvVA0tz7s-y82wg.JPEG.gaonnuri51/Untitled-1.jpg?type=w966",
        "shopName": "굽네치킨 부산안락점",
        "tip": 3000
    },
    "error": null
}
```

{% endtab %}

{% tab title="400: Bad Request 잘못된 요청" %}

```json
{
    "success": false,
    "response": null,
    "error": {
        "message": "해당 요청은 잘못되었습니다.",
        "status": 400
    }
}
```

{% endtab %}

{% tab title="404: Not Found 해당 게시물을 찾을 수 없을 때" %}

```json
{
    "success": false,
    "response": null,
    "error": {
        "message": "해당 게시물을 찾을 수 없습니다.",
        "status": 404
    }
}
```

{% endtab %}

{% tab title="500: Internal Server Error 서버의 알 수 없는 에러" %}

```json
{
    "success": false,
    "response": null,
    "error": {
        "message": "서버의 알 수 없는 에러입니다.",
        "status": 500
    }
}
```

{% endtab %}
{% endtabs %}

## 게시물 수정

## 게시물 수정

<mark style="color:orange;">`PUT`</mark> `http://localhost:8080/posts/update`

게시물을 수정합니다.

#### Headers

| Name                                    | Type   | Description    |
| --------------------------------------- | ------ | -------------- |
| token<mark style="color:red;">\*</mark> | String | 로그인 시 발급받은 JWT |

#### Request Body

| Name                                      | Type   | Description |
| ----------------------------------------- | ------ | ----------- |
| title<mark style="color:red;">\*</mark>   | String | 게시물 제목      |
| content<mark style="color:red;">\*</mark> | String | 게시물 내용      |
| time<mark style="color:red;">\*</mark>    | String | 원하는 공유 시간대  |
| place<mark style="color:red;">\*</mark>   | String | 원하는 공유 장소   |
| people<mark style="color:red;">\*</mark>  | String | 원하는 공유 인원   |
| idx                                       | String | 게시물의 고유 아이디 |

{% tabs %}
{% tab title="200: OK 게시물 수정 성공" %}

```json
{
    "success": true,
    "response": null,
    "error": null
}
```

{% endtab %}

{% tab title="400: Bad Request 잘못된 요청" %}

```json
{
    "success": false,
    "response": null,
    "error": {
        "message": "해당 요청은 잘못되었습니다.",
        "status": 400
    }
}
```

{% endtab %}

{% tab title="401: Unauthorized 인증되지 않았을 때" %}

```json
{
    "success": false,
    "response": null,
    "error": {
        "message": "인증되지 않았습니다.",
	"status": 401
    }
}
```

{% endtab %}

{% tab title="500: Internal Server Error 서버의 알 수 없는 에러" %}

```json
{
    "success": false,
    "response": null,
    "error": {
        "message": "서버의 알 수 없는 에러입니다.",
        "status": 500
    }
}
```

{% endtab %}
{% endtabs %}

## 게시물 삭제

## 게시물 삭제

<mark style="color:red;">`DELETE`</mark> `http://localhost:8080/posts/delete`

게시물을 삭제합니다.

#### Headers

| Name                                    | Type   | Description    |
| --------------------------------------- | ------ | -------------- |
| token<mark style="color:red;">\*</mark> | String | 로그인 시 발급받은 JWT |

#### Request Body

| Name                                  | Type   | Description |
| ------------------------------------- | ------ | ----------- |
| idx<mark style="color:red;">\*</mark> | String | 게시물의 고유 아이디 |

{% tabs %}
{% tab title="200: OK 게시물 삭제 성공" %}

```json
{
    "success": true,
    "response": null,
    "error": null
}
```

{% endtab %}

{% tab title="400: Bad Request 잘못된 요청" %}

```json
{
    "success": false,
    "response": null,
    "error": {
        "message": "해당 요청은 잘못되었습니다.",
        "status": 400
    }
}
```

{% endtab %}

{% tab title="401: Unauthorized 인증되지 않았을 때" %}

```json
{
    "success": false,
    "response": null,
    "error": {
        "message": "인증되지 않았습니다.",
	"status": 401
    }
}
```

{% endtab %}

{% tab title="500: Internal Server Error 서버의 알 수 없는 에러" %}

```json
{
    "success": false,
    "response": null,
    "error": {
        "message": "서버의 알 수 없는 에러입니다.",
        "status": 500
    }
}
```

{% endtab %}
{% endtabs %}
