# USER

## 이메일 중복확인

<mark style="color:green;">`POST`</mark> `/user/email`

#### Request Body

| Name                                    | Type   | Description |
| --------------------------------------- | ------ | ----------- |
| email<mark style="color:red;">\*</mark> | string | 가입할 이메일     |

{% tabs %}
{% tab title="200: OK 이메일이 중복되지 않음" %}

```javascript
{
    "message":"ok"
}
```

{% endtab %}

{% tab title="409: Conflict 이메일이 중복됨" %}

```javascript
{
    "message":"email exists"
}
```

{% endtab %}
{% endtabs %}

## 회원탈퇴하기

<mark style="color:red;">`DELETE`</mark> `/user/withdrawal`

#### Headers

| Name                                          | Type   | Description |
| --------------------------------------------- | ------ | ----------- |
| accesstoken<mark style="color:red;">\*</mark> | string | 엑세스 토큰      |

{% tabs %}
{% tab title="200: OK 회원탈퇴 성공" %}

```javascript
{
    "message":"ok"
}
```

{% endtab %}

{% tab title="403: Forbidden 회원탈퇴 실패" %}

```javascript
{
    "message":"invalid token"
}
```

{% endtab %}
{% endtabs %}

## 로그아웃하기

<mark style="color:green;">`POST`</mark> `/user/signout`

#### Headers

| Name                                          | Type   | Description |
| --------------------------------------------- | ------ | ----------- |
| accesstoken<mark style="color:red;">\*</mark> | string | 엑세스 토큰      |

{% tabs %}
{% tab title="205: Reset Content 로그아웃 성공" %}

```javascript
{
    "message":"Logged out successfully"
}
```

{% endtab %}

{% tab title="500: Internal Server Error 로그아웃 실패" %}

```javascript
{
    "message":"server error"
}
```

{% endtab %}

{% tab title="403: Forbidden 토큰이 없거나 유효하지 않은 경우" %}

```javascript
{
    "message":"invalid token"
}
```

{% endtab %}
{% endtabs %}

## 유저 이미지 수정하기

<mark style="color:purple;">`PATCH`</mark> `/user/img`

#### Query Parameters

| Name                                 | Type    | Description |
| ------------------------------------ | ------- | ----------- |
| id<mark style="color:red;">\*</mark> | integer | 유저 아이디      |

#### Headers

| Name                                          | Type   | Description |
| --------------------------------------------- | ------ | ----------- |
| accesstoken<mark style="color:red;">\*</mark> | string | 엑세스 토큰      |

#### Request Body

| Name                                  | Type   | Description |
| ------------------------------------- | ------ | ----------- |
| img<mark style="color:red;">\*</mark> | string | 유저 이미지      |

{% tabs %}
{% tab title="200: OK 이미지 수정 성공" %}

```javascript
{ 
    "img":"/uploads/image.png"
}
```

{% endtab %}

{% tab title="403: Forbidden 이미지 수정 실패" %}

```javascript
{
    "message":"fail"
}
```

{% endtab %}
{% endtabs %}

## 유저 닉네임 수정하기

<mark style="color:purple;">`PATCH`</mark> `/user/nickname`

#### Query Parameters

| Name                                 | Type    | Description |
| ------------------------------------ | ------- | ----------- |
| id<mark style="color:red;">\*</mark> | integer | 유저 아이디      |

#### Headers

| Name                                          | Type   | Description |
| --------------------------------------------- | ------ | ----------- |
| accesstoken<mark style="color:red;">\*</mark> | string | 엑세스 토큰      |

#### Request Body

| Name                                       | Type   | Description |
| ------------------------------------------ | ------ | ----------- |
| nickname<mark style="color:red;">\*</mark> | string | 유저 닉네임      |

{% tabs %}
{% tab title="200: OK 닉네임 수정 성공" %}

```javascript
{
    "nickname":"김코딩"
}
```

{% endtab %}

{% tab title="403: Forbidden 닉네임 수정 실패" %}

```javascript
{
    "message":"fail"
}
```

{% endtab %}
{% endtabs %}

## 유저 자기소개 수정하기

<mark style="color:purple;">`PATCH`</mark> `/user/intro`

#### Query Parameters

| Name                                 | Type    | Description |
| ------------------------------------ | ------- | ----------- |
| id<mark style="color:red;">\*</mark> | integer | 유저 아이디      |

#### Headers

| Name                                          | Type   | Description |
| --------------------------------------------- | ------ | ----------- |
| accesstoken<mark style="color:red;">\*</mark> | string | 엑세스 토큰      |

#### Request Body

| Name                                    | Type   | Description |
| --------------------------------------- | ------ | ----------- |
| intro<mark style="color:red;">\*</mark> | string | 유저 자기소개     |

{% tabs %}
{% tab title="200: OK 자기소개 수정 성공" %}

```javascript
{
    "intro":"안녕하세요. 김코딩입니다."
}
```

{% endtab %}

{% tab title="403: Forbidden 자기소개 수정 실패" %}

```javascript
{
    "message":"fail"
}
```

{% endtab %}
{% endtabs %}

## 유저 정보 조회하기

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

#### Query Parameters

| Name                                 | Type    | Description |
| ------------------------------------ | ------- | ----------- |
| id<mark style="color:red;">\*</mark> | integer | 유저 아이디      |

#### Headers

| Name                                          | Type   | Description |
| --------------------------------------------- | ------ | ----------- |
| accesstoken<mark style="color:red;">\*</mark> | string | 엑세스 토큰      |

{% tabs %}
{% tab title="200: OK 유저 정보 조회 성공 서울시 " %}

```javascript
{
    "img":"/uploads/image.png",
    "email":"test@naver.com",
    "address":"서울특별시 서초구 서초대로 396, 강남빌딩 20층",
    "intro":"안녕하세요. 김코딩입니다.",
    "nickname":"김코딩"
}
```

{% endtab %}

{% tab title="403: Forbidden 유저 정보 조회 실패" %}

```javascript
{
    "message":"fail"
}
```

{% endtab %}
{% endtabs %}

## 회원가입하기

<mark style="color:green;">`POST`</mark> `/user/signup`

#### Request Body

| Name                                       | Type   | Description |
| ------------------------------------------ | ------ | ----------- |
| email<mark style="color:red;">\*</mark>    | string | 유저 이메일      |
| address<mark style="color:red;">\*</mark>  | string | 유저 주소       |
| password<mark style="color:red;">\*</mark> | string | 유저 비밀번호     |

{% tabs %}
{% tab title="201: Created 회원가입 성공" %}

```javascript
{
    "message":"ok"
}
```

{% endtab %}

{% tab title="409: Conflict 회원가입 실패 (중복된 이메일)" %}

```javascript
{
    "message":"email exists"
}
```

{% endtab %}
{% endtabs %}

## 로그인하기

<mark style="color:green;">`POST`</mark> `/user/signin`

#### Request Body

| Name                                       | Type   | Description |
| ------------------------------------------ | ------ | ----------- |
| email<mark style="color:red;">\*</mark>    | string | 유저 이메일      |
| password<mark style="color:red;">\*</mark> | string | 유저 비밀번호     |

{% tabs %}
{% tab title="200: OK 로그인 성공" %}

```javascript
{
    "message":"ok",
    "accesstoken":"accesstoken"
}
```

{% endtab %}

{% tab title="404: Not Found 로그인 실패" %}

```javascript
{
    "message":"invalid user"
}
```

{% endtab %}
{% endtabs %}
