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.

21 lines
492 B

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/do"
  7. )
  8. func (c *ControllerV1) AddSubscription(ctx context.Context, req *v1.AddSubscriptionReq) (res *v1.AddSubscriptionRes, err error) {
  9. res = &v1.AddSubscriptionRes{}
  10. _, err = dao.GoChannelSubscriptions.Ctx(ctx).Data(do.GoChannelSubscriptions{
  11. ChannelId: req.Id,
  12. UserId: req.UserId,
  13. }).Insert()
  14. if err == nil {
  15. res.Success = true
  16. }
  17. return
  18. }