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
19 lines
528 B
package subscription
|
|
|
|
import (
|
|
"context"
|
|
|
|
"practice_Go/api/subscription/v1"
|
|
"practice_Go/internal/dao"
|
|
"practice_Go/internal/model/dto"
|
|
)
|
|
|
|
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
|
|
}
|
|
res.Success = true
|
|
return dto.SuccessWithData(res), nil
|
|
}
|