|
|
@ -5,13 +5,15 @@ import ( |
|
|
|
|
|
|
|
"practice_Go/api/subscription/v1" |
|
|
|
"practice_Go/internal/dao" |
|
|
|
"practice_Go/internal/model/dto" |
|
|
|
) |
|
|
|
|
|
|
|
func (c *ControllerV1) DeleteSubscription(ctx context.Context, req *v1.DeleteSubscriptionReq) (res *v1.DeleteSubscriptionRes, err error) { |
|
|
|
res = &v1.DeleteSubscriptionRes{} |
|
|
|
_, err = dao.GoChannelSubscriptions.Ctx(ctx).Wheref("channel_id =? and user_id =?", req.Id, req.UserId).Delete() |
|
|
|
if err == nil { |
|
|
|
res.Success = true |
|
|
|
func (c *ControllerV1) DeleteSubscription(ctx context.Context, req *v1.DeleteSubscriptionReq) (*dto.Result, error) { |
|
|
|
res := &v1.DeleteSubscriptionRes{} |
|
|
|
_, err := dao.GoChannelSubscriptions.Ctx(ctx).Wheref("channel_id =? and user_id =?", req.Id, req.UserId).Delete() |
|
|
|
if err != nil { |
|
|
|
return dto.Error(err.Error()), nil |
|
|
|
} |
|
|
|
return |
|
|
|
res.Success = true |
|
|
|
return dto.SuccessWithData(res), nil |
|
|
|
} |