-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
478 additions
and
18 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
28 changes: 28 additions & 0 deletions
28
src/main/java/com/universe/uni/controller/ShortGameController.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,28 @@ | ||
package com.universe.uni.controller; | ||
|
||
import javax.validation.Valid; | ||
|
||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import com.universe.uni.dto.request.CreateShortGameRequestDto; | ||
import com.universe.uni.dto.response.CreateShortGameResponseDto; | ||
import com.universe.uni.service.GameService; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/game/short") | ||
public class ShortGameController { | ||
|
||
private final GameService gameService; | ||
|
||
@PostMapping | ||
public CreateShortGameResponseDto createShortGame(@RequestBody @Valid final CreateShortGameRequestDto createShortGameRequestDto) { | ||
return gameService.createShortGame(createShortGameRequestDto); | ||
} | ||
|
||
} |
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
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
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
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
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
15 changes: 15 additions & 0 deletions
15
src/main/java/com/universe/uni/dto/request/CreateShortGameRequestDto.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,15 @@ | ||
package com.universe.uni.dto.request; | ||
|
||
import javax.validation.constraints.NotNull; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public class CreateShortGameRequestDto { | ||
|
||
@NotNull | ||
private Long missionCategoryId; | ||
|
||
@NotNull | ||
private String wishContent; | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/com/universe/uni/dto/response/CreateShortGameResponseDto.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,18 @@ | ||
package com.universe.uni.dto.response; | ||
|
||
import com.universe.uni.domain.entity.RoundMission; | ||
import com.universe.uni.domain.entity.ShortGame; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public class CreateShortGameResponseDto { | ||
private ShortGameDto shortGame; | ||
private RoundMissionDto roundMission; | ||
|
||
public static CreateShortGameResponseDto of(ShortGame shortGame, RoundMission roundMission) { | ||
return new CreateShortGameResponseDto(new ShortGameDto(shortGame), new RoundMissionDto(roundMission)); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/com/universe/uni/dto/response/RoundMissionDto.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,26 @@ | ||
package com.universe.uni.dto.response; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
import com.universe.uni.domain.GameResult; | ||
import com.universe.uni.domain.entity.MissionContent; | ||
import com.universe.uni.domain.entity.RoundMission; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public class RoundMissionDto { | ||
private long roundMissionId; | ||
private MissionContent missionContent; | ||
private GameResult result; | ||
private GameResult finalResult; | ||
private LocalDateTime updatedAt; | ||
|
||
public RoundMissionDto(RoundMission roundMission){ | ||
this.roundMissionId = roundMission.getId(); | ||
this.missionContent = roundMission.getMissionContent(); | ||
this.result = roundMission.getResult(); | ||
this.finalResult = roundMission.getFinalResult(); | ||
this.updatedAt = roundMission.getUpdatedAt(); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/com/universe/uni/dto/response/ShortGameDto.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,21 @@ | ||
package com.universe.uni.dto.response; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
import com.universe.uni.domain.entity.ShortGame; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public class ShortGameDto { | ||
private Long id; | ||
private Boolean enable; | ||
private LocalDateTime finishAt; | ||
|
||
public ShortGameDto(ShortGame shortGame) { | ||
this.id = shortGame.getId(); | ||
this.enable = shortGame.getEnable(); | ||
this.finishAt = shortGame.getFinishAt(); | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/com/universe/uni/dto/response/WishCouponResponseDto.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,20 @@ | ||
package com.universe.uni.dto.response; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonPropertyOrder; | ||
|
||
import lombok.Builder; | ||
|
||
@JsonPropertyOrder({"id", "isMine", "image", "content", "isVisible", "isUsed", "usedAt", "gameType"}) | ||
@Builder | ||
public record WishCouponResponseDto( | ||
Long id, | ||
boolean isMine, | ||
String image, | ||
String content, | ||
@JsonProperty("isVisible") boolean visible, | ||
@JsonProperty("isUsed") boolean used, | ||
String usedAt, | ||
String gameType | ||
) { | ||
} |
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
11 changes: 11 additions & 0 deletions
11
src/main/java/com/universe/uni/repository/GameRepository.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,11 @@ | ||
package com.universe.uni.repository; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import com.universe.uni.domain.entity.Couple; | ||
import com.universe.uni.domain.entity.Game; | ||
|
||
public interface GameRepository extends JpaRepository<Game, Long> { | ||
|
||
boolean existsByCoupleAndEnable(Couple couple, boolean enable); | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/com/universe/uni/repository/MissionCategoryRepository.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,8 @@ | ||
package com.universe.uni.repository; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import com.universe.uni.domain.entity.MissionCategory; | ||
|
||
public interface MissionCategoryRepository extends JpaRepository<MissionCategory, Long> { | ||
} |
Oops, something went wrong.