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

# 영화 리뷰

## 특정 영화에 대한 리뷰 작성 (한 영화에 유저는 한 개의 리뷰만 작성 가능)

<mark style="color:green;">`POST`</mark> `http://127.0.0.1:8000/api/movies/<int:movie_pk>/reviewCreate/`

#### Headers

| Name                                            | Type   | Description                    |
| ----------------------------------------------- | ------ | ------------------------------ |
| Authorization<mark style="color:red;">\*</mark> | String | "Bearer " + 발급 받은 access token |

#### Request Body

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

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

````json
```json
{
    "id": 1,
    "likes": [],
    "likes_count": 0,
    "user": {
        "id": 1,
        "password": "****",
        "last_login": null,
        "username": "username",
        "email": "email",
        "first_name": "False",
        "last_name": "False",
        "is_superuser": false,
        "is_active": true,
        "is_staff": false,
        "created_at": "2023-11-20T00:25:29.788726Z",
        "updated_at": "2023-11-20T00:25:29.788745Z",
        "social": false,
        "gender": true,
        "birth": "1999-12-24",
        "age": 23,
        "groups": [],
        "user_permissions": []
    },
    "content": "content",
    "rating": 2.0,
    "movie": 34308
}
```
````

{% endtab %}
{% endtabs %}

## 특정 영화 리뷰 모두 조회

<mark style="color:blue;">`GET`</mark> `http://127.0.0.1:8000/api/movies/<int:movie_pk>/review/`

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

````json
```json
[
    {
        "id": 1,
        "likes": [],
        "likes_count": 0,
        "user": {
            "id": 1,
            "password": "****",
            "last_login": null,
            "username": "username",
            "email": "email",
            "first_name": "False",
            "last_name": "False",
            "is_superuser": false,
            "is_active": true,
            "is_staff": false,
            "created_at": "2023-11-20T00:25:29.788726Z",
            "updated_at": "2023-11-20T00:25:29.788745Z",
            "social": false,
            "gender": true,
            "birth": "1999-12-24",
            "age": 23,
            "groups": [],
            "user_permissions": []
        },
        "content": "content",
        "rating": 2.0,
        "movie": 34308
    },
    {
        "id": 2,
        "likes": [],
        "likes_count": 0,
        "user": {
            "id": 2,
            "password": "****",
            "last_login": null,
            "username": "username",
            "email": "email",
            "first_name": "False",
            "last_name": "False",
            "is_superuser": false,
            "is_active": true,
            "is_staff": false,
            "created_at": "2023-11-20T00:25:29.788726Z",
            "updated_at": "2023-11-20T00:25:29.788745Z",
            "social": false,
            "gender": true,
            "birth": "1999-12-24",
            "age": 24,
            "groups": [],
            "user_permissions": []
        },
        "content": "content",
        "rating": 5.0,
        "movie": 34308
    }
]
```
````

{% endtab %}
{% endtabs %}

## 본인이 작성한 리뷰 수정

<mark style="color:orange;">`PUT`</mark> `http://127.0.0.1:8000/api/movies/<int:movie_pk>/<int:review_pk>/`

#### Headers

| Name                                            | Type   | Description                    |
| ----------------------------------------------- | ------ | ------------------------------ |
| Authorization<mark style="color:red;">\*</mark> | String | "Bearer " + 발급 받은 access token |

#### Request Body

| Name    | Type   | Description |
| ------- | ------ | ----------- |
| content | String |             |
| rating  | Float  |             |

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

````json
```json
{
    "id": 1,
    "likes": [],
    "likes_count": 0,
    "user": {
        "id": 1,
        "password": "****",
        "last_login": null,
        "username": "username",
        "email": "email",
        "first_name": "False",
        "last_name": "False",
        "is_superuser": false,
        "is_active": true,
        "is_staff": false,
        "created_at": "2023-11-20T00:25:29.788726Z",
        "updated_at": "2023-11-20T00:25:29.788745Z",
        "social": false,
        "gender": true,
        "birth": "1999-12-24",
        "age": 23,
        "groups": [],
        "user_permissions": []
    },
    "content": "content",
    "rating": 2.0,
    "movie": 34308
}
```
````

{% endtab %}
{% endtabs %}

## 본인이 작성한 리뷰 삭제

<mark style="color:red;">`DELETE`</mark> `http://127.0.0.1:8000/api/movies/<int:movie_pk>/<int:review_pk>/`

#### Headers

| Name                                            | Type   | Description                    |
| ----------------------------------------------- | ------ | ------------------------------ |
| Authorization<mark style="color:red;">\*</mark> | String | "Bearer " + 발급 받은 access token |

{% tabs %}
{% tab title="204: No Content " %}

````json
```json
{
    "message": "delete success"
}
```
````

{% endtab %}
{% endtabs %}

## 유저와 동일한 성별 및 연령대 영화 평점 조회

<mark style="color:blue;">`GET`</mark> `http://127.0.0.1:8000/api/movies/<int:movie_pk>/user_group_rating/`

{% tabs %}
{% tab title="200: OK 유저와 같은 성별과 연령대를 가진 사람들의 평점 제공" %}

{% endtab %}
{% endtabs %}

## 성별 및 연령대 별 영화 평점 조회

<mark style="color:blue;">`GET`</mark> `http://127.0.0.1:8000/api/movies/<int:movie_pk>/group_rating/`

{% tabs %}
{% tab title="200: OK 각 성별 및 연령대 별 평점과 리뷰 수를 제공" %}

{% endtab %}
{% endtabs %}
