diff --git a/pkg/internal/services/realms.go b/pkg/internal/services/realms.go index 35af531..ab9f31f 100644 --- a/pkg/internal/services/realms.go +++ b/pkg/internal/services/realms.go @@ -13,21 +13,6 @@ import ( "reflect" ) -func GetRealm(id uint) (models.Realm, error) { - var realm models.Realm - pc, err := gap.H.DiscoverServiceGRPC("Hydrogen.Passport") - if err != nil { - return realm, err - } - response, err := proto.NewRealmsClient(pc).GetRealm(context.Background(), &proto.RealmLookupRequest{ - Id: lo.ToPtr(uint64(id)), - }) - if err != nil { - return realm, err - } - return LinkRealm(response) -} - func GetRealmWithAlias(alias string) (models.Realm, error) { var realm models.Realm pc, err := gap.H.DiscoverServiceGRPC("Hydrogen.Passport") @@ -44,12 +29,16 @@ func GetRealmWithAlias(alias string) (models.Realm, error) { } func GetRealmMember(realmId uint, userId uint) (*proto.RealmMemberResponse, error) { + var realm models.Realm + if err := database.C.Where("id = ?", realmId).First(&realm).Error; err != nil { + return nil, err + } pc, err := gap.H.DiscoverServiceGRPC("Hydrogen.Passport") if err != nil { return nil, err } response, err := proto.NewRealmsClient(pc).GetRealmMember(context.Background(), &proto.RealmMemberLookupRequest{ - RealmId: uint64(realmId), + RealmId: uint64(realm.ExternalID), UserId: lo.ToPtr(uint64(userId)), }) if err != nil {