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.

23 lines
574 B

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