|
|
|
@ -48,20 +48,22 @@ func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) e
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
user := rpcclient.NewUserRpcClient(client)
|
|
|
|
|
userRpcClient := rpcclient.NewUserRpcClient(client)
|
|
|
|
|
msgRpcClient := rpcclient.NewMessageRpcClient(client)
|
|
|
|
|
conversationRpcClient := rpcclient.NewConversationRpcClient(client)
|
|
|
|
|
database := controller.InitGroupDatabase(db, rdb, mongo.GetDatabase())
|
|
|
|
|
pbGroup.RegisterGroupServer(server, &groupServer{
|
|
|
|
|
GroupDatabase: database,
|
|
|
|
|
User: user,
|
|
|
|
|
Notification: notification.NewGroupNotificationSender(database, client, func(ctx context.Context, userIDs []string) ([]notification.CommonUser, error) {
|
|
|
|
|
users, err := user.GetUsersInfo(ctx, userIDs)
|
|
|
|
|
User: userRpcClient,
|
|
|
|
|
Notification: notification.NewGroupNotificationSender(database, &msgRpcClient, func(ctx context.Context, userIDs []string) ([]notification.CommonUser, error) {
|
|
|
|
|
users, err := userRpcClient.GetUsersInfo(ctx, userIDs)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
return utils.Slice(users, func(e *sdkws.UserInfo) notification.CommonUser { return e }), nil
|
|
|
|
|
}),
|
|
|
|
|
conversationRpcClient: rpcclient.NewConversationRpcClient(client),
|
|
|
|
|
msgRpcClient: rpcclient.NewMessageRpcClient(client),
|
|
|
|
|
conversationRpcClient: conversationRpcClient,
|
|
|
|
|
msgRpcClient: msgRpcClient,
|
|
|
|
|
})
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|