Skip to content

Commit

Permalink
Merge pull request #84 from mash-up-kr/fix/alone-status
Browse files Browse the repository at this point in the history
feat: Update group status
  • Loading branch information
210-reverof authored Sep 7, 2024
2 parents c097330 + 98a3523 commit d6e571a
Showing 1 changed file with 22 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,26 @@ class EventService(
date: LocalDateTime,
pictures: List<String>
): Long {
val groupJoinCount = groupJoinRepository.findAllByGroupId(groupId).size
val event =
eventRepository.save(
Event(
groupId = groupId,
description = description,
date = date
if (groupJoinCount == 1) {
eventRepository.save(
Event(
groupId = groupId,
description = description,
date = date,
eventStatus = EventStatus.VOTING
)
)
)
} else {
eventRepository.save(
Event(
groupId = groupId,
description = description,
date = date
)
)
}

createEventJoinsByGroup(event.id, groupId)
val creatorEventJoin = getEventJoinByUserIdAndEventId(userId, event.id)
Expand All @@ -43,7 +55,10 @@ class EventService(
EventImageOption(creatorEventJoin.id, picture)
}
eventImageOptionRepository.saveAll(eventImageOptions)
eventRedisRepository.setEventStatusExpiredTime(currentEventStatus = EventStatus.UPLOADING, eventId = event.id)

if (groupJoinCount > 1) {
eventRedisRepository.setEventStatusExpiredTime(currentEventStatus = EventStatus.UPLOADING, eventId = event.id)
}

return event.id
}
Expand Down

0 comments on commit d6e571a

Please sign in to comment.