34 lines
830 B
Go
34 lines
830 B
Go
package logic
|
|
|
|
import (
|
|
"context"
|
|
|
|
"juwan-backend/app/notification/rpc/internal/svc"
|
|
"juwan-backend/app/notification/rpc/pb"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type GetNotificationsByIdLogic struct {
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
logx.Logger
|
|
}
|
|
|
|
func NewGetNotificationsByIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetNotificationsByIdLogic {
|
|
return &GetNotificationsByIdLogic{
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
Logger: logx.WithContext(ctx),
|
|
}
|
|
}
|
|
|
|
func (l *GetNotificationsByIdLogic) GetNotificationsById(in *pb.GetNotificationsByIdReq) (*pb.GetNotificationsByIdResp, error) {
|
|
n, err := l.svcCtx.NotificationModelRO.Notifications.Get(l.ctx, in.GetId())
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &pb.GetNotificationsByIdResp{Notifications: entNotificationToPb(n)}, nil
|
|
}
|