Skip to content

Commit

Permalink
[fix] contract approvement with team hidden_id
Browse files Browse the repository at this point in the history
  • Loading branch information
darloof committed Mar 1, 2024
1 parent c40cd66 commit 624bbdf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion psycity/team_api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ class Meta:
)

def validate_team(self, pk):
if len(str(pk)) == 10:
if len(str(pk)) == 12:
team = Team.objects.get(hidden_id=pk)
else:
team = Team.objects.get(pk=pk)
Expand Down
14 changes: 14 additions & 0 deletions psycity/team_api/views/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,23 @@ class Approvement(
second_party_agree=False,
state=1
)
team_query_set = Team.objects.all()

@response
def partial_update(self, request, *args, **kwargs):
if request.data.get('team'):
if len(str(request.data.get('team'))) == 12:
team = self.team_query_set.filter(hidden_id=request.data.get('team'))
if not team:
return Response(
data={
"message": "team not found.",
"data": [],
"result": None,
},
status=status.HTTP_404_NOT_FOUND,
)
request.data['team'] = team.first().channel_role
super().partial_update(request, *args, **kwargs)
return Response(
data={
Expand Down

0 comments on commit 624bbdf

Please sign in to comment.