# Docs
- Image Directory: /public/Image/
- Route List
| url | Method | Description |
| -------- | -------- | -------- |
| /api/signup | POST | 新增管理員帳號 |
| /api/login | POST | 登入 |
| /api/ct | POST | 確認權杖(測試用) |
| /api/banner/latest | GET | 取得最新 Banner 資訊 |
| /api/board/leader | GET / PUT | 理事長的話 |
| /api/board/{id}/store-image | POST | 上傳理事長的照片 |
| /api/news/list/cat/{id} | GET | |
| /api/news/create | POST | |
| /api/news/{id} | PUT / DELETE | |
| /api/news/{id}/store-image | POST | |
| /api/activity/list/cat/{id} | GET | |
| /api/activity/create | POST | |
| /api/activity/{id} | PUT / DELETE | |
| /api/activity/{id}/store-image | POST | |
| /api/activity/{id}/delete-image | POST | |
---
### 取得最新 Banner 資訊
```
[GET] /api/banner/latest
```
###### Response:
| Name | Type | Description |
| ------------- | ------- | ------------- |
| success | boolean | |
| message | string | error message |
| data | object | |
| data.news | object | 最新消息 |
| data.activity | object | 最新活動紀錄 |
<!-- | data.news.id | int | |
| data.news.title | string | |
| data.news.content | array | |
| data.news.content[].title | string | |
| data.news.content[].content | string | |
| data.news.image | string | filename (uuid.type) |
| data.news.link | string | url |
| data.news.link_alt | string | text for the link |
| data.news.ts | int | standard unix Timestamp |
| data.news.ord | int | |
| data.news.del | int | |
| data.news.created_at | int | standard unix Timestamp (GMT+0) |
| data.news.updated_at | int | standard unix Timestamp (GMT+0) | -->
---
### 理事長的話
```
[GET] /api/board/leader
```
###### Response:
| Name | Type | Description |
| --------------- | ------- | ----------------------- |
| success | boolean | |
| message | string | error message |
| data | object | Response |
| .data.id | int | |
| data.content | string | |
| data.image | string | filename (uuid.type) |
| data.updated_at | int | standard unix Timestamp |
| data.created_at | int | standard unix Timestamp |
```
{
"success": true,
"message": "",
"data": {
"id": 1,
"content": "test_api_",
"image": "",
"created_at": "2022-05-26 10:32:24",
"updated_at": "2022-05-26 10:38:52"
}
}
```
---
```
[PUT] /api/board/leader
```
###### Content:
| Name | Type | Description |
| -------- | -------- | -------- |
| content | string | |
###### Response:
| Name | Type | DescriptiqaC*+-----------------------------------------------------------------------------------------------FV0OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO/*...........................................................................................................................................................................................................................................................................................................................................................................................................------ | -------- | -------- |
| success | boolean | |
| message | string | error message |
```
{
"success": true,
"message": ""
}
```
---
### 最新消息
```
[GET] /api/news/list/cat/{id}
```
###### Response:
| Name | Type | Description |
| -------- | -------- | -------- |
| success | boolean | |
| message | string | error message |
| data | array | |
| data[].id | int | |
| data[].title | string | |
| data[].content | array | |
| data[].content[].title | string | |
| data[].content[].content | string | |
| data[].image | string | filename (uuid.type) |
| data[].link | string | url |
| data[].link_alt | string | text for the link |
| data[].ts | int | standard unix Timestamp |
| data[].ord | int | |
| data[].del | int | |
| data[].created_at | int | standard unix Timestamp (GMT+0) |
| data[].updated_at | int | standard unix Timestamp (GMT+0) |
```
{
"success": true,
"message": "",
"data": [
{
"id": 1,
"title": "test",
"content": [
{
"title": "【台復新創之星預選--DEMO DAY】活動辦法",
"content": "為發揮台復新創會對台大/復旦新創生態圈產生更積極的正面效應,讓台復會從事新創事業的學長姐,能夠獲得關注,並鏈接更多新創資源,特於年中會議舉辦本活動,為新創學長姐搭建舞台,吸引重量級創投、加速器以及業務夥伴的目光。"
}
],
"image": "",
"link": "",
"link_alt": "",
"ts": 1654002238,
"ord": 1,
"del": 0,
"created_at": "2022-05-31 13:03:58",
"updated_at": "2022-05-31 13:03:58"
}
]
}
```
---
```
[POST] /api/news/create
```
###### Parameters:
| Name | Type | Description | Default |
| -------- | -------- | -------- | --- |
| category | string | required | |
| title | string | required | |
| content | array | required | |
| link | string | | empty string |
| link_alt | string | | empty string |
| ts | int | | current timestamps|
| ord | int | | 1 |
###### Response:
| Name | Type | Description |
| -------- | -------- | -------- |
| success | boolean | |
| message | string | error message |
| token | string | new token |
###### Https code
| Code | Status |
| -------- | -------- |
| 200 | Success |
| 400 | Missing required column. |
| 403 | Forbidden |
---
```
[PUT] /api/news/{id}
```
###### Parameters:
| Name | Type | Description |
| -------- | -------- | -------- |
| category | string | |
| title | string | |
| content | array | |
| link | string | |
| link_alt | string | |
| ts | int | |
| ord | int | |
###### Response:
| Name | Type | Description |
| -------- | -------- | -------- |
| success | boolean | |
| message | string | error message
###### Https code
| Code | Status |
| -------- | -------- |
| 200 | Success |
| 403 | Forbidden |
| 404 | News not found |
---
```
[DELETE] /api/news/{id}
```
###### Response:
| Name | Type | Description |
| -------- | -------- | -------- |
| success | boolean | |
| message | string | error message
###### Https code
| Code | Status |
| -------- | -------- |
| 200 | Success |
| 403 | Forbidden |
| 404 | News not found |
---
### 活動紀錄
```
[GET] /api/activity/list/cat/{id}
```
###### Response:
| Name | Type | Description |
| -------- | -------- | -------- |
| code | int | |
| message | string | error message |
| data | array | |
| data[].id | int | |
| data[].title | string | |
| data[].content | array | |
| data[].content[].title | string | |
| data[].content[].content | string | |
| data[].image | string| separate with $? |
| data[].link | string | |
| data[].timestamp | int | 活動時間 |
| data[].ord | int | 顯示順序 |
| data[].del | int | |
| data[].created_at | int | CURRENT_TIMESTAMPS |
| data[].updated_at | int | CURRENT_TIMESTAMPS |
```
{
"success": true,
"message": "",
"data": [
{
"id": 1,
"title": "test",
"content": [
{
"title": "【台復新創之星預選--DEMO DAY】活動辦法",
"content": "為發揮台復新創會對台大/復旦新創生態圈產生更積極的正面效應,讓台復會從事新創事業的學長姐,能夠獲得關注,並鏈接更多新創資源,特於年中會議舉辦本活動,為新創學長姐搭建舞台,吸引重量級創投、加速器以及業務夥伴的目光。"
}
],
"image": "",
"ts": 1654002238,
"ord": 1,
"del": 0,
"created_at": "2022-05-31 13:03:58",
"updated_at": "2022-05-31 13:03:58"
}
]
}
```
---
```
[PUT] /api/activity/{id}
```
###### Content:
| Name | Type | Description |
| -------- | -------- | -------- |
| category | string | |
| title | string | |
| content | array | |
| ts | int | |
| ord | int | |
###### Response:
| Name | Type | Description |
| -------- | -------- | -------- |
| success | boolean | |
| message | string | error message
###### Https code
| Code | Status |
| -------- | -------- |
| 200 | Success |
| 403 | Forbidden |
| 404 | News not found |
---
```
[DELETE] /api/activity/{id}
```
###### Response:
| Name | Type | Description |
| -------- | -------- | -------- |
| success | boolean | |
| message | string | error message
###### Https code
| Code | Status |
| -------- | -------- |
| 200 | Success |
| 403 | Forbidden |
| 404 | News not found |
---
### Upload Image
```
[POST] /api/{type}/{id}/store-image
```
###### Parameters:
| Name | Type | Description |
| -------- | -------- | -------- |
| type | string | [board, news, activity] ONLY |
| id | int | |
###### Content
| Name | Type | Description |
| -------- | -------- | -------- |
| image | file | form-data |
###### Response:
| Name | Type | Description |
| -------- | -------- | -------- |
| success | boolean | |
| message | string | error message |
###### Https code
| Code | Status |
| -------- | -------- |
| 200 | Success |
| 400 | Image Upload Failure |
| 403 | Forbidden |
| 404 | News not found |
| | Activity not found |