mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-11-18 18:02:24 -05:00
Feature/user photo storage (#877)
* add default assets for user profile * add recipe avatar * change user_id to UUID * add profile image upload * setup image cache keys * cleanup tests and add image tests * purge user data on delete * new user repository tests * add user_id validator for int -> UUID conversion * delete depreciated route * force set content type * refactor tests to use temp directory * validate parent exists before createing * set user_id to correct type * update instruction id * reset primary key on migration
This commit is contained in:
@@ -32,7 +32,7 @@ class LongLiveTokenOut(LoingLiveTokenIn):
|
||||
|
||||
|
||||
class CreateToken(LoingLiveTokenIn):
|
||||
parent_id: int
|
||||
user_id: UUID4
|
||||
token: str
|
||||
|
||||
class Config:
|
||||
@@ -88,10 +88,11 @@ class UserIn(UserBase):
|
||||
|
||||
|
||||
class UserOut(UserBase):
|
||||
id: int
|
||||
id: UUID4
|
||||
group: str
|
||||
group_id: UUID4
|
||||
tokens: Optional[list[LongLiveTokenOut]]
|
||||
cache_key: str
|
||||
favorite_recipes: Optional[list[str]] = []
|
||||
|
||||
class Config:
|
||||
@@ -127,6 +128,15 @@ class PrivateUser(UserOut):
|
||||
class Config:
|
||||
orm_mode = True
|
||||
|
||||
@staticmethod
|
||||
def get_directory(user_id: UUID4) -> Path:
|
||||
user_dir = get_app_dirs().USER_DIR / str(user_id)
|
||||
user_dir.mkdir(parents=True, exist_ok=True)
|
||||
return user_dir
|
||||
|
||||
def directory(self) -> Path:
|
||||
return PrivateUser.get_directory(self.id)
|
||||
|
||||
|
||||
class UpdateGroup(GroupBase):
|
||||
id: UUID4
|
||||
|
||||
Reference in New Issue
Block a user