关于前端:新增原创标签相关改动

37次阅读

共计 3169 个字符,预计需要花费 8 分钟才能阅读完成。

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

  1. 进入创立文章页面 GET '/topic/create 改变: 返回字段减少my_original_tags, 数据格式:

    {"my_original_tags": [{"_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},{"_id":"5fd44faa4d0f53cf2307461a","name":"你好 2","update_at":"2020-12-12T05:05:46.856Z","topics_size":0},{"_id":"5fd44810df64aacda776465e","name":"测试标签 1","update_at":"2020-12-12T04:33:20.163Z","topics_size":0}]}
  1. 发表新文章接口 POST /topic/create 改变, 入参字段减少original_tags, 数据格式:

    original_tags: '你 2 你 3 你 4 你 5'
  1. 进入文章编辑页面 GET /topic/:tid/edit 改变, 返回字段减少 my_original_tags(作者的所有原创标签) 和tags(这边文章已调配的标签), 数据格式:

    my_original_tags:

    {"`my_original_tags`": [{"_id":"5fd45ea584d4360537d856a7","name":"你 2","update_at":"2020-12-12T06:11:12.471Z","topics_size":2},{"_id":"5fd45ea584d4360537d856a6","name":"你 3","update_at":"2020-12-12T06:11:12.387Z","topics_size":2},{"_id":"5fd45ea584d4360537d856a5","name":"你 4","update_at":"2020-12-12T06:11:12.275Z","topics_size":2},{"_id":"5fd45ea584d4360537d856a4","name":"你 5","update_at":"2020-12-12T06:11:12.172Z","topics_size":2},{"_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},{"_id":"5fd44faa4d0f53cf2307461a","name":"你好 2","update_at":"2020-12-12T05:05:46.856Z","topics_size":0},{"_id":"5fd44810df64aacda776465e","name":"测试标签 1","update_at":"2020-12-12T04:33:20.163Z","topics_size":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"}]}
  2. 进入 ” 我的文章 ” 页面/user/:name/my_topics, 返回字段减少my_original_tags, 数据格式:

    {"`my_original_tags`": [{"_id":"5fd45ea584d4360537d856a7","name":"你 2","update_at":"2020-12-12T06:11:12.471Z","topics_size":2},{"_id":"5fd45ea584d4360537d856a6","name":"你 3","update_at":"2020-12-12T06:11:12.387Z","topics_size":2},{"_id":"5fd45ea584d4360537d856a5","name":"你 4","update_at":"2020-12-12T06:11:12.275Z","topics_size":2},{"_id":"5fd45ea584d4360537d856a4","name":"你 5","update_at":"2020-12-12T06:11:12.172Z","topics_size":2},{"_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},{"_id":"5fd44faa4d0f53cf2307461a","name":"你好 2","update_at":"2020-12-12T05:05:46.856Z","topics_size":0},{"_id":"5fd44810df64aacda776465e","name":"测试标签 1","update_at":"2020-12-12T04:33:20.163Z","topics_size":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 } 
       ] 
    }

正文完
 0