# Uristorage

## Users

## Signup

<mark style="color:green;">`POST`</mark> `http://uristorage/users/signup`

User signup

#### Request Body

| Name                                       | Type   | Description   |
| ------------------------------------------ | ------ | ------------- |
| id<mark style="color:red;">\*</mark>       | string | user id       |
| password<mark style="color:red;">\*</mark> | string | user password |
| email<mark style="color:red;">\*</mark>    | string | user email    |
| nickname<mark style="color:red;">\*</mark> | String | user nickname |

{% tabs %}
{% tab title="422: Unprocessable Entity 기입 누락" %}

```javascript
{
    "insufficient parameters supplied"
}
```

{% endtab %}

{% tab title="409: Conflict 이미 존재" %}

```javascript
{
    "exists"
}
```

{% endtab %}

{% tab title="201: Created 생성" %}

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

{% endtab %}
{% endtabs %}

## Login

<mark style="color:green;">`POST`</mark> `http://uristorage/users/login`

User login

#### Request Body

| Name                                       | Type   | Description   |
| ------------------------------------------ | ------ | ------------- |
| userId<mark style="color:red;">\*</mark>   | String | user id       |
| password<mark style="color:red;">\*</mark> | String | user password |

{% tabs %}
{% tab title="200: OK Response login user data table" %}

```javascript
{
   "message": "로그인 성공",
    "success": true
}
```

{% endtab %}

{% tab title="401: Unauthorized Login fail message" %}

```javascript
{ "Invalid user or Wrong password" }
```

{% endtab %}

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

```javascript
err
```

{% endtab %}
{% endtabs %}

## Logout

<mark style="color:green;">`POST`</mark> `http://uristorage/users/logout`

User logout

#### Headers

| Name          | Type   | Description |
| ------------- | ------ | ----------- |
| Authorization | String |             |

{% tabs %}
{% tab title="205: Reset Content " %}

```
{
    "logout"
}
```

{% endtab %}

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

```javascript
err
```

{% endtab %}
{% endtabs %}

## 유저 닉네임 존재여부 확인

<mark style="color:green;">`POST`</mark> `http://uristorage/users/nickname`

그룹원 추가 시 닉네임 존재여부 확인

#### Headers

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

#### Request Body

| Name                                       | Type   | Description |
| ------------------------------------------ | ------ | ----------- |
| nickname<mark style="color:red;">\*</mark> | String | 그룹 추가시킬 닉네임 |

{% tabs %}
{% tab title="200: OK Response user info" %}

```javascript
{ message: "존재하는 닉네임입니다.", success: true }
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
{ message: "존재하지 않는 닉네임입니다.", success: false }
```

{% endtab %}
{% endtabs %}

## 로그인 유저 정보 조회

<mark style="color:blue;">`GET`</mark> `http://uristorage/users`

#### Headers

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

{% tabs %}
{% tab title="200: OK Response user info" %}

```javascript
{
    "userid" : "yonggar"
    "nickname" : "yonggar"
    "email" : "yonggar89@gmail.com",
    "image" : "./image/defaulf_profile.jpg",
    "createdAt": "2022-05-25",
    "updatedAt": "2022-05-26"
}
```

{% endtab %}
{% endtabs %}

## 유저 정보 변경

<mark style="color:orange;">`PUT`</mark> `http://uristorage/users`

#### Headers

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

{% tabs %}
{% tab title="200: OK 수정 완료" %}

```javascript
{
    message: "개인정보 수정 완료", success: true
}
```

{% endtab %}

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

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

{% endtab %}
{% endtabs %}

## 회원 탈퇴

<mark style="color:red;">`DELETE`</mark> `http://uristorage/users`

#### Headers

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

{% tabs %}
{% tab title="200: OK 삭제 완료" %}

```javascript
{
    "success"
}
```

{% endtab %}

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

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

{% endtab %}
{% endtabs %}

## Groups

## 그룹 생성

<mark style="color:green;">`POST`</mark> `http://uristorage/groups`

#### Request Body

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

{% tabs %}
{% tab title="200: OK Response user info" %}

```javascript
{
    "name" : "friends"
    "image" : "./image/defaulf_profile.jpg",
}
```

{% endtab %}
{% endtabs %}

## 그룹 멤버 조회

<mark style="color:blue;">`GET`</mark> `http://uristorage/groups/members/:id`

groups.id로 그룹정보, 그룹원 정보 조

#### Path Parameters

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

{% tabs %}
{% tab title="200: OK 해당 그룹 정보와 그룹 구성원 정보" %}

```javascript
{
    "name": "프로젝트",
    "image": null,
    "members": [
        {
            "nickname": "test1",
            "user_group": {
                "users_id": 2,
                "groups_id": 26
            }
        },
        {
            "nickname": "test2",
            "user_group": {
                "users_id": 3,
                "groups_id": 26
            }
        }
    ],
    "success": true
}
```

{% endtab %}
{% endtabs %}

## 해당 유저가 속한 그룹 정보 조회

<mark style="color:blue;">`GET`</mark> `http://uristorage/groups/user/:id`

users.id로 해당 유저의 그룹들을 조회

#### Path Parameters

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

{% tabs %}
{% tab title="200: OK Response user info" %}

