Skip to content

Commit

Permalink
fix: tests by enabling esxcompat by default for them
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Trost <[email protected]>
  • Loading branch information
galexrt committed Jan 9, 2025
1 parent 0fd794b commit 169c0d7
Show file tree
Hide file tree
Showing 15 changed files with 408 additions and 302 deletions.
4 changes: 4 additions & 0 deletions gen/go/proto/services/auth/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/fivenet-app/fivenet/internal/tests/servers"
grpcserver "github.com/fivenet-app/fivenet/pkg/grpc"
"github.com/fivenet-app/fivenet/pkg/perms"
"github.com/fivenet-app/fivenet/pkg/utils/dbutils/tables"
_ "github.com/go-sql-driver/mysql"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand All @@ -36,6 +37,9 @@ func TestMain(m *testing.M) {
}
defer servers.TestNATSServer.Stop()

// All tests assume esx compat mode
tables.EnableESXCompat()

code := m.Run()

os.Exit(code)
Expand Down
4 changes: 4 additions & 0 deletions gen/go/proto/services/centrum/centrum_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/fivenet-app/fivenet/internal/tests/servers"
grpcserver "github.com/fivenet-app/fivenet/pkg/grpc"
"github.com/fivenet-app/fivenet/pkg/tracker"
"github.com/fivenet-app/fivenet/pkg/utils/dbutils/tables"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/fx"
Expand All @@ -32,6 +33,9 @@ func TestMain(m *testing.M) {
}
defer servers.TestNATSServer.Stop()

// All tests assume esx compat mode
tables.EnableESXCompat()

code := m.Run()

os.Exit(code)
Expand Down
59 changes: 51 additions & 8 deletions gen/go/proto/services/sync/data.go
Original file line number Diff line number Diff line change
@@ -1,26 +1,69 @@
package sync

