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

# API

## 유저 로그인

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

#### Headers

| Name            | Type    | Description |
| --------------- | ------- | ----------- |
| withcredentials | boolean | true        |

#### Request Body

| Name                                            | Type   | Description                                      |
| ----------------------------------------------- | ------ | ------------------------------------------------ |
| email<mark style="color:red;">\*</mark>         | String | <kimcoding@gmail.com>                            |
| password<mark style="color:red;">\*</mark>      | String | 1234                                             |
| login\_method<mark style="color:red;">\*</mark> | Int    | <p>0: general</p><p>1: kakao</p><p>2: google</p> |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    data: {
    accessToken: accessToken, // token
    id: int,
    email: string,
    nickname: string,
    login_method: int  
    }
}
```

{% endtab %}

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

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

```javascript
{
    "login err"
}
```

{% endtab %}
{% endtabs %}

## 카카오 소셜 로그인

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

#### Headers

| Name            | Type    | Description |
| --------------- | ------- | ----------- |
| withcredentials | Boolean | true        |

#### Request Body

| Name              | Type   | Description |
| ----------------- | ------ | ----------- |
| authorizationCode | String |             |
| login\_method     | Int    | 1:kakao     |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    data: {
    accessToken: accessToken, // token
    id: int,
    email: string,
    nickname: string,
    login_method: int  
    }
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

```javascript
{
    "login err"
}
```

{% endtab %}

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

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

## 구글 소셜 로그인

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

#### Headers

| Name            | Type    | Description |
| --------------- | ------- | ----------- |
| withcredentials | Boolean | true        |

#### Request Body

| Name              | Type   | Description           |
| ----------------- | ------ | --------------------- |
| authorizationCode | String |                       |
| login\_method     | Int    | 2:google              |
| email             | String | <kimcoding@gmail.com> |
| googleId          | Int    |                       |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    data: {
    accessToken: accessToken, // token
    id: int,
    email: string,
    nickname: string,
    login_method: int  
    }
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

```javascript
{
    "login err"
}
```

{% endtab %}

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

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

## 유저 회원가입

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

#### Headers

| Name            | Type    | Description |
| --------------- | ------- | ----------- |
| withcredentials | boolean | true        |

#### Request Body

| Name                                       | Type   | Description           |
| ------------------------------------------ | ------ | --------------------- |
| email<mark style="color:red;">\*</mark>    | String | <kimcoding@gmail.com> |
| password<mark style="color:red;">\*</mark> | String | 1234                  |
| nickname<mark style="color:red;">\*</mark> | String | kimcoding             |

{% tabs %}
{% tab title="201: Created " %}

```javascript
{
    "${email}"
}
```

{% endtab %}

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

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

## 이메일 중복검사

<mark style="color:blue;">`GET`</mark> `/user/emailcheck/email?email={email}`

#### Query Parameters

| Name                                    | Type   | Description           |
| --------------------------------------- | ------ | --------------------- |
| email<mark style="color:red;">\*</mark> | String | <kimcoding@gmail.com> |

#### Headers

| Name            | Type    | Description |
| --------------- | ------- | ----------- |
| withcredentials | Boolean | true        |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "can use"
}
```

{% endtab %}

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

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="409: Conflict " %}

```javascript
{
    "used email"
}
```

{% endtab %}
{% endtabs %}

## 닉네임 중복검사

<mark style="color:blue;">`GET`</mark> `/user/namecheck/nickname?nickname={nickname}`

#### Query Parameters

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

#### Headers

| Name            | Type    | Description |
| --------------- | ------- | ----------- |
| withcredentials | Boolean | true        |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "can use nickname"
}
```

{% endtab %}

{% tab title="409: Conflict " %}

```javascript
{
    "used nickname"
}
```

{% endtab %}

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

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

## 유저 로그아웃

<mark style="color:green;">`POST`</mark> `/user/logout/1 :/id`

#### Headers

| Name               | Type    | Description |
| ------------------ | ------- | ----------- |
| AuthorizationToken | String  |             |
| withcredentials    | Boolean | true        |

#### Request Body

| Name          | Type | Description                                      |
| ------------- | ---- | ------------------------------------------------ |
| login\_method | Int  | <p>0: general</p><p>1: kakao</p><p>2: google</p> |
| id            | Int  |                                                  |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "logout"
}
```

{% endtab %}

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

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

```javascript
{
    "not authorized"
}
```

{% endtab %}
{% endtabs %}

