Skip to content

Commit

Permalink
feat: 이벤트 로깅정책 수정
Browse files Browse the repository at this point in the history
- 테이블에 로그 저장하도록 정책 변경
  • Loading branch information
eckrin committed May 7, 2024
1 parent 3285883 commit 21c9942
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public QEventUser(PathMetadata metadata, PathInits inits) {

public QEventUser(Class<? extends EventUser> type, PathMetadata metadata, PathInits inits) {
super(type, metadata, inits);
this.event = inits.isInitialized("event") ? new QEvent(forProperty("event")) : null;
this.event = inits.isInitialized("event") ? new QEvent(forProperty("event"), inits.get("event")) : null;
this.user = inits.isInitialized("user") ? new com.kusitms.jipbap.user.model.entity.QUser(forProperty("user"), inits.get("user")) : null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ public class EventController {
@PutMapping
@Operation(summary = "신규 이벤트 등록 (관리자)")
public RegisterEventResponse registerNewEvent(@Auth AuthInfo authInfo, @Valid @RequestBody RegisterEventRequest request) {
EventDto dto = eventService.registerEvent(authInfo.getEmail(), request);
return new RegisterEventResponse(dto.getId(), dto.getTitle(), dto.getDescription(), dto.getAmount());
return eventService.registerEvent(authInfo.getEmail(), request);
}

// 이벤트 응모
Expand All @@ -34,5 +33,10 @@ public EnterEventResponse entryEvent(@Auth AuthInfo authinfo, @Valid @RequestBod
return eventService.entryEvent(authinfo.getEmail(), request.getId());
}

// 이벤트 응모 조회
// // TODO(이벤트 응모 조회)
// @GetMapping
// @Operation(summary = "이벤트 응모 정보 조회 (유저)")
// public CheckEventResponse checkEvent(@Auth AuthInfo authInfo, @Valid @RequestBody CheckEventRequest request) {
// return
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import com.kusitms.jipbap.event.exception.AlreadyExistsEventUserException;
import com.kusitms.jipbap.event.exception.EventExhaustException;
import com.kusitms.jipbap.event.exception.EventNotExistsException;
import com.kusitms.jipbap.event.model.dto.EventDto;
import com.kusitms.jipbap.event.model.entity.Event;
import com.kusitms.jipbap.event.model.entity.EventUser;
import com.kusitms.jipbap.event.model.request.RegisterEventRequest;
import com.kusitms.jipbap.event.model.response.EnterEventResponse;
import com.kusitms.jipbap.event.model.response.RegisterEventResponse;
import com.kusitms.jipbap.event.repository.EventRepository;
import com.kusitms.jipbap.event.repository.EventUserRepository;
import com.kusitms.jipbap.user.exception.UserNotFoundException;
Expand All @@ -26,10 +26,10 @@ public class EventService {
private final EventUserRepository eventUserRepository;

@Transactional
public EventDto registerEvent(String email, RegisterEventRequest dto) {
public RegisterEventResponse registerEvent(String email, RegisterEventRequest dto) {
User admin = userRepository.findByEmail(email).orElseThrow(() -> new UserNotFoundException("해당 이메일을 가진 관리자가 없습니다"));
Event savedEvent = eventRepository.save(new Event(admin, dto.getTitle(), dto.getDescription(), dto.getAmount()));
return new EventDto(savedEvent.getId(), savedEvent.getTitle(), savedEvent.getDescription(), savedEvent.getAmount());
return new RegisterEventResponse(savedEvent.getId(), savedEvent.getTitle(), savedEvent.getDescription(), savedEvent.getAmount());
}

@Transactional
Expand Down

0 comments on commit 21c9942

Please sign in to comment.