auth api tested
This commit is contained in:
@@ -10,7 +10,7 @@ from sqlalchemy import (
|
||||
SmallInteger,
|
||||
)
|
||||
|
||||
from Services.PostgresDb import CrudCollection
|
||||
from Services.PostgresService.controllers.mixin_controllers import CrudCollection
|
||||
from ApiLayers.LanguageModels.Database.account.account import (
|
||||
AccountBooksLanguageModel,
|
||||
AccountCodesLanguageModel,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from sqlalchemy import String, ForeignKey, Index, TIMESTAMP, SmallInteger, Identity
|
||||
from sqlalchemy.orm import mapped_column, Mapped
|
||||
|
||||
from Services.PostgresDb import CrudCollection
|
||||
from Services.PostgresService.controllers.mixin_controllers import CrudCollection
|
||||
|
||||
|
||||
class BuildIbans(CrudCollection):
|
||||
|
||||
@@ -6,7 +6,7 @@ from sqlalchemy import String
|
||||
from sqlalchemy.orm import mapped_column, Mapped
|
||||
|
||||
from cryptography.fernet import Fernet, MultiFernet
|
||||
from Services.PostgresDb import CrudCollection
|
||||
from Services.PostgresService.controllers.mixin_controllers import CrudCollection
|
||||
|
||||
|
||||
class CrypterEngine(CrudCollection):
|
||||
|
||||
@@ -9,7 +9,7 @@ from sqlalchemy import (
|
||||
Integer,
|
||||
)
|
||||
from sqlalchemy.orm import mapped_column, Mapped
|
||||
from Services.PostgresDb import CrudCollection
|
||||
from Services.PostgresService.controllers.mixin_controllers import CrudCollection
|
||||
|
||||
|
||||
class DecisionBookBudgetBooks(CrudCollection):
|
||||
|
||||
@@ -16,7 +16,7 @@ from sqlalchemy import (
|
||||
)
|
||||
|
||||
from ApiLayers.ApiLibrary import system_arrow, SelectActionWithEmployee
|
||||
from Services.PostgresDb import CrudCollection
|
||||
from Services.PostgresService.controllers.mixin_controllers import CrudCollection
|
||||
from ApiLayers.ApiValidations.Request import (
|
||||
InsertBuild,
|
||||
InsertBuildParts,
|
||||
|
||||
@@ -25,7 +25,7 @@ from ApiLayers.ApiValidations.Request import (
|
||||
InsertBuildDecisionBookItemDebits,
|
||||
InsertBuildDecisionBookProjects,
|
||||
)
|
||||
from Services.PostgresDb import CrudCollection
|
||||
from Services.PostgresService.controllers.mixin_controllers import CrudCollection
|
||||
from ApiLayers.LanguageModels.Database.building.decision_book import (
|
||||
BuildDecisionBookLanguageModel,
|
||||
BuildDecisionBookInvitationsLanguageModel,
|
||||
|
||||
@@ -23,7 +23,7 @@ from ApiLayers.LanguageModels.Database.company.company import (
|
||||
CompaniesLanguageModel,
|
||||
# CompanyDutiesLanguageModel,
|
||||
)
|
||||
from Services.PostgresDb import CrudCollection
|
||||
from Services.PostgresService.controllers.mixin_controllers import CrudCollection
|
||||
|
||||
|
||||
class RelationshipDutyCompany(CrudCollection):
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from sqlalchemy import String, Integer, ForeignKey, Index, Boolean, Identity
|
||||
from sqlalchemy.orm import mapped_column, Mapped
|
||||
|
||||
from Services.PostgresDb import CrudCollection
|
||||
from Services.PostgresService.controllers.mixin_controllers import CrudCollection
|
||||
|
||||
|
||||
class Departments(CrudCollection):
|
||||
|
||||
@@ -12,7 +12,7 @@ from ApiLayers.LanguageModels.Database.company.employee import (
|
||||
EmployeeHistoryLanguageModel,
|
||||
EmployeesSalariesLanguageModel,
|
||||
)
|
||||
from Services.PostgresDb import CrudCollection
|
||||
from Services.PostgresService.controllers.mixin_controllers import CrudCollection
|
||||
|
||||
from ApiLayers.ApiValidations.Request import InsertCompanyEmployees
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from Services.PostgresDb import CrudCollection
|
||||
from Services.PostgresService.controllers.mixin_controllers import CrudCollection
|
||||
from ApiLayers.LanguageModels.Database.event.event import (
|
||||
EventsLanguageModel,
|
||||
ModulesLanguageModel,
|
||||
@@ -250,29 +250,28 @@ class Event2Employee(CrudCollection):
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def get_event_codes(cls, employee_id: int) -> list:
|
||||
db = cls.new_session()
|
||||
def get_event_codes(cls, employee_id: int, db_session) -> list:
|
||||
employee_events = cls.filter_all(
|
||||
cls.employee_id == employee_id,
|
||||
db=db,
|
||||
db=db_session,
|
||||
).data
|
||||
active_event_ids = Service2Events.filter_all_system(
|
||||
Service2Events.service_id.in_(
|
||||
[event.event_service_id for event in employee_events]
|
||||
),
|
||||
db=db,
|
||||
db=db_session,
|
||||
).data
|
||||
active_events = Events.filter_all(
|
||||
Events.id.in_([event.event_id for event in active_event_ids]),
|
||||
db=db,
|
||||
db=db_session,
|
||||
).data
|
||||
if extra_events := Event2EmployeeExtra.filter_all(
|
||||
Event2EmployeeExtra.employee_id == employee_id,
|
||||
db=db,
|
||||
db=db_session,
|
||||
).data:
|
||||
events_extra = Events.filter_all(
|
||||
Events.id.in_([event.event_id for event in extra_events]),
|
||||
db=db,
|
||||
db=db_session,
|
||||
).data
|
||||
active_events.extend(events_extra)
|
||||
return [event.function_code for event in active_events]
|
||||
|
||||
@@ -15,7 +15,7 @@ from sqlalchemy import (
|
||||
)
|
||||
from sqlalchemy.orm import mapped_column, relationship, Mapped
|
||||
|
||||
from Services.PostgresDb import CrudCollection
|
||||
from Services.PostgresService.controllers.mixin_controllers import CrudCollection
|
||||
from config import ApiStatic
|
||||
|
||||
from ApiLayers.ApiLibrary.date_time_actions.date_functions import system_arrow
|
||||
@@ -144,8 +144,7 @@ class Users(CrudCollection, SelectAction):
|
||||
return "Occupant" if self.is_occupant else "Employee"
|
||||
|
||||
@classmethod
|
||||
def credentials(cls):
|
||||
db_session = cls.new_session()
|
||||
def credentials(cls, db_session):
|
||||
person_object: People = People.filter_by_one(
|
||||
db=db_session, system=True, id=cls.person_id
|
||||
).data
|
||||
|
||||
@@ -9,7 +9,7 @@ from sqlalchemy.orm import (
|
||||
Mapped,
|
||||
mapped_column,
|
||||
)
|
||||
from Services.PostgresDb import CrudCollection
|
||||
from Services.PostgresService.controllers.mixin_controllers import CrudCollection
|
||||
|
||||
|
||||
class ApiEnumDropdown(CrudCollection):
|
||||
|
||||
@@ -4,7 +4,7 @@ from sqlalchemy.orm import mapped_column, Mapped
|
||||
from ApiLayers.LanguageModels.Database.rules.rules import (
|
||||
EndpointRestrictionLanguageModel,
|
||||
)
|
||||
from Services.PostgresDb import CrudCollection
|
||||
from Services.PostgresService.controllers.mixin_controllers import CrudCollection
|
||||
|
||||
|
||||
class EndpointRestriction(CrudCollection):
|
||||
|
||||
Reference in New Issue
Block a user