mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: issue votes (#2006)
* fix: issue votes * fix: added default as 1 in vote * fix: issue vote migration file
This commit is contained in:
parent
1cf5e8d80a
commit
b2a41d3bf6
@ -1822,8 +1822,9 @@ class IssueVotePublicViewSet(BaseViewSet):
|
||||
actor_id=request.user.id,
|
||||
project_id=project_id,
|
||||
issue_id=issue_id,
|
||||
vote=request.data.get("vote", 1),
|
||||
)
|
||||
issue_vote.vote = request.data.get("vote", 1)
|
||||
issue_vote.save()
|
||||
serializer = IssueVoteSerializer(issue_vote)
|
||||
return Response(serializer.data, status=status.HTTP_201_CREATED)
|
||||
except Exception as e:
|
||||
|
@ -0,0 +1,26 @@
|
||||
# Generated by Django 4.2.3 on 2023-08-29 07:58
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('db', '0041_cycle_sort_order_issuecomment_access_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterUniqueTogether(
|
||||
name='issuevote',
|
||||
unique_together=set(),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='issuevote',
|
||||
name='vote',
|
||||
field=models.IntegerField(choices=[(-1, 'DOWNVOTE'), (1, 'UPVOTE')], default=1),
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='issuevote',
|
||||
unique_together={('issue', 'actor', 'vote')},
|
||||
),
|
||||
]
|
@ -476,10 +476,12 @@ class IssueVote(ProjectBaseModel):
|
||||
choices=(
|
||||
(-1, "DOWNVOTE"),
|
||||
(1, "UPVOTE"),
|
||||
),
|
||||
default=1,
|
||||
)
|
||||
)
|
||||
|
||||
class Meta:
|
||||
unique_together = ["issue", "actor"]
|
||||
unique_together = ["issue", "actor", "vote"]
|
||||
verbose_name = "Issue Vote"
|
||||
verbose_name_plural = "Issue Votes"
|
||||
db_table = "issue_votes"
|
||||
|
Loading…
Reference in New Issue
Block a user