✨ Feat: [#41] 프로젝트 초대 테이블 객체 생성 서비스 로직 구현
This commit is contained in:
@@ -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
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user