Skip to content

프론트랑 통신 내용

hyeonic edited this page May 5, 2021 · 2 revisions

Question

  • 질의응답 게시판을 담당하는 질문 관련 도메인

create

POST /questions

-> request
{
    data: {
        targetUserId: (Long targetUserId),
        writerUserId: (Long writerUserId),
        title: (String title),
        content: (String content),
        status: (Boolean true or false),
        fix: (Boolean true or false)
    }
}
------------------------------------------------------------------------------------------------------------------------------
-> success response
{
    data: {
        id: (Long questionId),
        targetUser: {
            id: (Long userId),
            email: (String email),
            name: (String name)
        },
        writerUser: {
            id: (Long userId),
            email: (String email),
            name: (String name)
        },
        title: (String title),
        content: (String content),
        status: (Boolean true or false),
        fix: (Boolean true or false),
        view: (Integer view),
        createdDate: (LocalDateTime createdDate),
        lastModifiedDate: (LocalDateTime lastModifiedDate)
    }
}
------------------------------------------------------------------------------------------------------------------------------
-> fail response (존재하지 않는 user 일 때)
{
    errorMessage: 해당 user  존재하지 않습니다. id=(Long user),
    errorCode: 404
}

question 단 건 조회

GET /questions/{questionId}

-> success response
{
    data: {
        id: (Long questionId),
        targetUser: {
            id: (Long userId),
            email: (String email),
            name: (String name)
        },
        writerUser: {
            id: (Long userId),
            email: (String email),
            name: (String name)
        },
        title: (String title),
        content: (String content),
        status: (Boolean true or false),
        fix: (Boolean true or false),
        view: (Integer view),
        comments: [
            {
                id: (Long commentId),
                questionId: (Long questionId),
                writerUser: {
                    id: (Long userId),
                    email: (String email),
                    name: (String name)
                },
                content: (String content),
                children: [
                    {
                        id: (Long commentId),
                        questionId: (Long questionId),
                        writerUser: {
                            id: (Long userId),
                            email: (String email),
                            name: (String name)
                        },
                        content: (String content),
                        createdDate: (LocalDateTime createdDate),
                        lastModifiedDate: (LocalDateTime lastModifiedDate)
                    },
                    {...},
                    ...
                ],
                createdDate: (LocalDateTime createdDate),
                lastModifiedDate: (LocalDateTime lastModifiedDate)
            },
            {...},
            ...
        ],
        createdDate: (LocalDateTime createdDate),
        lastModifiedDate: (LocalDateTime lastModifiedDate)
    }
}
------------------------------------------------------------------------------------------------------------------------------
-> fail response (존재하지 않는 question 일 때)
{
    errorMessage: 해당 question 이 존재하지 않습니다. id=(Long question),
    errorCode: 404
}

target user 별 question 목록 (수정날짜 내림차순), (각 question에 댓글 및 대댓글 생성날짜 오름차순)

GET /users/{targetUserId}/questions

-> response
{
    data: [
        {
            id: (Long questionId),
            targetUser: {
                id: (Long userId),
                email: (String email),
                name: (String name)
            },
            writerUser: {
                id: (Long userId),
                email: (String email),
                name: (String name)
            },
            title: (String title),
            content: (String content),
            status: (Boolean true or false),
            fix: (Boolean true or false),
            view: (Integer view),
            comments: [
                {
                    id: (Long commentId),
                    questionId: (Long questionId),
                    writerUser: {
                        id: (Long userId),
                        email: (String email),
                        name: (String name)
                    },
                    content: (String content),
                    children: [
                        {
                            id: (Long commentId),
                            questionId: (Long questionId),
                            writerUser: {
                                id: (Long userId),
                                email: (String email),
                                name: (String name)
                            },
                            content: (String content),
                            createdDate: (LocalDateTime createdDate),
                            lastModifiedDate: (LocalDateTime lastModifiedDate)
                        },
                        {...},
                        ...
                    ],
                    createdDate: (LocalDateTime createdDate),
                    lastModifiedDate: (LocalDateTime lastModifiedDate)
                },
                {...},
                ...
            ],
            createdDate: (LocalDateTime createdDate),
            lastModifiedDate: (LocalDateTime lastModifiedDate)
        },
        {...},
        ...
    ]
}
------------------------------------------------------------------------------------------------------------------------------
-> fail response (존재하지 않는 user 일 때)
{
    errorMessage: 해당 user  존재하지 않습니다. id=(Long user),
    errorCode: 404
}

update

PUT /questions/{questionId}

