Fix: Removal of filter methods from controllers.

This commit is contained in:
2024-11-17 15:17:57 +00:00
parent a2af292726
commit 197f6ec5bc
44 changed files with 1317 additions and 927 deletions

View File

@@ -108,54 +108,3 @@ class Unit_Measurement(SQLAlchemy_ABC, Base):
is_unit_of_volume: {self.is_unit_of_volume},
active: {self.active}
'''
"""
@dataclass
class Filters_Unit_Measurement():
active_only: bool = False
def to_json(self):
return {
**self.get_shared_json_attributes(self),
'a_get_all_user': self.get_all_user,
'a_get_inactive_user': self.get_inactive_user,
'a_get_first_user_only': self.get_first_user_only,
'a_ids_user': self.ids_user,
'a_ids_user_auth0': self.ids_user_auth0,
}
@staticmethod
def from_form(form):
av.val_instance(form, 'form', 'User_Filters.from_form', Form_Filters_User)
get_inactive = av.input_bool(form.active.data, "active", "User_Filters.from_form")
id_user = form.id_user.data
return User_Filters(
get_all_user = (id_user is None),
get_inactive_user = get_inactive,
get_first_user_only = False,
ids_user = id_user,
ids_user_auth0 = '',
)
@staticmethod
def from_user(user):
av.val_instance(user, 'user', 'User_Filters.from_user', User)
return User_Filters(
get_all_user = (user.id_user is None and user.id_user_auth0 is None),
get_inactive_user = False,
get_first_user_only = False,
ids_user = user.id_user,
ids_user_auth0 = user.id_user_auth0,
)
@staticmethod
def get_default(datastore_store):
user = datastore_store.get_login_user()
return User_Filters(
get_all_user = False,
get_inactive_user = False,
get_first_user_only = False,
ids_user = user.id_user,
ids_user_auth0 = '',
)
"""