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 : "์ธ์ฆ ์คํจ" }