Skip to content

Commit

Permalink
관리자가 폼 상태 변경시 실패하는 문제 해결 - submit 도메인 api 수정 (#320)
Browse files Browse the repository at this point in the history
  • Loading branch information
juno-junho authored Apr 24, 2024
1 parent 241af45 commit a392d88
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class ParticipationController {

private final ParticipationService participationService;

@PostMapping(value = {"/participate"})
@PostMapping("/participate")
public ResponseEntity<Void> apply(@RequestBody EventParticipationCreateRequest request, @Authenticated JwtUser jwtUser) {
EventParticipationCreateInfo eventParticipationCreateInfo = EventParticipationCreateInfo.builder()
.userId(jwtUser.id())
Expand All @@ -37,7 +37,7 @@ public ResponseEntity<Void> apply(@RequestBody EventParticipationCreateRequest r
return ResponseEntity.noContent().build();
}

@DeleteMapping(value = {"/{eventId}/participate"})
@DeleteMapping("/{eventId}/participate")
public ResponseEntity<EventParticipationDeleteResponse> cancel(@PathVariable Long eventId, @Authenticated JwtUser jwtUser) {
ParticipationStatus status = participationService.cancel(eventId, jwtUser.id());

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/spaceclub/event/service/EventService.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ public Page<UserBookmarkedEventGetInfo> findAllBookmarkedEventPages(Long userId,
}

@Override
@Transactional
public void minusParticipants(Event event, int ticketCount) {
int remainCapacity = event.getParticipants() - ticketCount;
Event updateEvent = event.registerParticipants(remainCapacity);
Expand All @@ -165,6 +166,7 @@ public Event getById(Long eventId) {
}

@Override
@Transactional
public Event save(Event event) {
return eventRepository.save(event);
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/spaceclub/form/service/SubmitService.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.spaceclub.notification.mail.service.event.MailEvent;
import com.spaceclub.user.service.UserProvider;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
Expand All @@ -26,6 +27,7 @@
import static com.spaceclub.event.EventExceptionMessage.EVENT_NOT_MANAGED;
import static com.spaceclub.event.domain.ParticipationStatus.CANCELED;

@Slf4j
@Service
@Transactional(readOnly = true)
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ Optional<User> findByEmailAndOauthUserName(
List<User> findAllUserToDelete(@Param("threeDaysAgoFromNow") LocalDateTime threeDaysAgoFromNow);

@Query("select u.email.email from User u where u.id = :userId and u.email.emailConsent = true")
Optional<String> findEmail(Long userId);
Optional<String> findEmail(@Param("userId") Long userId);

}

0 comments on commit a392d88

Please sign in to comment.