From c6bbc31188ef4faaf0e516024a08d13b3f3b8a87 Mon Sep 17 00:00:00 2001 From: Giovanni Harting <539@idlegandalf.com> Date: Fri, 22 Oct 2021 21:08:07 +0200 Subject: [PATCH] switched to unix time --- main.go | 8 ++++---- utils/utils.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index eb80bc5..4edf7b3 100644 --- a/main.go +++ b/main.go @@ -181,7 +181,7 @@ func getPlayer(w http.ResponseWriter, r *http.Request) { } if !tPlayer.VacDate.IsZero() { - response.VACDate = &tPlayer.VacDate + response.VACDate = tPlayer.VacDate.Unix() } var tMatches []*ent.Match @@ -247,7 +247,7 @@ func getPlayer(w http.ResponseWriter, r *http.Request) { mResponse := &utils.MatchResponse{ MatchId: iMatch.ID, Map: iMatch.Map, - Date: iMatch.Date, + Date: iMatch.Date.Unix(), Score: [2]int{iMatch.ScoreTeamA, iMatch.ScoreTeamB}, Duration: iMatch.Duration, MatchResult: iMatch.MatchResult, @@ -592,7 +592,7 @@ func getMatch(w http.ResponseWriter, r *http.Request) { MatchId: tMatch.ID, ShareCode: tMatch.ShareCode, Map: tMatch.Map, - Date: tMatch.Date, + Date: tMatch.Date.Unix(), Score: [2]int{tMatch.ScoreTeamA, tMatch.ScoreTeamB}, Duration: tMatch.Duration, MatchResult: tMatch.MatchResult, @@ -664,7 +664,7 @@ func getMatch(w http.ResponseWriter, r *http.Request) { if !iStats.Edges.Players.VacDate.IsZero() { switch s := sResponse.Player.(type) { case utils.PlayerResponse: - s.VACDate = &iStats.Edges.Players.VacDate + s.VACDate = iStats.Edges.Players.VacDate.Unix() } } diff --git a/utils/utils.go b/utils/utils.go index 394a8b7..72ebefa 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -135,7 +135,7 @@ type PlayerResponse struct { Name string `json:"name,omitempty"` Avatar string `json:"avatar,omitempty"` VAC bool `json:"vac"` - VACDate *time.Time `json:"vac_date,omitempty"` + VACDate int64 `json:"vac_date,omitempty"` Tracked bool `json:"tracked"` VanityURL string `json:"vanity_url,omitempty"` MatchStats *MatchStats `json:"match_stats,omitempty"` @@ -151,7 +151,7 @@ type MatchResponse struct { MatchId uint64 `json:"match_id,string"` ShareCode string `json:"share_code,omitempty"` Map string `json:"map"` - Date time.Time `json:"date"` + Date int64 `json:"date"` Score [2]int `json:"score"` Duration int `json:"duration"` MatchResult int `json:"match_result"`