Boards - Gachon-P-project/Back GitHub Wiki

๊ฐœ์š”

์‚ฌ์šฉ์ž๊ฐ€ ๊ฒŒ์‹œํŒ์„ ์‚ฌ์šฉํ•˜๋Š” ์‚ฝ์ž…, ์กฐํšŒ, ์ˆ˜์ •, ์‚ญ์ œ ๋กœ์ง

๊ฒŒ์‹œ๋ฌผ ์ž‘์„ฑ

  • URL

    /boards/subject

  • Method

    POST

  • Data Params

์ด๋ฆ„ ์„ค๋ช… ํƒ€์ž… ํ•„์ˆ˜
post_title ๊ฒŒ์‹œ๊ธ€ ์ œ๋ชฉ VARCHAR(60) O
post_contents ๊ฒŒ์‹œ๊ธ€ ๋‚ด์šฉ VARCHAR(1000) O
major_name ์‚ฌ์šฉ์ž ํ•™๊ณผ VARCHAR(30) O
subject_name ๊ณผ๋ชฉ๋ช…(0 : ํ•™๊ณผ๊ฒŒ์‹œํŒ, 1 : ์ž์œ ๊ฒŒ์‹œํŒ) VARCHAR(30) O
professor_name ๊ต์ˆ˜๋ช…(0 : ํ•™๊ณผ๊ฒŒ์‹œํŒ, 1 : ์ž์œ ๊ฒŒ์‹œํŒ) VARCHAR(30) O
user_no ์‚ฌ์šฉ์ž ํ•™๋ฒˆ INT(11) O
board_flag ๊ฒŒ์‹œํŒ ์ข…๋ฅ˜(0 : ๊ณผ๋ชฉ๊ฒŒ์‹œํŒ, 1 : ์ž์œ ๊ฒŒ์‹œํŒ, 2 : ํ•™๊ณผ๊ฒŒ์‹œํŒ) O
  • Query String
์ด๋ฆ„ ์„ค๋ช… ํƒ€์ž… ํ•„์ˆ˜
reply_yn ๋Œ“๊ธ€ ์‚ฌ์šฉ ์œ ๋ฌด(0 : ์‚ฌ์šฉ์•ˆํ•จ, 1: ์‚ฌ์šฉ) VARCHAR(1) X
  • Sample Call
http://localhost:17394/boards/subject

or

http://localhost:17394/boards/subject?reply_yn=1
  • Data Input Exaple:
{ 
    "post_title" : "๊ฒŒ์‹œ๊ธ€ ์ž‘์„ฑ ํ…Œ์ŠคํŠธ ์ œ๋ชฉ",
    "post_contents" : "๊ฒŒ์‹œ๊ธ€ ์ž‘์„ฑ ํ…Œ์ŠคํŠธ ๋‚ด์šฉ",
    "major_name" : "์ปดํ“จํ„ฐ๊ณตํ•™๊ณผ",
    "subject_name" : "์ปดํ“จํ„ฐ๊ณตํ•™๊ฐœ๋ก ",
    "professor_name" : "๊น€์ง„์˜",
    "user_no" : "201739423"
}
  • Success Response
Code: 200
Content: { id : 12 }
  • Error Response
Code: 400 BAD REQUEST
Content: { error : "null ๊ฐ’์ด ์กด์žฌํ•ฉ๋‹ˆ๋‹ค." }

Code: 401 UNAUTHORIZED
Content: { error : "์ธ์ฆ ์‹คํŒจ" }

์ „์ฒด ๊ฒŒ์‹œ๋ฌผ ์กฐํšŒ

  • URL

    /boards/subject/:subject/:professor/:user_no/:page_num

  • Method

    GET

  • URL Params

์ด๋ฆ„ ์„ค๋ช… ํƒ€์ž… ํ•„์ˆ˜
subject ๊ณผ๋ชฉ๋ช… VARCHAR(30) O
professor ๊ต์ˆ˜๋ช… VARCHAR(30) O
user_no ์‚ฌ์šฉ์žํ•™๋ฒˆ INT(11) O
page_num ๊ฐ€์ ธ์˜ฌ ํŽ˜์ด์ง€ ๋ฒˆํ˜ธ(0๋ถ€ํ„ฐ ์‹œ์ž‘) INT(11) O
  • Sample Call
http://localhost:17394/boards/subject/์„œ๋ฒ„ํ”„๋กœ๊ทธ๋ž˜๋ฐ/์˜ค๊ธฐ์šฑ/201739412/0
  • Success Response
Code: 200
Content:
[
    {
        "post_no": 516,
        "post_title": "๊ฒŒ์‹œ๊ธ€ ์ž‘์„ฑ ํ…Œ์ŠคํŠธ ์ œ๋ชฉ",
        "post_contents": "๊ฒŒ์‹œ๊ธ€ ์ž‘์„ฑ ํ…Œ์ŠคํŠธ ๋‚ด์šฉ",
        "wrt_date": "2021. 1. 7. ์˜คํ›„ 12:57:03",
        "reply_yn": "1",
        "major_name": "์ปดํ“จํ„ฐ๊ณตํ•™๊ณผ",
        "subject_name": "์ปดํ“จํ„ฐ๊ณตํ•™๊ฐœ๋ก ",
        "professor_name": "๊น€์ง„์˜",
        "user_no": 201739423,
        "board_flag": "0",
        "nickname": "dddddun",
        "reply_cnt": 0,
        "like_cnt": 0,
        "like_user": 0
    }
]
  • Error Response
Code: 400 BAD REQUEST
Content: { error : "null ๊ฐ’์ด ์กด์žฌํ•ฉ๋‹ˆ๋‹ค." }

Code: 401 UNAUTHORIZED
Content: { error : "์ธ์ฆ ์‹คํŒจ" }

ํŠน์ • ๊ฒŒ์‹œ๋ฌผ ์กฐํšŒ

  • URL

    /boards/subject/:subject/:professor/:user_no/:word/:page_num

  • Method

    GET

  • URL Params

์ด๋ฆ„ ์„ค๋ช… ํƒ€์ž… ํ•„์ˆ˜
subject ๊ณผ๋ชฉ๋ช… VARCHAR(30) O
professor ๊ต์ˆ˜๋ช… VARCHAR(30) O
user_no ์‚ฌ์šฉ์žํ•™๋ฒˆ INT(11) O
word ๊ฒ€์ƒ‰ํ•  ๋‹จ์–ด String O
page_num ๊ฐ€์ ธ์˜ฌ ํŽ˜์ด์ง€ ๋ฒˆํ˜ธ(0๋ถ€ํ„ฐ ์‹œ์ž‘) INT(11) O
  • Sample Call
http://localhost:17394/boards/subject/์„œ๋ฒ„ํ”„๋กœ๊ทธ๋ž˜๋ฐ/์˜ค๊ธฐ์šฑ/201739412/ํ…Œ์ŠคํŠธ/2
  • Success Response
Code: 200
Content:

  • Error Response
Code: 400 BAD REQUEST
Content: { error : "null ๊ฐ’์ด ์กด์žฌํ•ฉ๋‹ˆ๋‹ค." }

Code: 401 UNAUTHORIZED
Content: { error : "์ธ์ฆ ์‹คํŒจ" }

๊ฒŒ์‹œ๋ฌผ ์ˆ˜์ •

  • URL

    /boards/subject

  • Method

    PUT

  • Data Params

์ด๋ฆ„ ์„ค๋ช… ํƒ€์ž… ํ•„์ˆ˜
post_no ์„ ํƒํ•œ ๊ฒŒ์‹œ๊ธ€์˜ ๊ธ€ ๋ฒˆํ˜ธ(์ „์ฒด ๊ธ€ ์กฐํšŒ์—์„œ post_no์œผ๋กœ ๋ฐ›์€ ๋ฒˆํ˜ธ) Int O
post_title ๊ฒŒ์‹œ๊ธ€ ์ œ๋ชฉ VARCHAR(60) O
post_contents ๊ฒŒ์‹œ๊ธ€ ๋‚ด์šฉ VARCHAR(1000) O
  • Data Input Exaple:
{ 
    "post_no" : "520"
    "post_title" : "๊ฒŒ์‹œ๊ธ€ ์ˆ˜์ • ํ…Œ์ŠคํŠธ ์ œ๋ชฉ",
    "post_contents" : "๊ฒŒ์‹œ๊ธ€ ์ˆ˜์ • ํ…Œ์ŠคํŠธ ๋‚ด์šฉ"
}
  • Sample Call
http://localhost:17394/boards/subject
  • Success Response
Code: 200
Content:
{
    "fieldCount": 0,
    "affectedRows": 1,
    "insertId": 0,
    "serverStatus": 2,
    "warningCount": 0,
    "message": "Rows matched: 1  Changed: 0  Warnings: 0",
    "protocol41": true,
    "changedRows": 0
}
  • Error Response
Code: 400 BAD REQUEST
Content: { error : "null ๊ฐ’์ด ์กด์žฌํ•ฉ๋‹ˆ๋‹ค." }

Code: 401 UNAUTHORIZED
Content: { error : "์ธ์ฆ ์‹คํŒจ" }

๊ฒŒ์‹œ๋ฌผ ์‚ญ์ œ

  • URL

    /boards/subject

  • Method

    DELETE

  • Data Params

์ด๋ฆ„ ์„ค๋ช… ํƒ€์ž… ํ•„์ˆ˜
post_no ์„ ํƒํ•œ ๊ฒŒ์‹œ๊ธ€์˜ ๊ธ€ ๋ฒˆํ˜ธ(์ „์ฒด ๊ธ€ ์กฐํšŒ์—์„œ post_no์œผ๋กœ ๋ฐ›์€ ๋ฒˆํ˜ธ) Int O
  • Data Input Exaple:
{ 
    "post_no" : "520"
}
  • Sample Call
http://localhost:17394/boards/subject
  • Success Response
Code: 200
Content:
{
    "fieldCount": 0,
    "affectedRows": 1,
    "insertId": 0,
    "serverStatus": 2,
    "warningCount": 0,
    "message": "",
    "protocol41": true,
    "changedRows": 0
}
  • Error Response
Code: 400 BAD REQUEST
Content: { error : "null ๊ฐ’์ด ์กด์žฌํ•ฉ๋‹ˆ๋‹ค." }

Code: 401 UNAUTHORIZED
Content: { error : "์ธ์ฆ ์‹คํŒจ" }
โš ๏ธ **GitHub.com Fallback** โš ๏ธ