## 마이페이지 유저 정보가져오기

<mark style="color:blue;">`GET`</mark> `/user/mypage/id?id={id}`

#### Query Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| id   | int  |             |

#### Headers

| Name                                                 | Type    | Description |
| ---------------------------------------------------- | ------- | ----------- |
| AuthorizationToken<mark style="color:red;">\*</mark> | String  |             |
| withcredentials                                      | Boolean | true        |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
   data:{
   id: int
   email: string,
   nickname: string,
   }
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

```javascript
{
    "not authorized"
}
```

{% endtab %}

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

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

## 마이페이지 유저 정보변경

<mark style="color:orange;">`PUT`</mark> `/user/mypage/1 :/id`

#### Headers

| Name                                                 | Type    | Description |
| ---------------------------------------------------- | ------- | ----------- |
| AuthorizationToken<mark style="color:red;">\*</mark> | String  |             |
| withcredentials                                      | Boolean | true        |

#### Request Body

| Name          | Type   | Description                                      |
| ------------- | ------ | ------------------------------------------------ |
| username      | Int    | kimcoding                                        |
| password      | String | 1234                                             |
| email         | String | <kimcoding@gmail.com>                            |
| login\_method | Int    | <p>0: general</p><p>1: kakao</p><p>2: google</p> |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "edit ok"
}
```

{% endtab %}

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

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

## 마이페이지 회원탈퇴

<mark style="color:red;">`DELETE`</mark> `/user/mypage/1 :/id`

#### Headers

| Name               | Type    | Description |
| ------------------ | ------- | ----------- |
| AuthorizationToken | String  |             |
| withcredentials    | Boolean | true        |

#### Request Body

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

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "delete ok"
}
```

{% endtab %}

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

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

## 유저 사진조회

<mark style="color:blue;">`GET`</mark> `/fish/board/email?email={email}&&page?page={page}`

#### Query Parameters

| Name                                    | Type   | Description           |
| --------------------------------------- | ------ | --------------------- |
| email<mark style="color:red;">\*</mark> | String | <kimcoding@gmail.com> |
| page                                    | Int    | 1                     |

#### Headers

| Name                                                 | Type    | Description |
| ---------------------------------------------------- | ------- | ----------- |
| AuthorizationToken<mark style="color:red;">\*</mark> | String  |             |
| withcredentials                                      | Boolean | true        |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    data: {
     fish_name:string, 
     src: string,
     size: int,
     ranked: int,
     createdAt: createdAt
    }
    // if(!data)"No board"
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

```javascript
{
    "not authorized"
}
```

{% endtab %}

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

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

## 유저 사진 기록

<mark style="color:green;">`POST`</mark> `/fish/board/1 :/id`

#### Headers

| Name                                                 | Type    | Description |
| ---------------------------------------------------- | ------- | ----------- |
| AuthorizationToken<mark style="color:red;">\*</mark> | String  |             |
| withcredentials                                      | Boolean | true        |

#### Request Body

| Name       | Type   | Description                 |
| ---------- | ------ | --------------------------- |
| src        | String | image                       |
| fish\_name | String | 옥                           |
| size       | Int    | cm                          |
| ranked     | String | <p>0:false</p><p>1:true</p> |
| id         | Int    | user\_id                    |
| id         | Int    | fish\_id                    |

{% tabs %}
{% tab title="201: Created " %}

```javascript
{
    "${userId}"
}
```

{% endtab %}

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

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

## 유저 사진 수정

<mark style="color:orange;">`PUT`</mark> `/fish/board/1 :/id`

#### Headers

| Name                                                 | Type    | Description |
| ---------------------------------------------------- | ------- | ----------- |
| AuthorizationToken<mark style="color:red;">\*</mark> | String  |             |
| withcredentials                                      | Boolean | true        |

#### Request Body

| Name       | Type   | Description                   |
| ---------- | ------ | ----------------------------- |
| src        | String | image                         |
| fish\_name | String | 옥                             |
| size       | Int    | cm                            |
| ranked     | String | <p>0: false</p><p>1: true</p> |
| id         | Int    | user\_id                      |
| id         | Int    | fish\_id                      |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "edit ok"
}
```

{% endtab %}

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

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

```javascript
{
    "not authorized"
}
```

{% endtab %}
{% endtabs %}

## 유저 사진 삭제

<mark style="color:red;">`DELETE`</mark> `/fish/board/1 :/id`

#### Headers

| Name               | Type    | Description |
| ------------------ | ------- | ----------- |
| withcredentials    | Boolean | true        |
| AuthorizationToken | String  |             |

#### Request Body

| Name  | Type   | Description           |
| ----- | ------ | --------------------- |
| email | String | <kimcoding@gmail.com> |
|       | Int    | userId                |
|       | Int    | fishId                |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "deleted fish board"
}
```

