Coverage for middle_layer/solicit/application_layer/orm_repositories/frontend_configuration.py: 0.00%

21 statements  

« prev     ^ index     » next       coverage.py v7.10.5, created at 2026-03-09 06:13 +0000

1# Copyright 2024 Associated Universities, Inc. 

2# 

3# This file is part of Telescope Time Allocation Tools (TTAT). 

4# 

5# TTAT is free software: you can redistribute it and/or modify 

6# it under the terms of the GNU General Public License as published by 

7# the Free Software Foundation, either version 3 of the License, or 

8# any later version. 

9# 

10# TTAT is distributed in the hope that it will be useful, 

11# but WITHOUT ANY WARRANTY; without even the implied warranty of 

12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

13# GNU General Public License for more details. 

14# 

15# You should have received a copy of the GNU General Public License 

16# along with TTAT. If not, see <https://www.gnu.org/licenses/>. 

17# 

18from sqlalchemy.orm import Session 

19 

20from common.application_layer.orm_repositories import add_entity, get_object_by_id, list_entities 

21from solicit.domain_layer.entities.parameter_configuration import ParameterConfiguration 

22from solicit.domain_layer.repositories.solicitation import ParameterConfigurationRepository 

23 

24 

25class ParameterConfigurationORMRepository(ParameterConfigurationRepository): 

26 def __init__(self, session: Session): 

27 self.session = session 

28 

29 def by_id(self, parameter_configuration_id: int) -> ParameterConfiguration: 

30 return get_object_by_id( 

31 self.session, 

32 parameter_configuration_id, 

33 ParameterConfiguration, 

34 ParameterConfiguration.parameter_configuration_id, 

35 ) 

36 

37 def list_all(self) -> list[ParameterConfiguration]: 

38 return list_entities( 

39 self.session, 

40 ParameterConfiguration, 

41 ParameterConfiguration.parameter_configuration_id, 

42 ) 

43 

44 def add(self, solicitation_facility_capability: ParameterConfiguration) -> int: 

45 add_entity(self.session, solicitation_facility_capability) 

46 return solicitation_facility_capability.parameter_configuration_id 

47 

48 def update(self, parameter_configuration: ParameterConfiguration) -> None: 

49 if parameter_configuration is not None: 

50 self.session.add(parameter_configuration) 

51 self.session.flush() 

52 

53 def delete(self, parameter_configuration: ParameterConfiguration) -> None: 

54 self.session.delete(parameter_configuration) 

55 self.session.flush()