MCPcopy Index your code
hub / github.com/apache/answer / Follow

Method Follow

internal/controller/follow_controller.go:52–68  ·  view source on GitHub ↗

Follow godoc @Summary follow object or cancel follow operation @Description follow object or cancel follow operation @Tags Activity @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.FollowReq true "follow" @Success 200 {object} handler.RespBody{data=schema.FollowResp} @Router /

(ctx *gin.Context)

Source from the content-addressed store, hash-verified

50// @Success 200 {object} handler.RespBody{data=schema.FollowResp}
51// @Router /answer/api/v1/follow [post]
52func (fc *FollowController) Follow(ctx *gin.Context) {
53 req := &schema.FollowReq{}
54 if handler.BindAndCheck(ctx, req) {
55 return
56 }
57 req.ObjectID = uid.DeShortID(req.ObjectID)
58 dto := &schema.FollowDTO{}
59 _ = copier.Copy(dto, req)
60 dto.UserID = middleware.GetLoginUserIDFromContext(ctx)
61
62 resp, err := fc.followService.Follow(ctx, dto)
63 if err != nil {
64 handler.HandleResponse(ctx, err, schema.ErrTypeToast)
65 } else {
66 handler.HandleResponse(ctx, err, resp)
67 }
68}
69
70// UpdateFollowTags update user follow tags
71// @Summary update user follow tags

Callers

nothing calls this directly

Calls 5

BindAndCheckFunction · 0.92
DeShortIDFunction · 0.92
HandleResponseFunction · 0.92
FollowMethod · 0.65

Tested by

no test coverage detected