generated from Real-Dev-Squad/website-template
-
Notifications
You must be signed in to change notification settings - Fork 14
feat: restrict member removal to admins and reassign tasks #255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
iamitprakash
merged 24 commits into
Real-Dev-Squad:develop
from
Hariom01010:remove-from-team-api
Sep 19, 2025
Merged
Changes from 16 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
13e97ad
feat(team): restrict member removal to admins and reassign tasks
Hariom01010 ad26f3a
feat(remove-member): resolve comments by bot
Hariom01010 f25bc28
feat(remove-member): instantiate the exception raised
Hariom01010 8ef56b8
Merge branch 'develop' of https://github.com/Hariom01010/todo-backend…
Hariom01010 3f0bd93
Merge branch 'develop' of https://github.com/Hariom01010/todo-backend…
Hariom01010 7877f29
feat(remove-from-team): sync changes for task assignment to postgres
Hariom01010 f075980
feat(remove-member): update cannot remove POC exception message
Hariom01010 13485ff
Merge branch 'develop' of https://github.com/Hariom01010/todo-backend…
Hariom01010 6bb20aa
feat(remove-member-from-team): handle mixed ObjectId and string types…
Hariom01010 7713420
feat(remove-member-from-team): move UserTeamDetailsRepository to the
Hariom01010 b0e48d3
feat(remove-from-team): set updated_by to None in the ops for task
Hariom01010 f96e4c4
feat(remove-member): move task_reassignment function in transaction
Hariom01010 42c9485
feat(remove-member): fix formatting issues
Hariom01010 3b50a66
feat(remove-from-team): include is_active in unique constraint to pre…
Hariom01010 4b4ae55
feat(remove-from-team): remove unecessary comments
Hariom01010 bd88687
feat(remove-from-member): add serializer for path params validation
Hariom01010 3d20bfb
Merge branch 'develop' of https://github.com/Hariom01010/todo-backend…
Hariom01010 d567b3a
feat(remove-from-team): removed aggregation pipeline and use normal db
Hariom01010 01e59b8
feat(remove-from-todo): remove unecessary migration files
Hariom01010 bbc2132
feat(remove-from-team): remove task_count field from audit log model
Hariom01010 3bf3c2a
feat(remove-from-team): fix bug where reassigned todos not showing on
Hariom01010 3c6f245
feat(remove-from-team): move remove role and validation to individual
Hariom01010 8bcea47
feat(remove-from-team): fix formatting issues
Hariom01010 2059402
feat(remove-from-team): use bool return value instead of count for ta…
Hariom01010 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from todo.constants.messages import ApiErrors | ||
|
||
|
||
class BaseTeamException(Exception): | ||
def __init__(self, message: str): | ||
self.message = message | ||
super().__init__(self.message) | ||
|
||
|
||
class CannotRemoveOwnerException(BaseTeamException): | ||
def __init__(self, message=ApiErrors.CANNOT_REMOVE_OWNER): | ||
super().__init__(message) | ||
|
||
|
||
class NotTeamAdminException(BaseTeamException): | ||
def __init__(self, message=ApiErrors.UNAUTHORIZED_TITLE): | ||
super().__init__(message) | ||
|
||
|
||
class CannotRemoveTeamPOCException(BaseTeamException): | ||
def __init__(self, message=ApiErrors.CANNOT_REMOVE_POC): | ||
super().__init__(message) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 5.1.5 on 2025-09-02 15:07 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("todo", "0002_rename_postgres_ta_assignee_95ca3b_idx_postgres_ta_assigne_f1c6e7_idx_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="postgresauditlog", | ||
name="task_count", | ||
field=models.IntegerField(blank=True, null=True), | ||
), | ||
] |
16 changes: 16 additions & 0 deletions
16
todo/migrations/0004_alter_postgresuserrole_unique_together.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Generated by Django 5.1.5 on 2025-09-05 15:27 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("todo", "0003_postgresauditlog_task_count"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterUniqueTogether( | ||
name="postgresuserrole", | ||
unique_together={("user_id", "role_name", "scope", "team_id", "is_active")}, | ||
), | ||
] |
24 changes: 24 additions & 0 deletions
24
todo/migrations/0005_alter_postgresuserrole_unique_together_and_more.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Generated by Django 5.1.5 on 2025-09-09 14:49 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("todo", "0004_alter_postgresuserrole_unique_together"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterUniqueTogether( | ||
name="postgresuserrole", | ||
unique_together=set(), | ||
), | ||
migrations.AddConstraint( | ||
model_name="postgresuserrole", | ||
constraint=models.UniqueConstraint( | ||
condition=models.Q(("is_active", True)), | ||
fields=("user_id", "role_name", "scope", "team_id"), | ||
name="unique_active_user_team_role", | ||
), | ||
), | ||
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from rest_framework import serializers | ||
from bson import ObjectId | ||
from todo.constants.messages import ValidationErrors | ||
|
||
|
||
class RemoveFromTeamSerializer(serializers.Serializer): | ||
team_id = serializers.CharField() | ||
user_id = serializers.CharField() | ||
|
||
def validate_team_id(self, value): | ||
if not ObjectId.is_valid(value): | ||
raise serializers.ValidationError(ValidationErrors.INVALID_OBJECT_ID.format(value)) | ||
return value | ||
|
||
def validate_user_id(self, value): | ||
if not ObjectId.is_valid(value): | ||
raise serializers.ValidationError(ValidationErrors.INVALID_OBJECT_ID.format(value)) | ||
return value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.