{% endtab %}

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

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

```javascript
{
    "not authorized"
}
```

{% endtab %}
{% endtabs %}

## 유저 즐겨찾기 위치 조회

<mark style="color:blue;">`GET`</mark> `/map/email?email={email}`

#### Query Parameters

| Name  | Type   | Description           |
| ----- | ------ | --------------------- |
| email | String | <kimcoding@gmail.com> |

#### Headers

| Name               | Type    | Description |
| ------------------ | ------- | ----------- |
| AuthorizationToken | String  |             |
| withcredentials    | Boolean | true        |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    data: {
    id:int, //location_id
    location_name: string,
    lat: string,
    long: string
    }
}
```

{% endtab %}

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

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

```javascript
{
    "not authorized"
}
```

{% endtab %}
{% endtabs %}

## 유저 즐겨찾기 위치 등록

<mark style="color:green;">`POST`</mark> `/map/1 :/locationId`

#### Headers

| Name               | Type    | Description |
| ------------------ | ------- | ----------- |
| AuthorizationToken | String  |             |
| withcredentials    | Boolean | true        |

#### Request Body

| Name           | Type   | Description |
| -------------- | ------ | ----------- |
| lat            |        | '37.52637'  |
| long           | String | '128.38651' |
| location\_name | String | '옥돔 잘 잡히는곳' |
|                | Int    | userId      |

{% tabs %}
{% tab title="201: Created " %}

```javascript
{
    "${userId}"
}
```

{% endtab %}

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

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

```javascript
{
    "not authorized"
}
```

{% endtab %}
{% endtabs %}

## 유저 즐겨찾기 위치 이름수정

<mark style="color:purple;">`PATCH`</mark> `/map/1 :/locationId`

#### Headers

| Name               | Type    | Description |
| ------------------ | ------- | ----------- |
| AuthorizationToken | String  |             |
| withcredentials    | Boolean | true        |

#### Request Body

| Name           | Type   | Description  |
| -------------- | ------ | ------------ |
| locationId     | String | location\_id |
| location\_name | String |              |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "location_name change"
}
```

{% endtab %}

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

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

```javascript
{
    "not authorized"
}
```

{% endtab %}
{% endtabs %}

## 유저 즐겨찾기 위치 삭제

<mark style="color:red;">`DELETE`</mark> `/map/1 :/locationId`

#### Headers

| Name               | Type    | Description |
| ------------------ | ------- | ----------- |
| AuthorizationToken | String  |             |
| withcredentials    | Boolean | true        |

#### Request Body

| Name       | Type   | Description  |
| ---------- | ------ | ------------ |
| locationId | String | location\_id |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "deleted location"
}
```

{% endtab %}

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

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

```javascript
{
    "not authorized"
}
```

{% endtab %}
{% endtabs %}

## 품종별 크기 랭킹 조회

<mark style="color:blue;">`GET`</mark> `/ranking/fishName?fishName={fishName}&&email?email={email}`

#### Query Parameters

| Name     | Type   | Description           |
| -------- | ------ | --------------------- |
| email    | String | <kimcoding@gmail.com> |
| fishName | String | 옥                     |
| page     | Int    |                       |

#### Headers

| Name               | Type    | Description |
| ------------------ | ------- | ----------- |
| AuthorizationToken | String  |             |
| withcredentials    | Boolean | true        |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    data:{
    [
    {fish_name:string,
     src: string,
     size: int,
     ranked: int,
     nickname: String,
     createdAt: createdAt
    },{fish_name:string,
     src: string,
     size: int,
     ranked: int,
     createdAt: createdAt
    },{fish_name:string,
     src: string,
     size: int,
     ranked: int,
     createdAt: createdAt
    },{fish_name:string,
     src: string,
     size: int,
     ranked: int,
     createdAt: createdAt
    },{fish_name:string,
     src: string,
     size: int,
     ranked: int,
     createdAt: createdAt
    }
    ]
}
```

{% endtab %}

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

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

```javascript
{
    "not authorized"
}
```

{% endtab %}
{% endtabs %}
