|
@ -11,6 +11,7 @@ import ( |
|
|
func (c *ControllerV1) DeleteSubscription(ctx context.Context, req *v1.DeleteSubscriptionReq) (*dto.Result, error) { |
|
|
func (c *ControllerV1) DeleteSubscription(ctx context.Context, req *v1.DeleteSubscriptionReq) (*dto.Result, error) { |
|
|
res := &v1.DeleteSubscriptionRes{} |
|
|
res := &v1.DeleteSubscriptionRes{} |
|
|
_, err := dao.GoChannelSubscriptions.Ctx(ctx).Wheref("channel_id =? and user_id =?", req.Id, req.UserId).Delete() |
|
|
_, err := dao.GoChannelSubscriptions.Ctx(ctx).Wheref("channel_id =? and user_id =?", req.Id, req.UserId).Delete() |
|
|
|
|
|
_, err = dao.GoChannels.Ctx(ctx).Where("id",req.Id).Decrement("subscription_count",1) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
return dto.Error(err.Error()), nil |
|
|
return dto.Error(err.Error()), nil |
|
|
} |
|
|
} |
|
|