MCPcopy Create free account
hub / github.com/coderwhy/coderhub / addLabels

Method addLabels

src/controller/moment.controller.js:55–70  ·  view source on GitHub ↗
(ctx, next)

Source from the content-addressed store, hash-verified

53 }
54
55 async addLabels(ctx, next) {
56 // 1.获取标签和动态id
57 const { labels } = ctx;
58 const { momentId } = ctx.params;
59
60 // 2.添加所有的标签
61 for (let label of labels) {
62 // 2.1.判断标签是否已经和动态有关系
63 const isExist = await momentService.hasLabel(momentId, label.id);
64 if (!isExist) {
65 await momentService.addLabel(momentId, label.id);
66 }
67 }
68
69 ctx.body = "给动态添加标签成功~";
70 }
71
72 async fileInfo(ctx, next) {
73 let { filename } = ctx.params;

Callers

nothing calls this directly

Calls 2

hasLabelMethod · 0.80
addLabelMethod · 0.80

Tested by

no test coverage detected