-
Notifications
You must be signed in to change notification settings - Fork 1
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
21 changed files
with
285 additions
and
5 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
75 changes: 75 additions & 0 deletions
75
app/api/user-api/src/main/java/org/example/controller/UserShowController.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,75 @@ | ||
package org.example.controller; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import java.time.LocalDateTime; | ||
import lombok.RequiredArgsConstructor; | ||
import org.example.controller.dto.response.NumberOfInterestShowApiResponse; | ||
import org.example.controller.dto.response.NumberOfSubscribedArtistApiResponse; | ||
import org.example.controller.dto.response.NumberOfSubscribedGenreApiResponse; | ||
import org.example.controller.dto.response.NumberOfTicketingAlertApiResponse; | ||
import org.example.security.dto.AuthenticatedUser; | ||
import org.example.service.UserShowService; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.core.annotation.AuthenticationPrincipal; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/v1/users") | ||
@Tag(name = "유저 공연") | ||
public class UserShowController { | ||
|
||
private final UserShowService userShowService; | ||
|
||
@GetMapping("/shows/alerts/count") | ||
@Operation(summary = "알림 설정한 공연 개수") | ||
public ResponseEntity<NumberOfTicketingAlertApiResponse> getNumberOfAlertShow( | ||
@AuthenticationPrincipal AuthenticatedUser user | ||
) { | ||
LocalDateTime now = LocalDateTime.now(); | ||
return ResponseEntity.ok( | ||
NumberOfTicketingAlertApiResponse.from( | ||
userShowService.countAlertShows(user.userId(), now) | ||
) | ||
); | ||
} | ||
|
||
@GetMapping("/artists/subscriptions/count") | ||
@Operation(summary = "구독한 아티스트 수") | ||
public ResponseEntity<NumberOfSubscribedArtistApiResponse> getNumberOfSubscribedArtist( | ||
@AuthenticationPrincipal AuthenticatedUser user | ||
) { | ||
return ResponseEntity.ok( | ||
NumberOfSubscribedArtistApiResponse.from( | ||
userShowService.countSubscribedArtists(user.userId()) | ||
) | ||
); | ||
} | ||
|
||
@GetMapping("/genres/subscriptions/count") | ||
@Operation(summary = "구독한 장르 수") | ||
public ResponseEntity<NumberOfSubscribedGenreApiResponse> getNumberOfSubscribedGenre( | ||
@AuthenticationPrincipal AuthenticatedUser user | ||
) { | ||
return ResponseEntity.ok( | ||
NumberOfSubscribedGenreApiResponse.from( | ||
userShowService.countSubscribedGenres(user.userId()) | ||
) | ||
); | ||
} | ||
|
||
@GetMapping("/shows/interests/count") | ||
@Operation(summary = "관심 공연 개수") | ||
public ResponseEntity<NumberOfInterestShowApiResponse> getNumberOfInterestShow( | ||
@AuthenticationPrincipal AuthenticatedUser user | ||
) { | ||
return ResponseEntity.ok( | ||
NumberOfInterestShowApiResponse.from( | ||
userShowService.countInterestShows(user.userId()) | ||
) | ||
); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...pi/src/main/java/org/example/controller/dto/response/NumberOfInterestShowApiResponse.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,12 @@ | ||
package org.example.controller.dto.response; | ||
|
||
import org.example.service.dto.response.NumberOfInterestShowServiceResponse; | ||
|
||
public record NumberOfInterestShowApiResponse( | ||
long count | ||
) { | ||
|
||
public static NumberOfInterestShowApiResponse from(NumberOfInterestShowServiceResponse response) { | ||
return new NumberOfInterestShowApiResponse(response.count()); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...rc/main/java/org/example/controller/dto/response/NumberOfSubscribedArtistApiResponse.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,12 @@ | ||
package org.example.controller.dto.response; | ||
|
||
import org.example.service.dto.response.NumberOfSubscribedArtistServiceResponse; | ||
|
||
public record NumberOfSubscribedArtistApiResponse( | ||
long count | ||
) { | ||
|
||
public static NumberOfSubscribedArtistApiResponse from(NumberOfSubscribedArtistServiceResponse response) { | ||
return new NumberOfSubscribedArtistApiResponse(response.count()); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...src/main/java/org/example/controller/dto/response/NumberOfSubscribedGenreApiResponse.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,12 @@ | ||
package org.example.controller.dto.response; | ||
|
||
import org.example.service.dto.response.NumberOfSubscribedGenreServiceResponse; | ||
|
||
public record NumberOfSubscribedGenreApiResponse( | ||
long count | ||
) { | ||
|
||
public static NumberOfSubscribedGenreApiResponse from(NumberOfSubscribedGenreServiceResponse response) { | ||
return new NumberOfSubscribedGenreApiResponse(response.count()); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
.../src/main/java/org/example/controller/dto/response/NumberOfTicketingAlertApiResponse.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,12 @@ | ||
package org.example.controller.dto.response; | ||
|
||
import org.example.service.dto.response.NumberOfTicketingAlertServiceResponse; | ||
|
||
public record NumberOfTicketingAlertApiResponse( | ||
long count | ||
) { | ||
|
||
public static NumberOfTicketingAlertApiResponse from(NumberOfTicketingAlertServiceResponse response) { | ||
return new NumberOfTicketingAlertApiResponse(response.count()); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
app/api/user-api/src/main/java/org/example/service/UserShowService.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,42 @@ | ||
package org.example.service; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.UUID; | ||
import lombok.RequiredArgsConstructor; | ||
import org.example.service.dto.response.NumberOfInterestShowServiceResponse; | ||
import org.example.service.dto.response.NumberOfSubscribedArtistServiceResponse; | ||
import org.example.service.dto.response.NumberOfSubscribedGenreServiceResponse; | ||
import org.example.service.dto.response.NumberOfTicketingAlertServiceResponse; | ||
import org.example.usecase.UserShowUseCase; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class UserShowService { | ||
|
||
private final UserShowUseCase userShowUseCase; | ||
|
||
public NumberOfTicketingAlertServiceResponse countAlertShows(UUID userId, LocalDateTime now) { | ||
long numberOfTicketingAlert = userShowUseCase.countAlertShows(userId, now); | ||
|
||
return NumberOfTicketingAlertServiceResponse.from(numberOfTicketingAlert); | ||
} | ||
|
||
public NumberOfSubscribedArtistServiceResponse countSubscribedArtists(UUID userId) { | ||
return NumberOfSubscribedArtistServiceResponse.from( | ||
userShowUseCase.countSubscribedArtists(userId) | ||
); | ||
} | ||
|
||
public NumberOfSubscribedGenreServiceResponse countSubscribedGenres(UUID uuid) { | ||
return NumberOfSubscribedGenreServiceResponse.from( | ||
userShowUseCase.countSubscribedGenres(uuid) | ||
); | ||
} | ||
|
||
public NumberOfInterestShowServiceResponse countInterestShows(UUID uuid) { | ||
return NumberOfInterestShowServiceResponse.from( | ||
userShowUseCase.countInterestShows(uuid) | ||
); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...i/src/main/java/org/example/service/dto/response/NumberOfInterestShowServiceResponse.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,10 @@ | ||
package org.example.service.dto.response; | ||
|
||
public record NumberOfInterestShowServiceResponse( | ||
long count | ||
) { | ||
|
||
public static NumberOfInterestShowServiceResponse from(long count) { | ||
return new NumberOfInterestShowServiceResponse(count); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...c/main/java/org/example/service/dto/response/NumberOfSubscribedArtistServiceResponse.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,10 @@ | ||
package org.example.service.dto.response; | ||
|
||
public record NumberOfSubscribedArtistServiceResponse( | ||
long count | ||
) { | ||
|
||
public static NumberOfSubscribedArtistServiceResponse from(long count) { | ||
return new NumberOfSubscribedArtistServiceResponse(count); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...rc/main/java/org/example/service/dto/response/NumberOfSubscribedGenreServiceResponse.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,10 @@ | ||
package org.example.service.dto.response; | ||
|
||
public record NumberOfSubscribedGenreServiceResponse( | ||
long count | ||
) { | ||
|
||
public static NumberOfSubscribedGenreServiceResponse from(long count) { | ||
return new NumberOfSubscribedGenreServiceResponse(count); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...src/main/java/org/example/service/dto/response/NumberOfTicketingAlertServiceResponse.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,10 @@ | ||
package org.example.service.dto.response; | ||
|
||
public record NumberOfTicketingAlertServiceResponse( | ||
long count | ||
) { | ||
|
||
public static NumberOfTicketingAlertServiceResponse from(long count) { | ||
return new NumberOfTicketingAlertServiceResponse(count); | ||
} | ||
} |
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
4 changes: 4 additions & 0 deletions
4
...-domain/src/main/java/org/example/repository/interest/InterestShowQuerydslRepository.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 |
---|---|---|
@@ -1,9 +1,13 @@ | ||
package org.example.repository.interest; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.UUID; | ||
import org.example.dto.request.InterestShowPaginationDomainRequest; | ||
import org.example.dto.response.InterestShowPaginationDomainResponse; | ||
|
||
public interface InterestShowQuerydslRepository { | ||
|
||
InterestShowPaginationDomainResponse findInterestShowList(InterestShowPaginationDomainRequest request); | ||
|
||
long countValidTicketingAlerts(UUID userId, LocalDateTime now); | ||
} |
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
Oops, something went wrong.