update naming of functions, add option to get count of unread messages of user
This commit is contained in:
@@ -15,7 +15,7 @@ import (
|
||||
)
|
||||
|
||||
func getUserById(ctx context.Context, userId uuid.UUID) (*types.User, error) {
|
||||
user, err := cache.CacheGetUserById(userId)
|
||||
user, err := cache.GetUserById(userId)
|
||||
if err != nil {
|
||||
user = &types.User{Id: userId}
|
||||
err = postgresql.GetWholeUser(ctx, user)
|
||||
@@ -35,12 +35,12 @@ func getUserByToken(ctx context.Context, token string) (*types.User, error) {
|
||||
return getUserById(ctx, userId)
|
||||
}
|
||||
func getConnectionWithResponseOnFail(response *http.ResponseWriter, request *http.Request, user *types.User) (*types.Connection, bool) {
|
||||
connectionId, err := convertions.ConvertStringUuid(request.FormValue("connectionid"))
|
||||
connectionId, err := convertions.StringToUuid(request.FormValue("connectionid"))
|
||||
if err != nil {
|
||||
http.Error(*response, "invalid connectionid", http.StatusBadRequest)
|
||||
return nil, false
|
||||
}
|
||||
conn, ok := cache.CacheGetConnection(user, connectionId)
|
||||
conn, ok := cache.GetConnection(user, connectionId)
|
||||
if !ok {
|
||||
http.Error(*response, "invalid connectionid", http.StatusBadRequest)
|
||||
return nil, false
|
||||
|
||||
Reference in New Issue
Block a user