Пример #1
0
 def save_team_employee(self, te_entity: TeamEmployeeEntity):
     te_model = TeamEmployee(team_id=te_entity.team.id,
                             employee_id=te_entity.employee.id,
                             created_at=te_entity.created_at,
                             updated_at=te_entity.updated_at)
     te_model.save()
     print("Saved")
     te_model.refresh_from_db()
     return DataConverters.to_team_employee_entity(te_model)
Пример #2
0
    def retrieve_all_teams_employees(self):
        # loop through team objects and each team employees
        team_employees_entities = []
        team_employees = TeamEmployee.objects.all()

        for te_model in team_employees:
            team_employees_entities.append(
                DataConverters.to_team_employee_entity(te_model))
        return team_employees_entities
Пример #3
0
 def team_employee_exists(self, te_pk):
     try:
         team_employee = TeamEmployee.objects.get(pk=te_pk)
         return DataConverters.to_team_employee_entity(team_employee)
     except TeamEmployee.DoesNotExist:
         return None
Пример #4
0
 def delete_team_employee(self, te_pk: int):
     """Retrieve tea"""
     team_employee = TeamEmployee.objects.get(pk=te_pk)
     team_employee.delete()
     return DataConverters.to_team_employee_entity(team_employee)
Пример #5
0
 def retrieve_team_employees(self, te_pk: int):
     te_model = TeamEmployee.objects.get(pk=te_pk)
     return DataConverters.to_team_employee_entity(te_model)