You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
528 B

7 months ago
7 months ago
7 months ago
7 months ago
  1. package subscription
  2. import (
  3. "context"
  4. "practice_Go/api/subscription/v1"
  5. "practice_Go/internal/dao"
  6. "practice_Go/internal/model/dto"
  7. )
  8. func (c *ControllerV1) DeleteSubscription(ctx context.Context, req *v1.DeleteSubscriptionReq) (*dto.Result, error) {
  9. res := &v1.DeleteSubscriptionRes{}
  10. _, err := dao.GoChannelSubscriptions.Ctx(ctx).Wheref("channel_id =? and user_id =?", req.Id, req.UserId).Delete()
  11. if err != nil {
  12. return dto.Error(err.Error()), nil
  13. }
  14. res.Success = true
  15. return dto.SuccessWithData(res), nil
  16. }