# 2020FuckUBackEnd
# 荒らしたら許さん
## やること
- CRUDつくる
- ファイル保存をGCSで実装
## モデル
### 授業
```json
{
"name": "授業名: e.g. 地理",
"id": "classID",
"passPhrase": "h4MaT",
"files": [
{
"id": "9048278549",
"markerID": "612788485",
"resourceInfo": {
"fileName": "kasu.mp4",
"createdAt": "timestamp UTC"
}
},
{
"id": "78942374983",
"markerID": "89890438344",
"resourceInfo": {
"fileName": "kasu.mp4",
"createdAt": "timestamp UTC"
}
}
]
}
```
## API自体の仕様
### host/api/v1/classes/
- GET
単純化されたクラスのリスト取得
#### 求
なし
#### 出
```json
[
{
"name": "理科",
"id": "classID",
"passPhrase": "ユーザーが入力する用のパスフレーズ"
}, ...
]
```
- POST
クラスの作成
#### 求
```json
{
"name": "理科第2回"
}
```
#### 出
```json
{
"name": "理科第2回",
"id": "ランダム生成された授業ID",
"passPhrase": "ランダム生成された生徒が打ち込む用のフレーズ",
"files": []
}
```
### host/api/v1/classes/{:ID}
- GET
- クラスの詳細情報
#### 求
なし
#### 出
```json
{
"name": "理科",
"id": "classID",
"passPhrase": "ユーザーが入力する用のパスフレーズ",
"files": [
{
"id": "fileID",
"markerID": "AR markerのID",
"resourceInfo": {
"fileName": "そのまんま",
"createdAt": "作られた時間 UTC エポック"
}
}, ...(あれば)
]
}
```
- PUT
授業名の修正
#### 求
```json
{
"name": "理科題3回"
}
```
- DELETE
クラス削除
#### 求
なし
#### 出
削除したクラスのデータ
```json
{
"name": "理科",
"id": "classID",
"passPhrase": "ユーザーが入力する用のパスフレーズ",
"files": [
{
"id": "fileID",
"markerID": "AR markerのID",
"resourceInfo": {
"fileName": "そのまんま",
"createdAt": "作られた時間 UTC エポック"
}
}, ...(あれば)
]
}
```
### host/api/v1/classes/{:ID}/files
- GET
ファイルの一覧
#### 求
なし
#### 出
```json
[
{
"id": "fileID",
"markerID": "AR markerのID",
"resourceInfo": {
"fileName": "そのまんま",
"createdAt": "作られた時間 UTC エポック"
}
}, ...(あれば)
]
```
- POST
ファイルの追加
#### 求
```json
{
"markerID": "AR markerのID",
"resourceInfo": {
"fileName": "そのまんま",
"createdAt": "作られた時間 UTC エポック"
}
}
```
#### 出
なし
### host/api/v1/classes/{:ID}/files/{:ID}
- GET
ファイル取得
#### 求
なし
#### 出
```json
{
"id": "fileID",
"markerID": "AR markerのID",
"resourceInfo": {
"fileName": "そのまんま",
"createdAt": "作られた時間 UTC エポック"
}
}
```
- DELETE
ファイル消去
#### 求
なし
#### 出
削除したリソースデータ
```json
{
"id": "fileID",
"markerID": "AR markerのID",
"resourceInfo": {
"fileName": "そのまんま",
"createdAt": "作られた時間 UTC エポック"
}
}
```