feat: Add ability to change profile avatar (#12642)
This commit is contained in:
parent
2f41bd495d
commit
f582d4a13e
13 changed files with 158 additions and 19 deletions
|
|
@ -41,6 +41,18 @@ class AppIconUrlField(fields.Raw):
|
|||
return None
|
||||
|
||||
|
||||
class AvatarUrlField(fields.Raw):
|
||||
def output(self, key, obj):
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
from models.account import Account
|
||||
|
||||
if isinstance(obj, Account) and obj.avatar is not None:
|
||||
return file_helpers.get_signed_file_url(obj.avatar)
|
||||
return None
|
||||
|
||||
|
||||
class TimestampField(fields.Raw):
|
||||
def format(self, value) -> int:
|
||||
return int(value.timestamp())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue