Feat: [#41] 프로젝트 초대 테이블 객체 생성 서비스 로직 구현

This commit is contained in:
sm4640
2025-05-02 22:11:50 +09:00
parent df1a861597
commit 973dbc85b6

View File

@@ -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
)