add join role endpoint and persistency for hubs
This commit is contained in:
@@ -19,7 +19,7 @@ func getUserById(ctx context.Context, userId uuid.UUID) (*types.User, error) {
|
||||
user, err := cache.GetUserById(userId)
|
||||
if err != nil {
|
||||
user = &types.User{Id: userId, Hubs: make(map[uuid.UUID]*types.Hub)}
|
||||
err = postgresql.GetWholeUser(ctx, user)
|
||||
err = postgresql.UserGetWhole(ctx, user)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -96,9 +96,12 @@ func getHubByIdStr(ctx context.Context, hubId string) (*types.Hub, error) {
|
||||
}
|
||||
|
||||
hub, ok := cache.GetHubById(hubUuid)
|
||||
|
||||
if !ok {
|
||||
return nil, errors.New("hub not found")
|
||||
hub = &types.Hub{Id: hubUuid}
|
||||
err = postgresql.HubGetWhole(ctx, hub)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return hub, nil
|
||||
|
||||
Reference in New Issue
Block a user