mirror of
https://github.com/imartinez/privateGPT.git
synced 2025-06-28 08:18:09 +00:00
Added a schema for username update
This commit is contained in:
parent
226c1a6622
commit
0a326c1e43
2
.env
2
.env
@ -4,7 +4,7 @@ ENVIRONMENT=dev
|
||||
DB_HOST=localhost
|
||||
DB_USER=postgres
|
||||
DB_PORT=5432
|
||||
DB_PASSWORD=quick
|
||||
DB_PASSWORD=admin
|
||||
DB_NAME=QuickGpt
|
||||
|
||||
SUPER_ADMIN_EMAIL=superadmin@email.com
|
||||
|
@ -81,6 +81,7 @@ class Home:
|
||||
if completion_gen.sources:
|
||||
full_response += SOURCES_SEPARATOR
|
||||
cur_sources = Source.curate_sources(completion_gen.sources)
|
||||
|
||||
sources_text = "\n".join(
|
||||
f'<a href="{source.page_link}" target="_blank" rel="noopener noreferrer">{index}. {source.file} (page {source.page})</a>'
|
||||
for index, source in enumerate(cur_sources, start=1)
|
||||
|
@ -115,15 +115,7 @@ def login_access_token(
|
||||
|
||||
|
||||
@router.post("/login/refresh-token", response_model=schemas.TokenSchema)
|
||||
def refresh_
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
access_token(
|
||||
def refresh_access_token(
|
||||
db: Session = Depends(deps.get_db),
|
||||
refresh_token: str = Body(..., embed=True),
|
||||
) -> Any:
|
||||
@ -150,57 +142,6 @@ def register(
|
||||
*,
|
||||
db: Session = Depends(deps.get_db),
|
||||
email: str = Body(...),
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
fullname: str = Body(...),
|
||||
company_id: int = Body(None, title="Company ID",
|
||||
description="Company ID for the user (if applicable)"),
|
||||
|
@ -84,13 +84,13 @@ def create_user(
|
||||
def update_username(
|
||||
*,
|
||||
db: Session = Depends(deps.get_db),
|
||||
fullname: str = Body(...),
|
||||
current_user: models.User = Depends(deps.get_current_user),
|
||||
update_in: schemas.UsernameUpdate,
|
||||
) -> Any:
|
||||
"""
|
||||
Update own username.
|
||||
"""
|
||||
user_in = schemas.UserUpdate(fullname=fullname, email=current_user.email, company_id=current_user.company_id)
|
||||
user_in = schemas.UserUpdate(fullname=update_in.fullname, email=current_user.email, company_id=current_user.company_id)
|
||||
user = crud.user.update(db, db_obj=current_user, obj_in=user_in)
|
||||
user_data = schemas.UserBaseSchema(
|
||||
email=user.email,
|
||||
|
@ -1,6 +1,6 @@
|
||||
from .role import Role, RoleCreate, RoleInDB, RoleUpdate
|
||||
from .token import TokenSchema, TokenPayload
|
||||
from .user import User, UserCreate, UserInDB, UserUpdate, UserBaseSchema, Profile
|
||||
from .user import User, UserCreate, UserInDB, UserUpdate, UserBaseSchema, Profile, UsernameUpdate
|
||||
from .user_role import UserRole, UserRoleCreate, UserRoleInDB, UserRoleUpdate
|
||||
from .subscription import Subscription, SubscriptionBase, SubscriptionCreate, SubscriptionUpdate
|
||||
from .company import Company, CompanyBase, CompanyCreate, CompanyUpdate
|
@ -17,6 +17,8 @@ class UserBaseSchema(BaseModel):
|
||||
class UserCreate(UserBaseSchema):
|
||||
password: str = Field(alias="password")
|
||||
|
||||
class UsernameUpdate(BaseModel):
|
||||
fullname: str
|
||||
|
||||
class UserUpdate(UserBaseSchema):
|
||||
last_login: Optional[datetime] = None
|
||||
|
Loading…
Reference in New Issue
Block a user