File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 11import  uuid 
2+ from  enum  import  Enum 
23
34from  pydantic  import  EmailStr 
45from  sqlmodel  import  Field , Relationship , SQLModel 
@@ -39,16 +40,20 @@ class UpdatePassword(SQLModel):
3940    new_password : str  =  Field (min_length = 8 , max_length = 40 )
4041
4142
43+ class  UserRole (str , Enum ):
44+     ADMIN : str  =  "admin" 
45+     USER :  str  =  "user" 
46+ 
4247# Database model, database table inferred from class name 
4348class  User (UserBase , table = True ):
4449    id : uuid .UUID  =  Field (default_factory = uuid .uuid4 , primary_key = True )
4550    hashed_password : str 
4651    items : list ["Item" ] =  Relationship (back_populates = "owner" , cascade_delete = True )
52+     role : UserRole  =  Field (default = UserRole .USER )  
53+    
54+ 
55+ 
4756
48-     class  UserRole (str , Enum ):
49-         USER  =  "user" 
50-     ADMIN  =  "admin" 
51-     MODERATOR  =  "moderator" 
5257
5358
5459# Properties to return via API, id is always required 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments