-
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.
Added several unit tests and changed the raid stats calculation slightly
The raid stats are not controlled and are done in the database side instead of being done in the server-side. We re using aggregation pipelines for calculations
- Loading branch information
Daniel Villavicencio
authored and
Daniel Villavicencio
committed
Mar 1, 2024
1 parent
68aad78
commit 5a01924
Showing
6 changed files
with
496 additions
and
78 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
src/main/java/com/danielvm/destiny2bot/controller/InsertUserController.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,38 @@ | ||
package com.danielvm.destiny2bot.controller; | ||
|
||
import com.danielvm.destiny2bot.dto.UserChoiceValue; | ||
import com.danielvm.destiny2bot.dto.destiny.RaidStatistics; | ||
import com.danielvm.destiny2bot.service.RaidStatsService; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import reactor.core.publisher.Flux; | ||
|
||
@RestController | ||
@Slf4j | ||
public class InsertUserController { | ||
|
||
private final RaidStatsService raidStatsService; | ||
|
||
public InsertUserController( | ||
RaidStatsService raidStatsService) { | ||
this.raidStatsService = raidStatsService; | ||
} | ||
|
||
/** | ||
* Inserts a user manually into the Mongo Database | ||
* | ||
* @param userId The userId | ||
* @return the saved entity | ||
*/ | ||
@PostMapping("/user") | ||
public Flux<RaidStatistics> insertNewUser(@RequestParam String membershipId, | ||
@RequestParam Integer membershipType, @RequestParam String userId, | ||
@RequestParam Integer userTag) { | ||
UserChoiceValue parsedValues = new UserChoiceValue(membershipId, membershipType, userId, | ||
userTag, null); | ||
return raidStatsService.calculateRaidStats(parsedValues); | ||
} | ||
|
||
} |
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.