import "context"
import (
"context"

"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)

var ErrSendDataDisabled = status.Error(codes.FailedPrecondition, "Sync API: SendData is disabled due to ESXCompat being enabled")

func (s *Server) SendData(ctx context.Context, req *SendDataRequest) (*SendDataResponse, error) {
resp := &SendDataResponse{
AffectedRows: 0,
}

switch d := req.Data.(type) {
case *SendDataRequest_Users:
_ = d
// TODO
if s.esxCompat {
return nil, ErrSendDataDisabled
}

var err error
switch d := req.Data.(type) {
case *SendDataRequest_Jobs:
// TODO
if resp.AffectedRows, err = s.handleJobsData(ctx, d); err != nil {
return nil, err
}

case *SendDataRequest_Licenses:
// TODO
if resp.AffectedRows, err = s.handleLicensesData(ctx, d); err != nil {
return nil, err
}

case *SendDataRequest_Users:
if resp.AffectedRows, err = s.handleUsersData(ctx, d); err != nil {
return nil, err
}

case *SendDataRequest_Vehicles:
// TODO
if resp.AffectedRows, err = s.handleVehiclesData(ctx, d); err != nil {
return nil, err
}
}

return resp, nil
}

func (s *Server) handleJobsData(ctx context.Context, data *SendDataRequest_Jobs) (int64, error) {
// TODO

return 0, nil
}

func (s *Server) handleLicensesData(ctx context.Context, data *SendDataRequest_Licenses) (int64, error) {
// TODO

return 0, nil
}

func (s *Server) handleUsersData(ctx context.Context, data *SendDataRequest_Users) (int64, error) {
// TODO

return 0, nil
}

func (s *Server) handleVehiclesData(ctx context.Context, data *SendDataRequest_Vehicles) (int64, error) {
// TODO

return 0, nil
}
6 changes: 4 additions & 2 deletions gen/go/proto/services/sync/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ type Server struct {
db *sql.DB
auth *auth.GRPCAuth

tokens []string
esxCompat bool
tokens []string
}

type Params struct {
Expand All @@ -42,7 +43,8 @@ func NewServer(p Params) *Server {
db: p.DB,
auth: p.Auth,

tokens: p.Config.Sync.APITokens,
esxCompat: p.Config.Database.ESXCompat,
tokens: p.Config.Sync.APITokens,
}
}

Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/Masterminds/sprig/v3 v3.3.0
github.com/XSAM/otelsql v0.36.0
github.com/adhocore/gronx v1.19.5
github.com/alecthomas/kong v1.6.0
github.com/alecthomas/kong v1.6.1
github.com/aymanbagabas/go-udiff v0.2.0
github.com/bep/debounce v1.2.1
github.com/blevesearch/bleve/v2 v2.4.4
Expand Down Expand Up @@ -66,11 +66,11 @@ require (
golang.org/x/crypto v0.32.0
golang.org/x/exp v0.0.0-20250103183323-7d7fa50e5329
golang.org/x/image v0.23.0
golang.org/x/net v0.33.0
golang.org/x/net v0.34.0
golang.org/x/oauth2 v0.25.0
golang.org/x/text v0.21.0
google.golang.org/grpc v1.69.2
google.golang.org/protobuf v1.36.1
google.golang.org/protobuf v1.36.2
gopkg.in/yaml.v3 v3.0.1
gotest.tools/v3 v3.5.1
willnorris.com/go/imageproxy v0.11.2
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ github.com/adhocore/gronx v1.19.5/go.mod h1:7oUY1WAU8rEJWmAxXR2DN0JaO4gi9khSgKji
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8vS6K3D0=
github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
github.com/alecthomas/kong v1.6.0 h1:mwOzbdMR7uv2vul9J0FU3GYxE7ls/iX1ieMg5WIM6gE=
github.com/alecthomas/kong v1.6.0/go.mod h1:p2vqieVMeTAnaC83txKtXe8FLke2X07aruPWXyMPQrU=
github.com/alecthomas/kong v1.6.1 h1:/7bVimARU3uxPD0hbryPE8qWrS3Oz3kPQoxA/H2NKG8=
github.com/alecthomas/kong v1.6.1/go.mod h1:p2vqieVMeTAnaC83txKtXe8FLke2X07aruPWXyMPQrU=
github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc=
github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
Expand Down Expand Up @@ -1068,8 +1068,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -1412,8 +1412,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.36.1 h1:yBPeRvTftaleIgM3PZ/WBIZ7XM/eEYAaEyCwvyjq/gk=
google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
google.golang.org/protobuf v1.36.2 h1:R8FeyR1/eLmkutZOM5CWghmo5itiG9z0ktFlTVLuTmU=
google.golang.org/protobuf v1.36.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
6 changes: 6 additions & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,8 @@ github.com/PuerkitoBio/goquery v1.10.0/go.mod h1:TjZZl68Q3eGHNBA8CWaxAN7rOU1EbDz
github.com/Shopify/goreferrer v0.0.0-20220729165902-8cddb4f5de06/go.mod h1:7erjKLwalezA0k99cWs5L11HWOAPNjdUZ6RxH1BXbbM=
github.com/alecthomas/kingpin/v2 v2.3.2/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE=
github.com/alecthomas/kingpin/v2 v2.4.0/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE=
github.com/alecthomas/kong v1.6.1 h1:/7bVimARU3uxPD0hbryPE8qWrS3Oz3kPQoxA/H2NKG8=
github.com/alecthomas/kong v1.6.1/go.mod h1:p2vqieVMeTAnaC83txKtXe8FLke2X07aruPWXyMPQrU=
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE=
github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
Expand Down Expand Up @@ -1240,6 +1242,8 @@ golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
Expand Down Expand Up @@ -1526,6 +1530,8 @@ google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw
google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
google.golang.org/protobuf v1.36.2 h1:R8FeyR1/eLmkutZOM5CWghmo5itiG9z0ktFlTVLuTmU=
google.golang.org/protobuf v1.36.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/guregu/null.v4 v4.0.0/go.mod h1:YoQhUrADuG3i9WqesrCmpNRwm1ypAgSHYqoOcTu/JrI=
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/protoc-gen-customizer/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.23.4

require (
github.com/lyft/protoc-gen-star/v2 v2.0.4-0.20230330145011-496ad1ac90a4
google.golang.org/protobuf v1.36.1
google.golang.org/protobuf v1.36.2
)

require (
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/protoc-gen-customizer/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8=
golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw=
google.golang.org/protobuf v1.36.1 h1:yBPeRvTftaleIgM3PZ/WBIZ7XM/eEYAaEyCwvyjq/gk=
google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
google.golang.org/protobuf v1.36.2 h1:R8FeyR1/eLmkutZOM5CWghmo5itiG9z0ktFlTVLuTmU=
google.golang.org/protobuf v1.36.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
2 changes: 1 addition & 1 deletion internal/cmd/protoc-gen-fronthelper/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.23.4

require (
github.com/lyft/protoc-gen-star/v2 v2.0.4-0.20230330145011-496ad1ac90a4
google.golang.org/protobuf v1.36.1
google.golang.org/protobuf v1.36.2
)

require (
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/protoc-gen-fronthelper/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8=
golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw=
google.golang.org/protobuf v1.36.0 h1:mjIs9gYtt56AzC4ZaffQuh88TZurBGhIJMBZGSxNerQ=
google.golang.org/protobuf v1.36.0/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
google.golang.org/protobuf v1.36.2 h1:R8FeyR1/eLmkutZOM5CWghmo5itiG9z0ktFlTVLuTmU=
google.golang.org/protobuf v1.36.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"@total-typescript/ts-reset": "0.6.1",
"@types/google-protobuf": "3.15.12",
"@types/howler": "2.2.12",
"@types/leaflet": "1.9.15",
"@types/leaflet": "1.9.16",
"@types/leaflet-contextmenu": "1.4.3",
"@types/node": "22.10.5",
"@types/splitpanes": "2.2.6",
Expand All @@ -102,7 +102,7 @@
"eslint-config-prettier": "9.1.0",
"eslint-plugin-prettier": "5.2.1",
"eslint-plugin-vue": "9.32.0",
"nuxi": "3.18.2",
"nuxi": "3.19.1",
"nuxt": "3.15.1",
"nuxt-tiptap-editor": "2.1.4",
"nuxt-typed-router": "3.7.2",
Expand All @@ -122,7 +122,7 @@
"tiptap-extension-auto-joiner": "0.1.3",
"tiptap-extension-font-size": "^1.2.0",
"tiptap-unique-id": "2.10.3",
"typescript": "5.7.2",
"typescript": "5.7.3",
"vue": "3.5.13",
"vue-i18n-routing": "1.2.0",
"vue-tsc": "2.2.0"
Expand Down
2 changes: 1 addition & 1 deletion pkg/dbsync/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (s *DBSyncState) Save() error {
return err
}

if err := os.WriteFile(s.filepath, out, os.ModePerm); err != nil {
if err := os.WriteFile(s.filepath, out, 0o640); err != nil {
return err
}

Expand Down
49 changes: 48 additions & 1 deletion pkg/dbsync/sync_users.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ package dbsync
import (
"context"
"strconv"
"strings"

"github.com/fivenet-app/fivenet/gen/go/proto/resources/sync"
"github.com/fivenet-app/fivenet/gen/go/proto/resources/users"
pbsync "github.com/fivenet-app/fivenet/gen/go/proto/services/sync"
"github.com/go-jet/jet/v2/qrm"
"go.uber.org/multierr"
)

type usersSync struct {
Expand Down Expand Up @@ -46,7 +48,26 @@ func (s *usersSync) Sync(ctx context.Context) error {
return nil
}

// TODO retrieve licenses and vehicles for each user selected
if s.cfg.Tables.UserLicenses.Enabled {
// Retrieve user' licenses
errs := multierr.Combine()
var err error
for k := range users {
identifier := ""
if users[k].Identifier != nil {
identifier = *users[k].Identifier
}

users[k].Licenses, err = s.retrieveLicenses(ctx, users[k].UserId, identifier)
if err != nil {
errs = multierr.Append(errs, err)
}
}

if errs != nil {
return errs
}
}

if s.cli != nil {
if _, err := s.cli.SendData(ctx, &pbsync.SendDataRequest{
Expand Down Expand Up @@ -76,7 +97,33 @@ func (s *usersSync) Sync(ctx context.Context) error {
return nil
}

func (s *usersSync) retrieveLicenses(ctx context.Context, userId int32, identifier string) ([]*users.License, error) {
sQuery := s.cfg.Tables.UserLicenses
query := prepareStringQuery(sQuery, s.state, 0, 100)

args := []interface{}{}
if strings.Contains(query, "$userId") {
query = strings.ReplaceAll(query, "$userId", strconv.Itoa(int(userId)))
args = append(args, userId)
} else if strings.Contains(query, "$identifier") {
query = strings.ReplaceAll(query, "$identifier", identifier)
args = append(args, identifier)
}

licenses := []*users.License{}
if _, err := qrm.Query(ctx, s.db, query, args, &licenses); err != nil {
return nil, err
}

return licenses, nil
}

// Sync an individual user/char info
func (s *usersSync) SyncUser(ctx context.Context, userId int32) error {
sQuery := s.cfg.Tables.Users
query := prepareStringQuery(sQuery, s.state, 0, 1)
_ = query

// TODO

return nil
Expand Down
Loading

0 comments on commit 169c0d7

Please sign in to comment.