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
21 lines
492 B
package subscription
|
|
|
|
import (
|
|
"context"
|
|
|
|
"practice_Go/api/subscription/v1"
|
|
"practice_Go/internal/dao"
|
|
"practice_Go/internal/model/do"
|
|
)
|
|
|
|
func (c *ControllerV1) AddSubscription(ctx context.Context, req *v1.AddSubscriptionReq) (res *v1.AddSubscriptionRes, err error) {
|
|
res = &v1.AddSubscriptionRes{}
|
|
_, err = dao.GoChannelSubscriptions.Ctx(ctx).Data(do.GoChannelSubscriptions{
|
|
ChannelId: req.Id,
|
|
UserId: req.UserId,
|
|
}).Insert()
|
|
if err == nil {
|
|
res.Success = true
|
|
}
|
|
return
|
|
}
|