feat: person api#3
Merged
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3 +/- ##
==========================================
+ Coverage 84.88% 92.83% +7.94%
==========================================
Files 23 27 +4
Lines 450 795 +345
==========================================
+ Hits 382 738 +356
+ Misses 68 57 -11
Continue to review full report at Codecov.
|
|
type 不应该用中文吧;role 字段从扩展性上来说,个人偏好用数组;推荐遵循 RESTful 规范,路由中表示集合的部分一般用复数 我之前练习接口设计,纯粹看 Bangumi 页面功能梳理了数据模型关系,涉及到 wiki 的我都放弃了,太复杂了。其他部分可以看下,希望能提供一些参考。 接口:https://weizhenye.github.io/bangumi-restful-api/#/%E4%BA%BA%E7%89%A9 |
Contributor
Author
目前有很多预定义的变量都是直接硬编码的。这个之后导出一下,放到个新仓库或者json之类的。比如这个巨大的staff job map 现在的表是这样的,所以你设计的很多字段都没法做(bgm38) |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
获取人物列表
router:
/api/v0/persons分页参数
/api/v0/persons?limit=30&offset=60排序参数
/api/v0/persons?sort=$sort&order=$ordersort 可选项id, name, updateorder可选项-1, 1filter:
router:
/api/v0/persons?name=和田薫router:
/api/v0/persons?career=$career,目前可选项为producer, mangaka, artist, seiyu, writer, illustrator, actor,可重复出现。如?career=artist&career=seiyu,多个职业之间为或关系。以上filter可以组合使用,相互之间为逻辑且
获取单个人物详情
router:
/api/v0/persons/{person_id}200
307:
如果人物被合并
相关条目
router:
/api/v0/persons/{person_id}/subjects[ { "id": 4, "staff": "开发", "name": "メタルスラッグ7", "name_cn": "合金弹头7", "image": "https://lain.bgm.tv/pic/cover/c/a8/7f/4_cMMK5.jpg" }, { "id": 5, "staff": "发行", "name": "Call of Duty 4", "name_cn": "使命召唤 4: 现代战争", "image": "https://lain.bgm.tv/pic/cover/c/e4/da/5_wUARf.jpg" }, { "id": 6, "staff": "遊戲設計師", "name": "Team Fortress 2", "name_cn": "军团要塞2", "image": "https://lain.bgm.tv/pic/cover/c/16/79/6_gC3iJ.jpg" } ]统一错误响应
404:
{ "title": "Not Found", "description": "resource you resource can't be found in the database", "detail": { "person_id": "20" } }422:
person id不是正整数,比如
/api/v0/person/0{ "title": "Invalid Request", "description": "One or more parameters to your request was invalid.", "detail": [ { "loc": [ "path", "person_id" ], "msg": "ensure this value is greater than 0", "type": "value_error.number.not_gt", "ctx": { "limit_value": 0 } } ] }