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)
| 50 | // @Success 200 {object} handler.RespBody{data=schema.FollowResp} |
| 51 | // @Router /answer/api/v1/follow [post] |
| 52 | func (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 |
nothing calls this directly
no test coverage detected