Exemplo n.º 1
0
 def retrieve_all_team_leaders(self):
     """
     Retrieve all teams and get their respective leaders as employee entities
     :return:
     """
     team_leaders = TeamLeader.objects.all()
     leader_entities = []
     for team_leader in team_leaders:
         leader_entities.append(DataConverters.to_team_leader_entity(team_leader))
     return leader_entities
Exemplo n.º 2
0
 def save_team_leader(self, tl_entity: TeamLeaderEntity):
     team_leader = TeamLeader(
         id=tl_entity.id,
         leader_id=tl_entity.leader.id,
         team_id=tl_entity.team.id,
         created_at=tl_entity.created_at,
         updated_at=tl_entity.updated_at
     )
     team_leader.save()
     team_leader.refresh_from_db()
     return DataConverters.to_team_leader_entity(team_leader)
Exemplo n.º 3
0
 def retrieve_team_leader(self, tl_pk: int):
     """
     Retrieve team leader and all teams it leader
     :param tl_pk:
     :return:
     """
     try:
         team_leader = TeamLeader.objects.get(pk=tl_pk)
         return DataConverters.to_team_leader_entity(team_leader)
     except TeamLeader.DoesNotExist:
         return None