```javascript
{
    "userGroups": [
        {
            "name": "project",
            "image": null,
            "user_group": {
                "users_id": 1,
                "groups_id": 1
            }
        },
        {
            "name": "구로고",
            "image": null,
            "user_group": {
                "users_id": 1,
                "groups_id": 2
            }
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## 그룹 정보 변경

<mark style="color:orange;">`PUT`</mark> `http://uristorage/groups/:id`

groups.id로 해당 그룹 정보 변

#### Request Body

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

{% tabs %}
{% tab title="200: OK 수정 완료" %}

```javascript
{
    "success"
}
```

{% endtab %}

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

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

{% endtab %}
{% endtabs %}

## 그룹 삭제

<mark style="color:red;">`DELETE`</mark> `http://uristorage/groups/:id`

#### Path Parameters

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

{% tabs %}
{% tab title="205: Reset Content 삭제 완료" %}

```javascript
{
    message: "삭제 되었습니다.", success: true
}
```

{% endtab %}

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

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

{% endtab %}
{% endtabs %}

## Words

## 단어 생성

<mark style="color:green;">`POST`</mark> `http://uristorage/words`

#### Request Body

| Name                                        | Type    | Description |
| ------------------------------------------- | ------- | ----------- |
| users\_id<mark style="color:red;">\*</mark> | String  |             |
| word<mark style="color:red;">\*</mark>      | String  |             |
| summary<mark style="color:red;">\*</mark>   | String  |             |
| content<mark style="color:red;">\*</mark>   | String  |             |
| image                                       | String  |             |
| map                                         | String  |             |
| calendar                                    | String  |             |
| pub<mark style="color:red;">\*</mark>       | Boolean |             |

{% tabs %}
{% tab title="201: Created Response user info" %}

```javascript
{
 "message": "하스스톤:운빨망겜"
}
```

{% endtab %}
{% endtabs %}

## 단어 정보 변경 생성

<mark style="color:orange;">`PUT`</mark> `http://uristorage/words`

#### Request Body

| Name                                        | Type    | Description |
| ------------------------------------------- | ------- | ----------- |
| users\_id<mark style="color:red;">\*</mark> | String  |             |
| word<mark style="color:red;">\*</mark>      | String  |             |
| summary<mark style="color:red;">\*</mark>   | String  |             |
| content<mark style="color:red;">\*</mark>   | String  |             |
| image                                       | String  |             |
| map                                         | String  |             |
| calendar                                    | String  |             |
| pub<mark style="color:red;">\*</mark>       | Boolean |             |
| <mark style="color:red;">\*</mark>          | String  |             |

{% tabs %}
{% tab title="201: Created Response user info" %}

```javascript
{
 "message": "하스스톤:운빨망겜"
}
```

{% endtab %}
{% endtabs %}

## 전체 공개 단어 정보 조회

<mark style="color:blue;">`GET`</mark> `http://uristorage/words/public`

{% tabs %}
{% tab title="200: OK Response user info" %}

```javascript
[
    {
        "users_id": "1",
        "word": "우정"
        "summary": "우정 요약"
        "content": "우정 단어 상세 설명"
        "image": null,
        "public": "true",
        "type": "1",
        "map": null
        "calendar" : null
     },
     {
        "users_id": "2",
        "word": "해운"
        "summary": "해운 요약"
        "content": "해운 단어 상세 설명"
        "image": "/image/해운대.jpg"
        "public": "true",
        "type": "3",
        "map": "134,34"
        "calendar" : null
     }
]
```

{% endtab %}
{% endtabs %}

## words.users\_id로 해당 유저 단어조회

<mark style="color:blue;">`GET`</mark> `http://uristorage/words/user/:users_id`

#### Path Parameters

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

{% tabs %}
{% tab title="200: OK Response user info" %}

```javascript
  [
    {
        "users_id": "1",
        "word": "우정"
        "summary": "우정 요약"
        "content": "우정 단어 상세 설명"
        "image": null,
        "public": "true",
        "type": "1",
        "map": null
        "calendar" : null
     },
     {
        "users_id": "2",
        "word": "우"
        "summary": "우정 요약2"
        "content": "우정 단어 상세 설명2"
        "image": null
        "public": "false",
        "type": "1",
        "map": null
        "calendar" : null
     }
]
```

{% endtab %}
{% endtabs %}

## groups.id로 해당 그룹에 단어조회

<mark style="color:blue;">`GET`</mark> `http://uristorage/words/group/:id`

#### Path Parameters

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

{% tabs %}
{% tab title="200: OK Response user info" %}

```javascript
{
    "groupWords": [
        {
            "users_id": 1,
            "word": "여사친",
            "summary": "없음",
            "content": "그런거 없음",
            "image": null,
            "type": null,
            "word_group": {
                "words_id": 5,
                "groups_id": 1
            }
        },
        {
            "users_id": 1,
            "word": "우정",
            "summary": "친구",
            "content": "친구친구친구",
            "image": null,
            "type": null,
            "word_group": {
                "words_id": 6,
                "groups_id": 1
            }
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## 단어 삭제

<mark style="color:red;">`DELETE`</mark> `http://uristorage/word/:id`

#### Path Parameters

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

{% tabs %}
{% tab title="200: OK Response user info" %}

```javascript
{
    message: "단어를 삭제 했습니다."
}
```

{% endtab %}
{% endtabs %}