-> request
{
    data: {
        targetUserId: (Long targetUserId),
        writerUserId: (Long writerUserId),
        title: (String title),
        content: (String content),
        status: (Boolean true or false),
        fix: (Boolean true or false)
    }
}
------------------------------------------------------------------------------------------------------------------------------
-> response
{
    data: {
        id: (Long questionId),
        targetUser: {
            id: (Long userId),
            email: (String email),
            name: (String name)
        },
        writerUser: {
            id: (Long userId),
            email: (String email),
            name: (String name)
        },
        title: (String title),
        content: (String content),
        status: (Boolean true or false),
        fix: (Boolean true or false),
        view: (Integer view),
        createdDate: (LocalDateTime createdDate),
        lastModifiedDate: (LocalDateTime lastModifiedDate)
    }
}

delete

DELETE /questions/{questionId}

-> response void

question 조회수 증가

POST /questions/{questionId}/views

-> response
{
    data: 1 게시물의 조회수하였습니다.,
    count: 1
}

comment

  • 질의응답 게시판 각 게시글에 들어가는 댓글 및 대댓글 관련 도메인

create

POST /comments

-> request
{
    data: {
        questionId: (Long questionId),
        writerUserId: (Long writerUserId),
        content: (String content),
        parentId: (Long parentId or null)
    }
}
------------------------------------------------------------------------------------------------------------------------------
-> response
{
    data: {
        id: (Long commentId),
        questionId: (Long questionId),
        writerUser: {
            id: (Long userId),
            email: (String email),
            name: (String name)
        },
        content: (String content),
        parentId:(Long parentId or null),
        createdDate: (LocalDateTime createdDate),
        lastModifiedDate: (LocalDateTime lastModifiedDate)
    }
}

comment 단 건 조회 -> 당장 필요해보이진 않는다.

GET /comments/{commentId}

-> response
{
    data: {
        id: (Long commentId),
        questionId: (Long questionId),
        writerUser: {
            email: (String email),
            name: (String name)
        },
        content: (String content),
        children: [
            {
                id: (Long commentId),
                questionId: (Long questionId),
                writerUser: {
                    email: (String email),
                    name: (String name)
                },
                content: (String content),
                createdDate: (LocalDateTime createdDate),
                lastModifiedDate: (LocalDateTime lastModifiedDate)
            },
            {
                id: (Long commentId),
                questionId: (Long questionId),
                writerUser: {
                    email: (String email),
                    name: (String name)
                },
                content: (String content),
                createdDate: (LocalDateTime createdDate),
                lastModifiedDate: (LocalDateTime lastModifiedDate)
            },
            {
                id: (Long commentId),
                questionId: (Long questionId),
                writerUser: {
                    email: (String email),
                    name: (String name)
                },
                content: (String content),
                createdDate: (LocalDateTime createdDate),
                lastModifiedDate: (LocalDateTime lastModifiedDate)
            }
            ...
        ],
        createdDate: (LocalDateTime createdDate),
        lastModifiedDate: (LocalDateTime lastModifiedDate)
    }
}

question 별 comment 목록 (생성 날짜 오름차순) -> 당장 필요해보이진 않는다.

GET /questions/{questionId}/comments

-> response
{
    data: [
        {
            id: (Long commentId),
            questionId: (Long questionId),
            writerUser: {
                email: (String email),
                name: (String name)
            },
            content: (String content),
            children: [
                {
                    id: (Long commentId),
                    questionId: (Long questionId),
                    writerUser: {
                        email: (String email),
                        name: (String name)
                    },
                    content: (String content),
                    createdDate: (LocalDateTime createdDate),
                    lastModifiedDate: (LocalDateTime lastModifiedDate)
                },
                {...},
                ...
            ],
            createdDate: (LocalDateTime createdDate),
            lastModifiedDate: (LocalDateTime lastModifiedDate)
        },
        {...},
        ...
    ]
}

update

PUT /comments/{commentId}

-> request
{
    data: {
        questionId: (Long questionId),
        writerUserId: (Long writerUserId),
        content: (String content),
        parentId: (Long parentId or null)
    }
}
-> response
{
    data: {
        id: (Long commentId),
        questionId: (Long questionId),
        writerUser: {
            id: (Long userId),
            email: (String email),
            name: (String name)
        },
        content: (String content),
        parentId:(Long parentId or null),
        createdDate: (LocalDateTime createdDate),
        lastModifiedDate: (LocalDateTime lastModifiedDate)
    }
}

delete

DELETE /comments/{commentId}

-> response void

Blog


create

POST /blogs

