base context for wrappers updated
This commit is contained in:
@@ -94,7 +94,7 @@ class RedisRow:
|
||||
# Filter and convert valid keys
|
||||
valid_keys = []
|
||||
for key in list_keys:
|
||||
if key is None:
|
||||
if key is None or str(key) == "None":
|
||||
continue
|
||||
if isinstance(key, bytes):
|
||||
key = key.decode()
|
||||
@@ -108,7 +108,8 @@ class RedisRow:
|
||||
# Add wildcard if first key was None
|
||||
if list_keys[0] is None:
|
||||
pattern = f"*{cls.delimiter}{pattern}"
|
||||
|
||||
if '*' not in pattern:
|
||||
pattern = f"{pattern}:*"
|
||||
return pattern
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -47,4 +47,7 @@ class RedisResponse:
|
||||
|
||||
@property
|
||||
def first(self) -> Union[RedisRow, None]:
|
||||
return self.data[0] if self.data else None
|
||||
if self.data:
|
||||
return self.data[0]
|
||||
self.status = False
|
||||
return
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
from typing import Optional
|
||||
from typing import Optional, Literal
|
||||
from uuid import UUID
|
||||
from pydantic import BaseModel, validator
|
||||
from pydantic import BaseModel, field_validator
|
||||
|
||||
|
||||
class AccessToken(BaseModel):
|
||||
|
||||
accessToken: Optional[str] = None
|
||||
userUUID: Optional[str] = None
|
||||
userUUID: Optional[str | UUID] = None
|
||||
|
||||
@validator("userUUID", pre=True)
|
||||
@field_validator("userUUID", mode="after")
|
||||
def validate_uuid(cls, v):
|
||||
"""Convert UUID to string during validation."""
|
||||
if isinstance(v, UUID):
|
||||
return str(v)
|
||||
return v
|
||||
if v is None:
|
||||
return None
|
||||
return str(v)
|
||||
|
||||
def to_list(self):
|
||||
"""Convert to list for Redis storage."""
|
||||
return [self.accessToken, self.userUUID]
|
||||
return [self.accessToken, str(self.userUUID) if self.userUUID else None]
|
||||
|
||||
@property
|
||||
def count(self):
|
||||
|
||||
Reference in New Issue
Block a user