✨ Return affiliated to and automated by in userinfo grpc call
This commit is contained in:
parent
b22657d09f
commit
7a585ec5b9
@ -4,15 +4,11 @@
|
|||||||
<option name="autoReloadType" value="ALL" />
|
<option name="autoReloadType" value="ALL" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":sparkles: Bot token aka. API token">
|
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":sparkles: Return affiliated to and automated by in userinfo grpc call">
|
||||||
<change afterPath="$PROJECT_DIR$/pkg/internal/server/api/bots_api.go" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/pkg/internal/services/bots.go" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/pkg/internal/server/api/index.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/server/api/index.go" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/go.mod" beforeDir="false" afterPath="$PROJECT_DIR$/go.mod" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/pkg/internal/server/api/notify_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/server/api/notify_api.go" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/go.sum" beforeDir="false" afterPath="$PROJECT_DIR$/go.sum" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/pkg/internal/services/bot_token.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/bot_token.go" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/pkg/internal/grpc/auth.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/grpc/auth.go" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/pkg/internal/services/clients.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/clients.go" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/pkg/internal/services/ticket.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/ticket.go" afterDir="false" />
|
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@ -159,8 +155,6 @@
|
|||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<MESSAGE value=":sparkles: Admin panel & users, users' permissions management" />
|
|
||||||
<MESSAGE value=":bug: Fix clear function doesn't real clear items in slice" />
|
|
||||||
<MESSAGE value=":sparkles: View auth factors" />
|
<MESSAGE value=":sparkles: View auth factors" />
|
||||||
<MESSAGE value=":sparkles: View auth factors in admin panel" />
|
<MESSAGE value=":sparkles: View auth factors in admin panel" />
|
||||||
<MESSAGE value=":rotating_light: Fix ts lint issue" />
|
<MESSAGE value=":rotating_light: Fix ts lint issue" />
|
||||||
@ -184,7 +178,9 @@
|
|||||||
<MESSAGE value=":alien: Change avatar and banner id to string" />
|
<MESSAGE value=":alien: Change avatar and banner id to string" />
|
||||||
<MESSAGE value=":card_file_box: Update modeling" />
|
<MESSAGE value=":card_file_box: Update modeling" />
|
||||||
<MESSAGE value=":sparkles: Bot token aka. API token" />
|
<MESSAGE value=":sparkles: Bot token aka. API token" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value=":sparkles: Bot token aka. API token" />
|
<MESSAGE value=":sparkles: Bots aka. automated accounts" />
|
||||||
|
<MESSAGE value=":sparkles: Return affiliated to and automated by in userinfo grpc call" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value=":sparkles: Return affiliated to and automated by in userinfo grpc call" />
|
||||||
</component>
|
</component>
|
||||||
<component name="VgoProject">
|
<component name="VgoProject">
|
||||||
<settings-migrated>true</settings-migrated>
|
<settings-migrated>true</settings-migrated>
|
||||||
|
2
go.mod
2
go.mod
@ -5,7 +5,7 @@ go 1.21.6
|
|||||||
toolchain go1.22.1
|
toolchain go1.22.1
|
||||||
|
|
||||||
require (
|
require (
|
||||||
git.solsynth.dev/hydrogen/dealer v0.0.0-20240823113302-208da7e90fdb
|
git.solsynth.dev/hydrogen/dealer v0.0.0-20240824155914-68c6a5565468
|
||||||
github.com/go-playground/validator/v10 v10.17.0
|
github.com/go-playground/validator/v10 v10.17.0
|
||||||
github.com/gofiber/fiber/v2 v2.52.4
|
github.com/gofiber/fiber/v2 v2.52.4
|
||||||
github.com/golang-jwt/jwt/v5 v5.2.0
|
github.com/golang-jwt/jwt/v5 v5.2.0
|
||||||
|
2
go.sum
2
go.sum
@ -1,5 +1,7 @@
|
|||||||
git.solsynth.dev/hydrogen/dealer v0.0.0-20240823113302-208da7e90fdb h1:dv4uVDMe53eBprW2Q8ocAhZuO+DKWlWyxGiJMiwE62E=
|
git.solsynth.dev/hydrogen/dealer v0.0.0-20240823113302-208da7e90fdb h1:dv4uVDMe53eBprW2Q8ocAhZuO+DKWlWyxGiJMiwE62E=
|
||||||
git.solsynth.dev/hydrogen/dealer v0.0.0-20240823113302-208da7e90fdb/go.mod h1:Q51JPkKnV0UoOT/IRmdBh5CyfSlp7s8BRGzgooYHqkI=
|
git.solsynth.dev/hydrogen/dealer v0.0.0-20240823113302-208da7e90fdb/go.mod h1:Q51JPkKnV0UoOT/IRmdBh5CyfSlp7s8BRGzgooYHqkI=
|
||||||
|
git.solsynth.dev/hydrogen/dealer v0.0.0-20240824155914-68c6a5565468 h1:DZ1b5WA1FoUE71zyl6OzQ+QbCo4tPJv077ekM1VQ524=
|
||||||
|
git.solsynth.dev/hydrogen/dealer v0.0.0-20240824155914-68c6a5565468/go.mod h1:Q51JPkKnV0UoOT/IRmdBh5CyfSlp7s8BRGzgooYHqkI=
|
||||||
github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8=
|
github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8=
|
||||||
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
|
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
|
||||||
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
|
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
|
||||||
|
@ -36,6 +36,13 @@ func (v *Server) Authenticate(_ context.Context, in *proto.AuthRequest) (*proto.
|
|||||||
userinfo.Banner = *user.GetBanner()
|
userinfo.Banner = *user.GetBanner()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if user.AffiliatedID != nil {
|
||||||
|
userinfo.AffiliatedTo = lo.ToPtr(uint64(*user.AffiliatedID))
|
||||||
|
}
|
||||||
|
if user.AutomatedID != nil {
|
||||||
|
userinfo.AutomatedBy = lo.ToPtr(uint64(*user.AutomatedID))
|
||||||
|
}
|
||||||
|
|
||||||
return &proto.AuthReply{
|
return &proto.AuthReply{
|
||||||
IsValid: true,
|
IsValid: true,
|
||||||
Info: &proto.AuthInfo{
|
Info: &proto.AuthInfo{
|
||||||
@ -108,11 +115,20 @@ func (v *Server) ListUserFriends(_ context.Context, in *proto.ListUserRelativeRe
|
|||||||
|
|
||||||
return &proto.ListUserRelativeResponse{
|
return &proto.ListUserRelativeResponse{
|
||||||
Data: lo.Map(data, func(item models.AccountRelationship, index int) *proto.SimpleUserInfo {
|
Data: lo.Map(data, func(item models.AccountRelationship, index int) *proto.SimpleUserInfo {
|
||||||
return &proto.SimpleUserInfo{
|
val := &proto.SimpleUserInfo{
|
||||||
Id: uint64(item.AccountID),
|
Id: uint64(item.AccountID),
|
||||||
Name: item.Account.Name,
|
Name: item.Account.Name,
|
||||||
Nick: item.Account.Nick,
|
Nick: item.Account.Nick,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if item.Account.AffiliatedID != nil {
|
||||||
|
val.AffiliatedTo = lo.ToPtr(uint64(*item.Account.AffiliatedID))
|
||||||
|
}
|
||||||
|
if item.Account.AutomatedID != nil {
|
||||||
|
val.AutomatedBy = lo.ToPtr(uint64(*item.Account.AutomatedID))
|
||||||
|
}
|
||||||
|
|
||||||
|
return val
|
||||||
}),
|
}),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
@ -133,11 +149,20 @@ func (v *Server) ListUserBlocklist(_ context.Context, in *proto.ListUserRelative
|
|||||||
|
|
||||||
return &proto.ListUserRelativeResponse{
|
return &proto.ListUserRelativeResponse{
|
||||||
Data: lo.Map(data, func(item models.AccountRelationship, index int) *proto.SimpleUserInfo {
|
Data: lo.Map(data, func(item models.AccountRelationship, index int) *proto.SimpleUserInfo {
|
||||||
return &proto.SimpleUserInfo{
|
val := &proto.SimpleUserInfo{
|
||||||
Id: uint64(item.AccountID),
|
Id: uint64(item.AccountID),
|
||||||
Name: item.Account.Name,
|
Name: item.Account.Name,
|
||||||
Nick: item.Account.Nick,
|
Nick: item.Account.Nick,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if item.Account.AffiliatedID != nil {
|
||||||
|
val.AffiliatedTo = lo.ToPtr(uint64(*item.Account.AffiliatedID))
|
||||||
|
}
|
||||||
|
if item.Account.AutomatedID != nil {
|
||||||
|
val.AutomatedBy = lo.ToPtr(uint64(*item.Account.AutomatedID))
|
||||||
|
}
|
||||||
|
|
||||||
|
return val
|
||||||
}),
|
}),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user