1
0
mirror of https://github.com/etesync/server synced 2024-11-18 23:08:08 +00:00

Adjust pydantic code to v2.

This commit is contained in:
Tom Hacohen 2024-06-08 18:10:34 -04:00
parent 0cdab19308
commit fb9cc701d0
5 changed files with 8 additions and 8 deletions

View File

@ -11,7 +11,7 @@ class HttpErrorField(BaseModel):
detail: str detail: str
class Config: class Config:
orm_mode = True from_attributes = True
class HttpErrorOut(BaseModel): class HttpErrorOut(BaseModel):
@ -20,7 +20,7 @@ class HttpErrorOut(BaseModel):
errors: t.Optional[t.List[HttpErrorField]] errors: t.Optional[t.List[HttpErrorField]]
class Config: class Config:
orm_mode = True from_attributes = True
class CustomHttpException(HTTPException): class CustomHttpException(HTTPException):

View File

@ -76,7 +76,7 @@ class LoginOut(BaseModel):
class Authentication(BaseModel): class Authentication(BaseModel):
class Config: class Config:
keep_untouched = (cached_property,) ignored_types= (cached_property,)
response: bytes response: bytes
signature: bytes signature: bytes

View File

@ -52,7 +52,7 @@ class CollectionItemRevisionInOut(BaseModel):
chunks: t.List[ChunkType] chunks: t.List[ChunkType]
class Config: class Config:
orm_mode = True from_attributes = True
@classmethod @classmethod
def from_orm_context( def from_orm_context(
@ -78,7 +78,7 @@ class CollectionItemCommon(BaseModel):
class CollectionItemOut(CollectionItemCommon): class CollectionItemOut(CollectionItemCommon):
class Config: class Config:
orm_mode = True from_attributes = True
@classmethod @classmethod
def from_orm_context( def from_orm_context(

View File

@ -34,7 +34,7 @@ class UserInfoOut(BaseModel):
pubkey: bytes pubkey: bytes
class Config: class Config:
orm_mode = True from_attributes= True
@classmethod @classmethod
def from_orm(cls: t.Type["UserInfoOut"], obj: models.UserInfo) -> "UserInfoOut": def from_orm(cls: t.Type["UserInfoOut"], obj: models.UserInfo) -> "UserInfoOut":
@ -67,7 +67,7 @@ class CollectionInvitationOut(CollectionInvitationCommon):
fromPubkey: bytes fromPubkey: bytes
class Config: class Config:
orm_mode = True from_attributes = True
@classmethod @classmethod
def from_orm(cls: t.Type["CollectionInvitationOut"], obj: models.CollectionInvitation) -> "CollectionInvitationOut": def from_orm(cls: t.Type["CollectionInvitationOut"], obj: models.CollectionInvitation) -> "CollectionInvitationOut":

View File

@ -39,7 +39,7 @@ class CollectionMemberOut(BaseModel):
accessLevel: models.AccessLevels accessLevel: models.AccessLevels
class Config: class Config:
orm_mode = True from_attributes = True
@classmethod @classmethod
def from_orm(cls: t.Type["CollectionMemberOut"], obj: models.CollectionMember) -> "CollectionMemberOut": def from_orm(cls: t.Type["CollectionMemberOut"], obj: models.CollectionMember) -> "CollectionMemberOut":