11import logging
2- from typing import Literal
2+ from typing import Annotated , Literal
33
44from models_library .emails import LowerCaseEmailStr
55from pydantic import (
1818
1919
2020class InvitationCheck (InputSchema ):
21- invitation : str = Field (..., description = "Invitation code" )
21+ invitation : Annotated [ str , Field (description = "Invitation code" )]
2222
2323
2424class InvitationInfo (InputSchema ):
25- email : LowerCaseEmailStr | None = Field (
26- None , description = "Email associated to invitation or None"
27- )
25+ email : Annotated [
26+ LowerCaseEmailStr | None ,
27+ Field (description = "Email associated to invitation or None" ),
28+ ] = None
2829
2930
3031class RegisterBody (InputSchema ):
3132 email : LowerCaseEmailStr
3233 password : SecretStr
33- confirm : SecretStr | None = Field (None , description = "Password confirmation" )
34- invitation : str | None = Field (None , description = "Invitation code" )
34+ confirm : Annotated [SecretStr | None , Field (description = "Password confirmation" )] = (
35+ None
36+ )
37+ invitation : Annotated [str | None , Field (description = "Invitation code" )] = None
3538
3639 _password_confirm_match = field_validator ("confirm" )(check_confirm_password_match )
3740 model_config = ConfigDict (
@@ -50,15 +53,21 @@ class RegisterBody(InputSchema):
5053
5154class RegisterPhoneBody (InputSchema ):
5255 email : LowerCaseEmailStr
53- phone : str = Field (
54- ..., description = "Phone number E.164, needed on the deployments with 2FA"
55- )
56+ phone : Annotated [
57+ str , Field ( description = "Phone number E.164, needed on the deployments with 2FA" )
58+ ]
5659
5760
5861class _PageParams (BaseModel ):
5962 expiration_2fa : PositiveInt | None = None
6063
6164
65+ class RegisterPhoneNextPage (NextPage [_PageParams ]):
66+ logger : str = "user"
67+ level : Literal ["INFO" , "WARNING" , "ERROR" ] = "INFO"
68+ message : str
69+
70+
6271class RegisterPhoneNextPage (NextPage [_PageParams ]):
6372 logger : str = Field ("user" , deprecated = True )
6473 level : Literal ["INFO" , "WARNING" , "ERROR" ] = "INFO"
0 commit comments