Add list relative method into authkit

This commit is contained in:
LittleSheep 2024-10-31 21:35:21 +08:00
parent 39ac016b46
commit 2b4f71e732
2 changed files with 23 additions and 15 deletions

19
.idea/workspace.xml generated
View File

@ -4,20 +4,9 @@
<option name="autoReloadType" value="ALL" />
</component>
<component name="ChangeListManager">
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":sparkles: Support users related rpc calls">
<change afterPath="$PROJECT_DIR$/pkg/authkit/audit.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pkg/authkit/notify.go" afterDir="false" />
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":technologist: Improve DX by extending authkit">
<change afterPath="$PROJECT_DIR$/pkg/authkit/relative.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/authkit/models/notifications.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/authkit/models/notifications.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/grpc/notify.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/grpc/notify.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/services/notifications.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/notifications.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/proto/notify.pb.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/proto/notify.pb.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/proto/notify.proto" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/proto/notify.proto" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/proto/notify_grpc.pb.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/proto/notify_grpc.pb.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/proto/realm.pb.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/proto/realm.pb.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/proto/realm_grpc.pb.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/proto/realm_grpc.pb.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/proto/record.pb.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/proto/record.pb.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/proto/record_grpc.pb.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/proto/record_grpc.pb.go" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -165,7 +154,6 @@
</component>
<component name="VcsManagerConfiguration">
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
<MESSAGE value=":sparkles: Allow user view and remove notification subscriptions" />
<MESSAGE value=":recycle: Improve notifications mark read system" />
<MESSAGE value=":bug: Bug fixes on multi-factors based authentication" />
<MESSAGE value=":bug: Bug fixes on settings auth preferences" />
@ -190,7 +178,8 @@
<MESSAGE value=":rewind: Revert &quot;:recycle: Move models.Account to sec.UserInfo&quot; for a better solution&#10;&#10;This reverts commit 8fbb7960" />
<MESSAGE value=":truck: Update package name from Hypdrogen to Hypernet" />
<MESSAGE value=":sparkles: Support users related rpc calls" />
<option name="LAST_COMMIT_MESSAGE" value=":sparkles: Support users related rpc calls" />
<MESSAGE value=":technologist: Improve DX by extending authkit" />
<option name="LAST_COMMIT_MESSAGE" value=":technologist: Improve DX by extending authkit" />
<option name="GROUP_MULTIFILE_MERGE_BY_DIRECTORY" value="true" />
</component>
<component name="VgoProject">

19
pkg/authkit/relative.go Normal file
View File

@ -0,0 +1,19 @@
package authkit
import (
"git.solsynth.dev/hypernet/nexus/pkg/nex"
"git.solsynth.dev/hypernet/nexus/pkg/proto"
)
func ListRelative(nx *nex.Conn, userId uint, status int32, isRelated bool) ([]*proto.UserInfo, error) {
conn, err := nx.GetClientGrpcConn(nex.ServiceTypeAuth)
if err != nil {
return nil, err
}
resp, err := proto.NewUserServiceClient(conn).ListUserRelative(nil, &proto.ListUserRelativeRequest{
UserId: uint64(userId),
Status: status,
IsRelated: isRelated,
})
return resp.GetData(), err
}