fix(api): schemas, name error
This commit is contained in:
parent
2493cd0d9f
commit
2690843954
@ -8,15 +8,12 @@ from api.schemas.base import Base
|
||||
|
||||
|
||||
class UserUpdate(Base):
|
||||
# id: Optional[int] = None
|
||||
name: Optional[str] = Field(None, max_length=100)
|
||||
login: Optional[str] = Field(None, max_length=100)
|
||||
email: Optional[EmailStr] = None
|
||||
bind_tenant_id: Optional[str] = Field(None, max_length=40)
|
||||
role: Optional[AccountRole] = None
|
||||
meta: Optional[dict] = None
|
||||
# creator_id: Optional[int] = None
|
||||
# created_at: Optional[datetime] = None
|
||||
status: Optional[AccountStatus] = None
|
||||
|
||||
|
||||
|
@ -10,8 +10,5 @@ from api.schemas.base import Base
|
||||
class AccountKeyringUpdate(Base):
|
||||
owner_id: Optional[int] = None
|
||||
key_type: Optional[KeyType] = None
|
||||
# key_id: Optional[str] = Field(None, max_length=40)
|
||||
key_value: Optional[str] = Field(None, max_length=255)
|
||||
# created_at: Optional[datetime] = None
|
||||
# expiry: Optional[datetime] = None
|
||||
status: Optional[KeyStatus] = None
|
||||
|
@ -8,11 +8,8 @@ from api.db.tables.events import EventState,EventStatus
|
||||
|
||||
|
||||
class ListEventUpdate(Base):
|
||||
# id: Optional[int] = None
|
||||
name: Optional[str] = Field(None, max_length=40)
|
||||
title: Optional[str] = Field(None, max_length=64)
|
||||
# creator_id: Optional[int] = None
|
||||
# created_at: Optional[datetime]= None
|
||||
schema_: Optional[Dict[str, Any]]= Field(None, alias="schema")
|
||||
state: Optional[EventState]= None
|
||||
status: Optional[EventStatus]= None
|
||||
|
@ -12,10 +12,10 @@ async def db_user_role_validation(connection, current_user):
|
||||
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail="You do not have enough permissions")
|
||||
return authorize_user
|
||||
|
||||
async def db_user_role_validation_for_listevents_by_listevent_id(connection, current_user,current_lisevents_creator_id):
|
||||
async def db_user_role_validation_for_listevents_by_listevent_id(connection, current_user,current_listevents_creator_id):
|
||||
authorize_user = await get_user_by_login(connection, current_user)
|
||||
if authorize_user.role not in {AccountRole.OWNER, AccountRole.ADMIN}:
|
||||
if authorize_user.id != current_lisevents_creator_id:
|
||||
if authorize_user.id != current_listevents_creator_id:
|
||||
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail="You do not have enough permissions")
|
||||
return authorize_user
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user