-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat] 모임 개설 API 구현
- Loading branch information
Showing
7 changed files
with
85 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
|
||
@Getter | ||
public class ImageInfo { | ||
|
||
private String imageUrl1; | ||
|
||
private String imageUrl2; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
22 changes: 22 additions & 0 deletions
22
src/main/java/com/pickple/server/api/moim/dto/request/MoimCreateRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.pickple.server.api.moim.dto.request; | ||
|
||
import com.pickple.server.api.moim.domain.CategoryInfo; | ||
import com.pickple.server.api.moim.domain.DateInfo; | ||
import com.pickple.server.api.moim.domain.ImageInfo; | ||
import com.pickple.server.api.moim.domain.QuestionInfo; | ||
import com.pickple.server.api.moimsubmission.domain.AccountInfo; | ||
|
||
public record MoimCreateRequest( | ||
CategoryInfo categoryList, | ||
boolean isOffline, | ||
String spot, | ||
DateInfo dateList, | ||
int maxGuest, | ||
int fee, | ||
AccountInfo accountList, | ||
QuestionInfo questionList, | ||
String title, | ||
String description, | ||
ImageInfo imageList | ||
) { | ||
} |
40 changes: 40 additions & 0 deletions
40
src/main/java/com/pickple/server/api/moim/service/MoimCommandService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.pickple.server.api.moim.service; | ||
|
||
import com.pickple.server.api.host.domain.Host; | ||
import com.pickple.server.api.host.repository.HostRepository; | ||
import com.pickple.server.api.moim.domain.Moim; | ||
import com.pickple.server.api.moim.domain.enums.MoimState; | ||
import com.pickple.server.api.moim.dto.request.MoimCreateRequest; | ||
import com.pickple.server.api.moim.repository.MoimRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
@Transactional | ||
public class MoimCommandService { | ||
|
||
private final HostRepository hostRepository; | ||
private final MoimRepository moimRepository; | ||
|
||
public void createMoim(Long hostId, MoimCreateRequest request) { | ||
Host host = hostRepository.findHostByIdOrThrow(hostId); | ||
Moim moim = Moim.builder() | ||
.host(host) | ||
.category(request.categoryList()) | ||
.isOffline(request.isOffline()) | ||
.spot(request.spot()) | ||
.dateList(request.dateList()) | ||
.maxGuest(request.maxGuest()) | ||
.fee(request.fee()) | ||
.accountList(request.accountList()) | ||
.questionList(request.questionList()) | ||
.title(request.title()) | ||
.description(request.description()) | ||
.imageList(request.imageList()) | ||
.moimState(MoimState.ONGOING) | ||
.build(); | ||
moimRepository.save(moim); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters