@@ -120,11 +120,11 @@ async def query(session: SessionDep, trans: Trans, id: int) -> UserEditor:
120120@router .post ("" )
121121async def create (session : SessionDep , creator : UserCreator , trans : Trans ):
122122 if check_account_exists (session = session , account = creator .account ):
123- raise Exception (trans ('i18n_exist' , msg = f"{ trans ('i18n_user.account' ) [{creator .account }]} " ))
123+ raise Exception (trans ('i18n_exist' , msg = f"{ trans ('i18n_user.account' )} [{ creator .account } ]" ))
124124 if check_email_exists (session = session , email = creator .email ):
125- raise Exception (trans ('i18n_exist' , msg = f"{ trans ('i18n_user.email' ) [{creator .email }]} " ))
125+ raise Exception (trans ('i18n_exist' , msg = f"{ trans ('i18n_user.email' )} [{ creator .email } ]" ))
126126 if not check_email_format (creator .email ):
127- raise Exception (trans ('i18n_format_invalid' , key = f"{ trans ('i18n_user.email' ) [{creator .email }]} " ))
127+ raise Exception (trans ('i18n_format_invalid' , key = f"{ trans ('i18n_user.email' )} [{ creator .email } ]" ))
128128 data = creator .model_dump (exclude_unset = True )
129129 user_model = UserModel .model_validate (data )
130130 #user_model.create_time = get_timestamp()
@@ -154,9 +154,9 @@ async def update(session: SessionDep, editor: UserEditor, trans: Trans):
154154 if editor .account != user_model .account :
155155 raise Exception (f"account cannot be changed!" )
156156 if editor .email != user_model .email and check_email_exists (session = session , account = editor .email ):
157- raise Exception (trans ('i18n_exist' , msg = f"{ trans ('i18n_user.email' ) [{editor .email }]} " ))
157+ raise Exception (trans ('i18n_exist' , msg = f"{ trans ('i18n_user.email' )} [{ editor .email } ]" ))
158158 if not check_email_format (editor .email ):
159- raise Exception (trans ('i18n_format_invalid' , key = f"{ trans ('i18n_user.email' ) [{editor .email }]} " ))
159+ raise Exception (trans ('i18n_format_invalid' , key = f"{ trans ('i18n_user.email' )} [{ editor .email } ]" ))
160160 origin_oid : int = user_model .oid
161161 del_stmt = sqlmodel_delete (UserWsModel ).where (UserWsModel .uid == editor .id )
162162 session .exec (del_stmt )
0 commit comments