🐛 Bug fixes on realm missing member on creation

This commit is contained in:
LittleSheep 2024-05-05 11:48:39 +08:00
parent 7c418a3cd3
commit ce0bf2b548
6 changed files with 477 additions and 229 deletions

View File

@ -19,5 +19,20 @@
</introspection-scope>
</schema-mapping>
</data-source>
<data-source name="passport@id.solsynth.dev" uuid="723637bc-6ce3-4bbe-afb3-d88730c75a1b">
<database-info product="PostgreSQL" version="16.2 (Ubuntu 16.2-1.pgdg22.04+1)" jdbc-version="4.2" driver-name="PostgreSQL JDBC Driver" driver-version="42.6.0" dbms="POSTGRES" exact-version="16.2" exact-driver-version="42.6">
<identifier-quote-string>&quot;</identifier-quote-string>
</database-info>
<case-sensitivity plain-identifiers="lower" quoted-identifiers="exact" />
<secret-storage>master_key</secret-storage>
<user-name>postgres</user-name>
<schema-mapping>
<introspection-scope>
<node kind="database" qname="@">
<node kind="schema" qname="@" />
</node>
</introspection-scope>
</schema-mapping>
</data-source>
</component>
</project>

View File

@ -8,5 +8,12 @@
<jdbc-url>jdbc:postgresql://localhost:5432/hy_passport</jdbc-url>
<working-dir>$ProjectFileDir$</working-dir>
</data-source>
<data-source source="LOCAL" name="passport@id.solsynth.dev" uuid="723637bc-6ce3-4bbe-afb3-d88730c75a1b">
<driver-ref>postgresql</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.postgresql.Driver</jdbc-driver>
<jdbc-url>jdbc:postgresql://id.solsynth.dev:5432/passport</jdbc-url>
<working-dir>$ProjectFileDir$</working-dir>
</data-source>
</component>
</project>

File diff suppressed because it is too large Load Diff

View File

@ -1,2 +1,2 @@
#n:public
!<md> [6267, 0, null, null, -2147483648, -2147483648]
!<md> [6992, 0, null, null, -2147483648, -2147483648]

View File

@ -4,11 +4,13 @@
<option name="autoReloadType" value="ALL" />
</component>
<component name="ChangeListManager">
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":bug: Bug fixes on forgot add realm members for account">
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":bug: Bug fix on missing id in realm">
<change beforePath="$PROJECT_DIR$/.idea/dataSources.local.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources.local.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/dataSources.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/dataSources/74bcf3ef-a2b9-435b-b9e5-f32902a33b25.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources/74bcf3ef-a2b9-435b-b9e5-f32902a33b25.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/dataSources/74bcf3ef-a2b9-435b-b9e5-f32902a33b25/storage_v2/_src_/database/hy_passport.gNOKQQ/schema/public.abK9xQ.meta" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources/74bcf3ef-a2b9-435b-b9e5-f32902a33b25/storage_v2/_src_/database/hy_passport.gNOKQQ/schema/public.abK9xQ.meta" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/grpc/proto/realms.pb.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/grpc/proto/realms.pb.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/grpc/proto/realms.proto" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/grpc/proto/realms.proto" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/grpc/realms.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/grpc/realms.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/services/realms.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/services/realms.go" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -147,7 +149,8 @@
<MESSAGE value=":sparkles: Realm GRPC" />
<MESSAGE value=":sparkles: Realm Member GRPC" />
<MESSAGE value=":bug: Bug fixes on forgot add realm members for account" />
<option name="LAST_COMMIT_MESSAGE" value=":bug: Bug fixes on forgot add realm members for account" />
<MESSAGE value=":bug: Bug fix on missing id in realm" />
<option name="LAST_COMMIT_MESSAGE" value=":bug: Bug fix on missing id in realm" />
</component>
<component name="VgoProject">
<settings-migrated>true</settings-migrated>

View File

@ -57,7 +57,11 @@ func GetRealmWithAlias(alias string) (models.Realm, error) {
return realm, nil
}
func NewRealm(realm models.Realm) (models.Realm, error) {
func NewRealm(realm models.Realm, user models.Account) (models.Realm, error) {
realm.Members = []models.RealmMember{
{AccountID: user.ID},
}
err := database.C.Save(&realm).Error
return realm, err
}