Topic Update

입력한 데이터로 해당 Topic Instance를 최신화 시킵니다.

URL

/topic/<pk>/

Method

PATCH , PUT

Data Params

Key Description Type Require
name Topic의 이름 Str False
image Topic에 대한 이미지 File False
description Topic에 대한 설명 Str False

Update is only for Staff

Topic Update 는 일반 유저가 호출하는 것이 불가능합니다. Staff/SuperUser일 경우에만 호출할 수 있습니다.


Success Response

HTTP Status Code

201

Content

Key Description Type
pk Topic의 pk Int
url Topic Detail 페이지로의 링크 Str
creator Topic을 만든 유저의 Profile Detail 링크 str
name Topic의 이름 Str
description Topic에 대한 설명 Str
image Topic에 대한 썸네일 사진으로의 링크 Str
answer_count Topic과 관련된 답변의 개수 Int
question_count Topic과 관련된 질문의 개수 Int
expert_count Topic과 관련된 전문가 Follower수 Int
interest_count Topic과 관련된 관심 Follower수 Int
created_at 생성된 날짜 Date
modified_at 마지막으로 수정된 날짜 - 처음 생성되었을 때는 created_at과 같음 Date
{
    "pk": 26,
    "url": "http://localhost:8000/topic/26/",
    "creator": "http://localhost:8000/user/5/profile/main-detail/",
    "name": "수학",
    "description": "",
    "image": "http://localhost:8000/media/topic/26/1980_1080_Exhibition_0dH73zo.png",
    "answer_count": 0,
    "question_count": 0,
    "expert_count": 1,
    "interest_count": 1,
    "created_at": "2017-12-09T01:49:03.222649+09:00",
    "modified_at": "2017-12-12T16:32:46.139535+09:00"
}

Error Response

Bad Request Error

HTTP Status Code

400

Content

# name 중

{
    "error":"이미 존재하는 Topic 이름입니다."
}

Bad Request Error

HTTP Status Code

400

Content

# 파일이 Image가 아닐 경우

{
    "image": [
        "유효한 이미지 파일을 업로드 하십시오. 업로드 하신 파일은 이미지 파일이 아니거나 손상된 이미지 파일입니다."
    ]
}

Forbidden Error

HTTP Status Code

403

Content

# 삭제를 시도하는 유저가 본인이 아닐 경우
{
    "detail": "이 작업을 수행할 권한(permission)이 없습니다."
}

results matching ""

    No results matching ""