Skip to content

프론트랑 통신 내용

her0807 edited this page May 2, 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)
    }
}
------------------------------------------------------------------------------------------------------------------------------
-> 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)
    }
}

question 단 건 조회

GET /questions/{questionId}

-> 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)
    }
}

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)
        },
        {...},
        ...
    ]
}

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 void

comment

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

create

POST /comments

-> request
{
    data: {
        questionId: (Long questionId),
        writerUserId: (Long writerUserId),
        content: (String content),
        parent: (Comment parent or null)
    }
}
------------------------------------------------------------------------------------------------------------------------------
-> response
{
    data: {
        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)
    }
}

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),
        parent: (Comment parent or null)
    }
}
-> response
{
    data: {
        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)
    }
}

delete

DELETE /comments/{commentId}

-> response void

Blog


create

POST /blogs

-> request
{
    data: {
        blogId: (Long blogId),
        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