-
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.
Add repository and entity definitions for MongoDB
- Loading branch information
Daniel Villavicencio
authored and
Daniel Villavicencio
committed
Feb 20, 2024
1 parent
63c043c
commit 8e41b55
Showing
10 changed files
with
208 additions
and
32 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
29 changes: 29 additions & 0 deletions
29
src/main/java/com/danielvm/destiny2bot/entity/PGCRDetails.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,29 @@ | ||
package com.danielvm.destiny2bot.entity; | ||
|
||
import java.util.List; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import org.springframework.data.mongodb.core.mapping.Document; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Document | ||
public class PGCRDetails { | ||
|
||
/** | ||
* The ID of the Post Game Carnage Report | ||
*/ | ||
private Long instanceId; | ||
|
||
/** | ||
* If the raid was started from the beginning | ||
*/ | ||
private Boolean fromBeginning; | ||
|
||
/** | ||
* List of players and some relevant information | ||
*/ | ||
private List<PlayerEntry> players; | ||
} |
41 changes: 41 additions & 0 deletions
41
src/main/java/com/danielvm/destiny2bot/entity/PlayerEntry.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,41 @@ | ||
package com.danielvm.destiny2bot.entity; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class PlayerEntry { | ||
|
||
/** | ||
* The name of the player participant | ||
*/ | ||
private String playerName; | ||
|
||
/** | ||
* The icon of the player at the time | ||
*/ | ||
private String playerIcon; | ||
|
||
/** | ||
* The player membership type | ||
*/ | ||
private Integer membershipType; | ||
|
||
/** | ||
* The player membership ID | ||
*/ | ||
private Long membershipId; | ||
|
||
/** | ||
* Total amount of deaths | ||
*/ | ||
private Integer deaths; | ||
|
||
/** | ||
* Total amount of kills | ||
*/ | ||
private Integer kills; | ||
} |
42 changes: 26 additions & 16 deletions
42
src/main/java/com/danielvm/destiny2bot/entity/UserDetails.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,29 +1,39 @@ | ||
package com.danielvm.destiny2bot.entity; | ||
|
||
import java.io.Serial; | ||
import java.io.Serializable; | ||
import java.time.Instant; | ||
import java.time.LocalDateTime; | ||
import java.util.Collection; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import org.springframework.data.annotation.Id; | ||
import org.springframework.data.mongodb.core.mapping.Document; | ||
|
||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Document(collection = "user_details") | ||
public class UserDetails implements Serializable { | ||
|
||
@Serial | ||
private static final long serialVersionUID = 6161559188488304844L; | ||
|
||
private String discordId; | ||
|
||
private String discordUsername; | ||
|
||
private String accessToken; | ||
|
||
private String refreshToken; | ||
|
||
private Instant expiration; | ||
/** | ||
* The user identifier for a user which is a combination of their global username and their global | ||
* tag, e.g., Deaht#8080 | ||
*/ | ||
@Id | ||
private String userIdentifier; | ||
|
||
/** | ||
* Whether this user has a clan or not it will be saved in this field | ||
*/ | ||
private String destinyClanName; | ||
|
||
/** | ||
* The last time this user was requested | ||
*/ | ||
private LocalDateTime lastRequestDateTime; | ||
|
||
/** | ||
* Collection of user raid data | ||
*/ | ||
private Collection<UserRaidDetails> userRaidDetails; | ||
} |
65 changes: 65 additions & 0 deletions
65
src/main/java/com/danielvm/destiny2bot/entity/UserRaidDetails.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,65 @@ | ||
package com.danielvm.destiny2bot.entity; | ||
|
||
import com.danielvm.destiny2bot.enums.RaidDifficulty; | ||
import java.io.Serializable; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class UserRaidDetails implements Serializable { | ||
|
||
/** | ||
* The name of the raid | ||
*/ | ||
private String raidName; | ||
|
||
/** | ||
* The difficulty of the raid, e.g., NORMAL or MASTER | ||
*/ | ||
private RaidDifficulty raidDifficulty; | ||
|
||
/** | ||
* The size of the fireteam that completed the raid | ||
*/ | ||
private Integer completionFireteamSize; | ||
|
||
/** | ||
* Whether the user completed this raid or not | ||
*/ | ||
private Boolean isCompleted; | ||
|
||
/** | ||
* Total number of kills in the raid | ||
*/ | ||
private Integer totalKills; | ||
|
||
/** | ||
* Total number of deaths in the raid | ||
*/ | ||
private Integer totalDeaths; | ||
|
||
/** | ||
* The KDA of the player in the raid | ||
*/ | ||
private Double kda; | ||
|
||
/** | ||
* Duration of the raid in seconds | ||
*/ | ||
private Integer durationSeconds; | ||
|
||
/** | ||
* If the raid was started from the beginning | ||
*/ | ||
private Boolean fromBeginning; | ||
|
||
/** | ||
* The related PGCR ID that relates to this specific instance of the raid. This field is more for | ||
* reference purposes, so we can always reference back to the PGCR in case we need more | ||
* information. | ||
*/ | ||
private Long instanceId; | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/com/danielvm/destiny2bot/enums/RaidDifficulty.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,7 @@ | ||
package com.danielvm.destiny2bot.enums; | ||
|
||
public enum RaidDifficulty { | ||
|
||
NORMAL, | ||
MASTER | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/danielvm/destiny2bot/repository/PGCRRepository.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 com.danielvm.destiny2bot.repository; | ||
|
||
import com.danielvm.destiny2bot.entity.PGCRDetails; | ||
import org.springframework.data.mongodb.repository.ReactiveMongoRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface PGCRRepository extends ReactiveMongoRepository<PGCRDetails, Long> { | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/danielvm/destiny2bot/repository/UserDetailsRepository.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 com.danielvm.destiny2bot.repository; | ||
|
||
import com.danielvm.destiny2bot.entity.UserDetails; | ||
import org.springframework.data.mongodb.repository.ReactiveMongoRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface UserDetailsRepository extends ReactiveMongoRepository<UserDetails, String> { | ||
|
||
} |
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