added spray patterns

This commit is contained in:
2021-10-31 08:40:02 +01:00
parent 268793f0e5
commit 978232dd0a
66 changed files with 16805 additions and 11903 deletions

View File

@@ -33,7 +33,7 @@ func (Match) Fields() []ent.Field {
// Edges of the Match.
func (Match) Edges() []ent.Edge {
return []ent.Edge{
edge.To("stats", Stats.Type),
edge.To("stats", MatchPlayer.Type),
edge.From("players", Player.Type).Ref("matches"),
}
}

View File

@@ -6,13 +6,13 @@ import (
"entgo.io/ent/schema/field"
)
// Stats holds the schema definition for the Stats entity.
type Stats struct {
// MatchPlayer holds the schema definition for the MatchPlayer entity.
type MatchPlayer struct {
ent.Schema
}
// Fields of the Stats.
func (Stats) Fields() []ent.Field {
func (MatchPlayer) Fields() []ent.Field {
return []ent.Field{
field.Int("team_id"),
field.Int("kills"),
@@ -45,15 +45,17 @@ func (Stats) Fields() []ent.Field {
field.Uint("flash_total_enemy").Optional(),
field.Uint64("match_stats").Optional(),
field.Uint64("player_stats").Optional(),
field.Int("flash_assists").Optional(),
}
}
// Edges of the Stats.
func (Stats) Edges() []ent.Edge {
// Edges of the MatchPlayer.
func (MatchPlayer) Edges() []ent.Edge {
return []ent.Edge{
edge.From("matches", Match.Type).Ref("stats").Unique().Field("match_stats"),
edge.From("players", Player.Type).Ref("stats").Unique().Field("player_stats"),
edge.To("weapon_stats", WeaponStats.Type),
edge.To("weapon_stats", Weapon.Type),
edge.To("round_stats", RoundStats.Type),
edge.To("spray", Spray.Type),
}
}

View File

@@ -31,13 +31,16 @@ func (Player) Fields() []ent.Field {
field.String("auth_code").Optional().Sensitive(),
field.Time("profile_created").Optional(),
field.String("oldest_sharecode_seen").Optional(),
field.Int("wins").Optional(),
field.Int("looses").Optional(),
field.Int("ties").Optional(),
}
}
// Edges of the Player.
func (Player) Edges() []ent.Edge {
return []ent.Edge{
edge.To("stats", Stats.Type),
edge.To("stats", MatchPlayer.Type),
edge.To("matches", Match.Type),
}
}

View File

@@ -24,6 +24,6 @@ func (RoundStats) Fields() []ent.Field {
// Edges of the RoundStats.
func (RoundStats) Edges() []ent.Edge {
return []ent.Edge{
edge.From("stat", Stats.Type).Ref("round_stats").Unique(),
edge.From("match_player", MatchPlayer.Type).Ref("round_stats").Unique(),
}
}

27
ent/schema/spray.go Normal file
View File

@@ -0,0 +1,27 @@
package schema
import (
"entgo.io/ent"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
)
// Spray holds the schema definition for the Spray entity.
type Spray struct {
ent.Schema
}
// Fields of the Spray.
func (Spray) Fields() []ent.Field {
return []ent.Field{
field.Int("weapon"),
field.Bytes("spray"),
}
}
// Edges of the Spray.
func (Spray) Edges() []ent.Edge {
return []ent.Edge{
edge.From("match_players", MatchPlayer.Type).Ref("spray").Unique(),
}
}

29
ent/schema/weapon.go Normal file
View File

@@ -0,0 +1,29 @@
package schema
import (
"entgo.io/ent"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
)
// Weapon holds the schema definition for the Weapon entity.
type Weapon struct {
ent.Schema
}
// Fields of the Weapon.
func (Weapon) Fields() []ent.Field {
return []ent.Field{
field.Uint64("victim"),
field.Uint("dmg"),
field.Int("eq_type"),
field.Int("hit_group"),
}
}
// Edges of the Weapon.
func (Weapon) Edges() []ent.Edge {
return []ent.Edge{
edge.From("stat", MatchPlayer.Type).Ref("weapon_stats").Unique(),
}
}

View File

@@ -1,29 +0,0 @@
package schema
import (
"entgo.io/ent"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
)
// WeaponStats holds the schema definition for the WeaponStats entity.
type WeaponStats struct {
ent.Schema
}
// Fields of the WeaponStats.
func (WeaponStats) Fields() []ent.Field {
return []ent.Field{
field.Uint64("victim"),
field.Uint("dmg"),
field.Int("eq_type"),
field.Int("hit_group"),
}
}
// Edges of the WeaponStats.
func (WeaponStats) Edges() []ent.Edge {
return []ent.Edge{
edge.From("stat", Stats.Type).Ref("weapon_stats").Unique(),
}
}