-> request
{
    data: {
        userId: (Long userId),
        profileImageUrl: (우선 공백 추후 추예정),
        content: (String content)
    }
}
------------------------------------------------------------------------------------------------------------------------------
-> response
{
    data: {
        id: (Long blogId),
        user: {
            id: (Long userId),
            email: (String email),
            name: (String name)
        },
        profileImageUrl: (우선 공백 추후 추예정),
        content: (String content),
        createdDate: (LocalDateTime createdDate),
        lastModifiedDate: (LocalDateTime lastModifiedDate)
    }
}

blog 단 건 조회

GET /blogs/{blogId}

{
    data: {
        id: (Long blogId),
        user: {
            id: (Long userId),
            email: (String email),
            name: (String name)
        },
        profileImageUrl: (우선 공백 추후 추예정),
        content: (String content),
        posts: [
            {
                id: (Long postId),
                blogId: (Long blogId),
                user: {
                    id: (Long userId),
                    email: (String email),
                    name: (String name)
                },
                title: (String title),
                content: (String content),
                createdDate: (LocalDateTime createdDate),
                lastModifiedDate: (LocalDateTime lastModifiedDate)
            },
            {...},
            ...
        ]
        createdDate: (LocalDateTime createdDate),
        lastModifiedDate: (LocalDateTime lastModifiedDate)
    }
}

blog 목록 조회 -> 다양한 정렬은 추후 추가될 예정

GET /blogs

{
    data: [
        {
            id: (Long blogId),
            user: {
                id: (Long userId),
                email: (String email),
                name: (String name)
            },
            profileImageUrl: (우선 공백 추후 추예정),
            content: (String content),
            createdDate: (LocalDateTime createdDate),
            lastModifiedDate: (LocalDateTime lastModifiedDate)
        },
        {...},
        ...
    ]
}

update

PUT /blogs/{blogId}

-> request
{
    data: {
        userId: (Long userId),
        profileImageUrl: (우선 공백 추후 추예정),
        content: (String content)
    }
}
------------------------------------------------------------------------------------------------------------------------------
-> response
{
    data: {
        id: (Long blogId),
        user: {
            id: (Long userId),
            email: (String email),
            name: (String name)
        },
        profileImageUrl: (우선 공백 추후 추예정),
        content: (String content),
        createdDate: (LocalDateTime createdDate),
        lastModifiedDate: (LocalDateTime lastModifiedDate)
    }
}

delete

DELETE /blogs/{blogId}

-> response void

Post (책장에 들어가는 게시글)


create

POST /posts

-> request
{
    data: {
        blogId: (Long blogId),
        title: (String title),
        content: (String content)
    }
}
------------------------------------------------------------------------------------------------------------------------------
-> response
{
    data: {
        id: (Long postId),
        blogId: (Long blogId),
        user: {
            id: (Long userId),
            email: (String email),
            name: (String name)
        },
        title: (String title),
        content: (String content),
        createdDate: (LocalDateTime createdDate),
        lastModifiedDate: (LocalDateTime lastModifiedDate)
    }
}

post 단 건 조회

GET /posts/{postId}

{
    data: {
        id: (Long postId),
        blogId: (Long blogId),
        user: {
            id: (Long userId),
            email: (String email),
            name: (String name)
        },
        title: (String title),
        content: (String content),
        createdDate: (LocalDateTime createdDate),
        lastModifiedDate: (LocalDateTime lastModifiedDate)
    }
}

update

PUT /posts/{postId}

-> request
{
    data: {
        blogId: (Long blogId),
        title: (String title),
        content: (String content)
    }
}
------------------------------------------------------------------------------------------------------------------------------
-> response
{
    data: {
        id: (Long postId),
        blogId: (Long blogId),
        user: {
            id: (Long userId),
            email: (String email),
            name: (String name)
        },
        title: (String title),
        content: (String content),
        createdDate: (LocalDateTime createdDate),
        lastModifiedDate: (LocalDateTime lastModifiedDate)
    }
}

delete

DELETE /posts/{postId}

-> response void

Follow

  • user를 follow 한 명단 관리

create

POST /follows

-> request
{
    data: {
        userId: (Long userId);
    }
}
------------------------------------------------------------------------------------------------------------------------------
-> response
{
    data: {
        id: (Long followId),
        userId: (Long userId),
        createdDate: (LocalDateTime createdDate),
        lastModifiedDate: (LocalDateTime lastModifiedDate)
    }
}

follow 목록 조회

GET /follows

{
    data: [
        {
            id: (Long followId),
            userId: (Long userId),
            createdDate: (LocalDateTime createdDate),
            lastModifiedDate: (LocalDateTime lastModifiedDate)
        },
        {...},
        ...
    ],
    count: (Integer count) // follow 명 수
}

delete -> follow 취소

DELETE /follows/{followId}

-> response void

post 조회수 증가

POST /posts/{postId}/views

-> response void
Clone this wiki locally