diff --git a/projects/services.py b/projects/services.py index 50b9a64..e993e06 100644 --- a/projects/services.py +++ b/projects/services.py @@ -1,4 +1,8 @@ -from .models import Project +from .models import * +from .serializers import * + +from users.models import * +from common.models.choiceModels import InvitationStatus ACTION_FIELD_MAP = { @@ -38,3 +42,16 @@ class ProjectStateChangeService: now_count = current_count+1 if add else max(current_count-1, 0) setattr(project, field_name, now_count) project.save(update_fields=[field_name]) + + +class ProjectInvitationService: + @staticmethod + def create_project_invitation(project: Project, from_user: User, to_user: User, notification: Notification): + return ProjectInvitation.objects.create( + project=project, + from_user=from_user, + to_user=to_user, + status= InvitationStatus.PENDING, + notification=notification + ) + \ No newline at end of file