From 802442edbacf260c8df47fcfb39630dea3e45574 Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Fri, 28 Oct 2022 15:27:13 +0300 Subject: [PATCH 1/3] fix export in Session struct --- sessionUtils/sessionTypes.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sessionUtils/sessionTypes.go b/sessionUtils/sessionTypes.go index 1305176..4c8fa8d 100644 --- a/sessionUtils/sessionTypes.go +++ b/sessionUtils/sessionTypes.go @@ -5,8 +5,8 @@ import ( ) type Session struct { - expirateAt time.Time - gameId string + ExpirateAt time.Time + GameId string } type JSSessionInterface struct { From 073c0b8e90ed196d0cf452423496877b913dd182 Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Fri, 28 Oct 2022 15:27:34 +0300 Subject: [PATCH 2/3] refactor session utils and add Json convertor --- sessionUtils/session.go | 5 ----- sessionUtils/sessionUtils.go | 13 +++++++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) delete mode 100644 sessionUtils/session.go create mode 100644 sessionUtils/sessionUtils.go diff --git a/sessionUtils/session.go b/sessionUtils/session.go deleted file mode 100644 index 65df353..0000000 --- a/sessionUtils/session.go +++ /dev/null @@ -1,5 +0,0 @@ -package sessionUtils - -func GetJSSessionInterface(s Session) JSSessionInterface { - return JSSessionInterface{} -} diff --git a/sessionUtils/sessionUtils.go b/sessionUtils/sessionUtils.go new file mode 100644 index 0000000..5d62800 --- /dev/null +++ b/sessionUtils/sessionUtils.go @@ -0,0 +1,13 @@ +package sessionUtils + +import "encoding/json" + +func ConvertServerSessionsToJSON(s Session) []byte { + s_json, err := json.Marshal(s) + _ = err //TODO: Check Errors + return s_json +} + +func GetJSSessionInterface(s Session) JSSessionInterface { + return JSSessionInterface{} +} From 6f3f3e1d8f2e5da187a7c27136a782fec0669954 Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Fri, 28 Oct 2022 15:27:57 +0300 Subject: [PATCH 3/3] add json method to gameUtils --- gameUtils/gameUtils.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gameUtils/gameUtils.go b/gameUtils/gameUtils.go index b92cda2..d3be5bb 100644 --- a/gameUtils/gameUtils.go +++ b/gameUtils/gameUtils.go @@ -1,5 +1,9 @@ package gameUtils +import ( + "encoding/json" +) + func FindGameByID(id string, list Games) SteamGame { for _, game := range list.SteamGames { if game.GameId == id { @@ -29,3 +33,9 @@ func GetJSGameInterface(game SteamGame) JSGameInterface { } return newInterface } + +func ConvertServerGamesToJSON(g Games) []byte { + g_json, err := json.Marshal(g) + _ = err //TODO: Check Errors + return g_json +}