✨ Authkit can get user
This commit is contained in:
@ -77,6 +77,12 @@ func (v *App) NotifyUserBatch(_ context.Context, in *proto.NotifyUserBatchReques
|
||||
notifications = append(notifications, notification)
|
||||
}
|
||||
|
||||
if len(notifications) == 0 {
|
||||
return &proto.NotifyResponse{
|
||||
IsSuccess: true,
|
||||
}, nil
|
||||
}
|
||||
|
||||
log.Debug().Str("topic", notifications[0].Topic).Any("uid", lo.Keys(checklist)).Msg("Notifying users...")
|
||||
|
||||
if in.GetNotify().GetUnsaved() {
|
||||
|
@ -12,8 +12,16 @@ import (
|
||||
)
|
||||
|
||||
func (v *App) GetUser(ctx context.Context, request *proto.GetUserRequest) (*proto.UserInfo, error) {
|
||||
tx := database.C
|
||||
if request.UserId != nil {
|
||||
tx = tx.Where("id = ?", uint(request.GetUserId()))
|
||||
}
|
||||
if request.Name != nil {
|
||||
tx = tx.Where("name = ?", request.GetName())
|
||||
}
|
||||
|
||||
var account models.Account
|
||||
if err := database.C.Where("id = ?", uint(request.GetUserId())).First(&account).Error; err != nil {
|
||||
if err := tx.First(&account).Error; err != nil {
|
||||
return nil, status.Errorf(codes.NotFound, fmt.Sprintf("requested user with id %d was not found", request.GetUserId()))
|
||||
}
|
||||
return account.EncodeToUserInfo(), nil
|
||||
|
Reference in New Issue
Block a user