server icon indicating copy to clipboard operation
server copied to clipboard

[Feature Request]: 目录

Open RanKKI opened this issue 2 years ago • 6 comments

目录的增删查改,包括 我建立的目录某用户的收藏目录

目前已经存在 /v0/indices/{index_id} /v0/indices/{index_id}/subjects

已实现 #234

  • [x] 新建目录 POST /indices
  • [x] 修改 PUT /indices/{index_id}
  • [x] 增加内容 POST /indices/{index_id}/subjects
  • [x] 修改内容 PUT /indices/{index_id}/subjects/<subject_id>
  • [x] 删除内容 DELETE /indices/{index_id}/subjects/<subject_id>

待实现

  • [x] 收藏目录 POST /indices/{index_id}/collect
  • [x] 取消收藏 DELETE /indices/{index_id}/collect
  • [ ] 用户的目录 GET /users/{username}/indices
  • [ ] 用户的收藏目录 GET /users/{username}/indices/collect

暂定不添加

  • [ ] 删除 DELETE /indices/{index_id}

RanKKI avatar Oct 04 '22 09:10 RanKKI

增加、删除和修改条目看起来OK,用户的目录 GET看起来也ok,其他的不太确定...

trim21 avatar Oct 04 '22 09:10 trim21

我跟sai老板要一下数据库权限

Hugh Liu @.***> 于2022年10月4日周二 17:17写道:

目录的增删查改,包括 我建立的目录 和 某用户的收藏目录

目前已经存在 /v0/indices/{index_id} https://bangumi.github.io/api/#/%E7%9B%AE%E5%BD%95/getIndexById /v0/indices/{index_id}/subjects https://bangumi.github.io/api/#/%E7%9B%AE%E5%BD%95/getIndexSubjectsByIndexId

需要添加(省略版本号) 与目录直接关联的

新建目录 POST /indices 返回 model.Index https://github.com/bangumi/server/blob/master/internal/model/index.go

修改 PUT /indices/{index_id} 删除 DELETE /indices/{index_id}

新建目录和修改目录的请求参数

{

"title": "xxx",

"desc": "xx",

}

增加内容 POST /indices/{index_id}/subjects 修改内容 PUT /indices/{index_id}/subjects/<subject_id>

POST/PUT JSON Payload

{

"subject_id": 123, // 新增时需要,如果是 subject link 前端直接做解析,解析成 subject_id

"sort": 74,

"comment: "string"

}

删除内容 DELETE /indices/{index_id}/subjects/<subject_id> 与目录相关的内容

收藏目录 POST /indices/{index_id}/collect 取消收藏 DELETE /indices/{index_id}/collect 用户的目录 GET /users/{username}/indices 用户的收藏目录 GET /users/{username}/indices/collect 与 API 无关的内容

用 indices/index 表示目录,感觉很不符合语境,catalogue 可能更合适些吧

a complete list of items, typically one in alphabetical or other systematic order.

• a list of all the books or resources in a library: a computerized library catalogue.


感觉排版有点乱...

先讨论讨论看看 url 设计合理不,我有时间开始做这部分~

— Reply to this email directly, view it on GitHub https://github.com/bangumi/server/issues/230, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADHNB37NC7Q5GRWFF3KIWGDWBPY3NANCNFSM6AAAAAAQ4L2HE4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

trim21 avatar Oct 04 '22 09:10 trim21

Private API 和公开 API 的界限是在哪?比如对目录的增删,应该属于公开 API 么?

RanKKI avatar Oct 04 '22 12:10 RanKKI

Private API是针对前端需要写的,不太需要保证兼容性,公开API是给所有人用得。这个应该是公开的。

trim21 avatar Oct 04 '22 12:10 trim21

有数据库权限了

trim21 avatar Oct 04 '22 14:10 trim21

Hi there,我可以帮忙尝试实现一下收藏部分的api,这几天抽空理解了下代码和文档,感觉可以开始上手了,有什么其他建议可以帮助我展开工作吗😃

kagaya85 avatar Mar 09 '23 03:03 kagaya85