Ejemplo n.º 1
0
    def update_user_data(_user_dict: dict,form_data) -> m_LogicReturn: #using
        if type(_user_dict) != dict:
            return m_LogicReturn.f_error_msg("Session type is invalid")
        
        logic_resp = UserLogic.user_data_missing(_user_dict)
        if not logic_resp.success:
            return m_LogicReturn.f_error_msg(logic_resp.content)
        missing_list = logic_resp.addon_data

        for i in missing_list:
            form_entry = form_data.get(f"{i}Input", None)
            if form_entry is not None and len(form_entry) > 0:
                _user_dict[i] = form_entry

        new_user = m_User.fromDict(_user_dict)
        db_resp = DbUser().update_user(new_user)

        if not db_resp.success:
            return m_LogicReturn.f_error_msg( db_resp.content)
        if not SessionLogic.update_session_using_db().success:
            return m_LogicReturn.f_error_msg( "Updating session gaat fout!")
        return m_LogicReturn.f_success_msg("Updated user data!")
Ejemplo n.º 2
0
 def decorated_function(*args, **kwargs):
     debug.print_v("on update_session")
     debug.print_v("Updating session...")
     SessionLogic.update_session_using_db()
     return f(*args, **kwargs)