新增原创标签相关改动

用户头像
yinhaixiang
关注
发布于: 2020 年 12 月 15 日

改动分支: feature/original_tag, 总共有7个路由有改动(6个修改, 1个新增), 所有的改动单元测试在TopicControllerTest第243行开始可以自测, 以下是7处改动的详情:



  1. 进入创建文章页面GET /topic/create改动: 返回字段增加my_original_tags, 数据格式:



```

{"myoriginaltags": [{"id":"5fd44f26f83446cef994e1d9","name":"你好","updateat":"2020-12- 12T05:06:17.981Z","topicssize":1},{"id":"5fd44fc9cb9b69cf39a0671a","name":"你好3","updateat":"2020-12-12T05:06:17.513Z","topicssize":1},{"id":"5fd44faa4d0f53cf2307461a","name":"你好2","updateat":"2020-12-12T05:05:46.856Z","topicssize":0},{"id":"5fd44810df64aacda776465e","name":"测试标签1","updateat":"2020-12-12T04:33:20.163Z","topicssize":0}]}

```



  1. 发表新文章接口POST /topic/create改动, 入参字段增加original_tags, 数据格式:



```

original_tags: '你2 你3 你4 你5'

```



  1. 进入文章编辑页面GET /topic/:tid/edit改动, 返回字段增加my_original_tags(作者的所有原创标签)和tags(这边文章已分配的标签), 数据格式:



myoriginaltags:



```

{"my_original_tags": [{"id":"5fd45ea584d4360537d856a7","name":"你2","updateat":"2020-12-12T06:11:12.471Z","topicssize":2},{"id":"5fd45ea584d4360537d856a6","name":"你3","updateat":"2020-12-12T06:11:12.387Z","topicssize":2},{"id":"5fd45ea584d4360537d856a5","name":"你4","updateat":"2020-12-12T06:11:12.275Z","topicssize":2},{"id":"5fd45ea584d4360537d856a4","name":"你5","updateat":"2020-12-12T06:11:12.172Z","topicssize":2},{"id":"5fd44f26f83446cef994e1d9","name":"你好","updateat":"2020-12-12T05:06:17.981Z","topicssize":1},{"id":"5fd44fc9cb9b69cf39a0671a","name":"你好3","updateat":"2020-12-12T05:06:17.513Z","topicssize":1},{"id":"5fd44faa4d0f53cf2307461a","name":"你好2","updateat":"2020-12-12T05:05:46.856Z","topicssize":0},{"id":"5fd44810df64aacda776465e","name":"测试标签1","updateat":"2020-12-12T04:33:20.163Z","topicssize":0}]}

```



tags:

```

{"tags": [{"name":"你5"},{"name":"你4"},{"name":"你3"},{"name":"你2"}]}

```



  1. 编辑文章接口POST /topic/:tid/edit改动, 入参字段增加original_tags, 数据格式:



```

original_tags: '你2 你3 你4 你5'

```



  1. 进入文章详情页GET /topic/:tid改动, 返回字段增加tags(这边文章已分配的标签), 数据格式:



```

{"tags": [{"name":"你5"},{"name":"你4"},{"name":"你3"},{"name":"你2"}]}

```



  1. 进入"我的文章"页面/user/:name/my_topics, 返回字段增加my_original_tags, 数据格式:



```

{"my_original_tags": [{"id":"5fd45ea584d4360537d856a7","name":"你2","updateat":"2020-12-12T06:11:12.471Z","topicssize":2},{"id":"5fd45ea584d4360537d856a6","name":"你3","updateat":"2020-12-12T06:11:12.387Z","topicssize":2},{"id":"5fd45ea584d4360537d856a5","name":"你4","updateat":"2020-12-12T06:11:12.275Z","topicssize":2},{"id":"5fd45ea584d4360537d856a4","name":"你5","updateat":"2020-12-12T06:11:12.172Z","topicssize":2},{"id":"5fd44f26f83446cef994e1d9","name":"你好","updateat":"2020-12-12T05:06:17.981Z","topicssize":1},{"id":"5fd44fc9cb9b69cf39a0671a","name":"你好3","updateat":"2020-12-12T05:06:17.513Z","topicssize":1},{"id":"5fd44faa4d0f53cf2307461a","name":"你好2","updateat":"2020-12-12T05:05:46.856Z","topicssize":0},{"id":"5fd44810df64aacda776465e","name":"测试标签1","updateat":"2020-12-12T04:33:20.163Z","topicssize":0}]}

```



  1. 新增接口/api/v1/topic/listOriginalTags, 展示用户所有原创标签及标签包含文章的数量, 可以按照标签名模糊搜索, 返回格式:



```

{ status: 'success',

data:

[ { _id: '5fd44faa4d0f53cf2307461a',

name: '你好2',

update_at: '2020-12-12T07:04:46.049Z',

topics_size: 1 },

{ _id: '5fd44f26f83446cef994e1d9',

name: '你好',

update_at: '2020-12-12T05:06:17.981Z',

topics_size: 1 },

{ _id: '5fd44fc9cb9b69cf39a0671a',

name: '你好3',

update_at: '2020-12-12T05:06:17.513Z',

topics_size: 1 }

]

}

```



用户头像

yinhaixiang

关注

还未添加个人签名 2017.12.11 加入

还未添加个人简介

评论

发布
暂无评论
新增原创标签相关改动