feat(auth): add profile update and password change endpoints; enhance provider list handling

This commit is contained in:
JSC
2025-06-29 22:00:59 +02:00
parent 91648a858e
commit a7210a8d50
4 changed files with 129 additions and 4 deletions

View File

@@ -67,6 +67,13 @@ class User(db.Model):
def to_dict(self) -> dict:
"""Convert user to dictionary."""
# Build comprehensive providers list
providers = [provider.provider for provider in self.oauth_providers]
if self.password_hash:
providers.append("password")
if self.api_token:
providers.append("api_token")
return {
"id": str(self.id),
"email": self.email,
@@ -76,7 +83,7 @@ class User(db.Model):
"is_active": self.is_active,
"api_token": self.api_token,
"api_token_expires_at": self.api_token_expires_at.isoformat() if self.api_token_expires_at else None,
"providers": [provider.provider for provider in self.oauth_providers],
"providers": providers,
"plan": self.plan.to_dict() if self.plan else None,
"credits": self.credits,
"created_at": self.created_at.isoformat(),