Major board - Gachon-P-project/Back GitHub Wiki

๊ฐœ์š”

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

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

  • URL

    /boards/major

  • Method

    POST

  • Data Params

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

or

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

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

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

  • URL

    /boards/major/:board_flag/:user_no/:major/:page_num

  • Method

    GET

  • URL Params

์ด๋ฆ„ ์„ค๋ช… ํƒ€์ž… ํ•„์ˆ˜
board_flag ๊ฒŒ์‹œํŒ ์ข…๋ฅ˜(0 : ๊ณผ๋ชฉ๊ฒŒ์‹œํŒ, 1 : ์ž์œ ๊ฒŒ์‹œํŒ, 2 : ํ•™๊ณผ๊ฒŒ์‹œํŒ) INT(11) O
user_no ์‚ฌ์šฉ์žํ•™๋ฒˆ INT(11) O
major ํ•™๊ณผ ์ด๋ฆ„ varchar(30) O
page_num ๊ฐ€์ ธ์˜ฌ ํŽ˜์ด์ง€ ๋ฒˆํ˜ธ(0๋ถ€ํ„ฐ ์‹œ์ž‘) INT(11) O
  • Sample Call
http://localhost:17394/boards/major/2/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": "์ปดํ“จํ„ฐ๊ณตํ•™๊ณผ",
        "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/major/:board_flag/:user_no/:major/:word/:page_num

  • Method

    GET

  • URL Params

์ด๋ฆ„ ์„ค๋ช… ํƒ€์ž… ํ•„์ˆ˜
board_flag ๊ฒŒ์‹œํŒ ์ข…๋ฅ˜(0 : ๊ณผ๋ชฉ๊ฒŒ์‹œํŒ, 1 : ์ž์œ ๊ฒŒ์‹œํŒ, 2 : ํ•™๊ณผ๊ฒŒ์‹œํŒ) INT(11) O
user_no ์‚ฌ์šฉ์žํ•™๋ฒˆ INT(11) O
major ํ•™๊ณผ ์ด๋ฆ„ varchar(30) O
word ๊ฒ€์ƒ‰ํ•  ๋‹จ์–ด String O
page_num ๊ฐ€์ ธ์˜ฌ ํŽ˜์ด์ง€ ๋ฒˆํ˜ธ(0๋ถ€ํ„ฐ ์‹œ์ž‘) INT(11) O
  • Sample Call
http://localhost:17394/boards/major/2/201739412/์ปดํ“จํ„ฐ๊ณตํ•™๊ณผ/ํ…Œ์ŠคํŠธ/0
  • Success Response
Code: 200
Content:

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

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

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

  • URL

    /boards/major

  • 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/major
  • 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/major

  • Method

    DELETE

  • Data Params

์ด๋ฆ„ ์„ค๋ช… ํƒ€์ž… ํ•„์ˆ˜
post_no ์„ ํƒํ•œ ๊ฒŒ์‹œ๊ธ€์˜ ๊ธ€ ๋ฒˆํ˜ธ(์ „์ฒด ๊ธ€ ์กฐํšŒ์—์„œ post_no์œผ๋กœ ๋ฐ›์€ ๋ฒˆํ˜ธ) INT(11) O
  • Data Input Exaple:
{ 
    "post_no" : "520"
}
  • Sample Call
http://localhost:17394/boards/major
  • 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** โš ๏ธ