Skip to content

Commit

Permalink
Merge pull request #12 from penguin-statistics/dev
Browse files Browse the repository at this point in the history
Release v0.0.3
  • Loading branch information
AlvISsReimu authored Aug 28, 2023
2 parents 6769acb + 6ed7b5f commit bda3478
Show file tree
Hide file tree
Showing 92 changed files with 13,702 additions and 1,638 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/pr-auto-create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ jobs:
script: |
let lastRelease = 'v0.0.0'
try {
const { data: { tag_name: lastRelease } } = await github.rest.repos.getLatestRelease({
const { data: { tag_name: fetchedLastRelease } } = await github.rest.repos.getLatestRelease({
owner: context.repo.owner,
repo: context.repo.repo
})
lastRelease = fetchedLastRelease
} catch (e) {
console.log('No release found, creating first release')
}
Expand Down
2 changes: 0 additions & 2 deletions cmd/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"github.com/rs/zerolog/log"
"github.com/urfave/cli/v2"

"exusiai.dev/roguestats-backend/cmd/app/cli/db"
"exusiai.dev/roguestats-backend/cmd/app/cli/script"
"exusiai.dev/roguestats-backend/cmd/app/server"
)
Expand All @@ -16,7 +15,6 @@ func Run() {
Name: "app",
Commands: []*cli.Command{
server.Command(),
db.Command(),
script.Command(),
},
}
Expand Down
101 changes: 0 additions & 101 deletions cmd/app/cli/db/command.go

This file was deleted.

4 changes: 2 additions & 2 deletions cmd/app/cli/script/battle_csv_import.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ func (c *BattleCSVImport) Run() error {
return nil
}

func (c *BattleCSVImport) convertRowToContent(row []string) map[string]interface{} {
content := make(map[string]interface{})
func (c *BattleCSVImport) convertRowToContent(row []string) map[string]any {
content := make(map[string]any)
columnHandler := GetColumnHandler()

band := columnHandler.HandleBand(strings.TrimSpace(row[1]))
Expand Down
8 changes: 5 additions & 3 deletions cmd/app/cli/script/column_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strings"
"sync"

"gopkg.in/guregu/null.v3"
"gopkg.in/guregu/null.v4"
)

type ColumnHandler struct {
Expand All @@ -18,8 +18,10 @@ type ColumnHandler struct {
layoutMap map[string]string
}

var columnHandlerInstance *ColumnHandler
var columnHanlderOnce sync.Once
var (
columnHandlerInstance *ColumnHandler
columnHanlderOnce sync.Once
)

func GetColumnHandler() *ColumnHandler {
columnHanlderOnce.Do(func() {
Expand Down
19 changes: 9 additions & 10 deletions cmd/app/cli/script/import_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import (
"log"
"os"

"github.com/machinebox/graphql"

"exusiai.dev/roguestats-backend/internal/model"
"github.com/machinebox/graphql"
)

func ReadCSVFile(filePath string) [][]string {
Expand All @@ -25,25 +24,25 @@ func ReadCSVFile(filePath string) [][]string {
return records
}

func PostEvent(content map[string]interface{}, researchID string) {
func PostEvent(content map[string]any, researchID string) {
client := graphql.NewClient("http://localhost:3500/graphql")
req := graphql.NewRequest(`
mutation CreateEvent($newEvent: NewEvent!) {
createEvent(input: $newEvent) {
mutation CreateEvent($input: CreateEventInput!) {
createEvent(input: $input) {
content
}
}`,
)
userAgent := "cli"
newEvent := model.NewEvent{
input := model.CreateEventInput{
Content: content,
ResearchID: researchID,
UserAgent: &userAgent,
UserAgent: userAgent,
}
req.Var("newEvent", newEvent)
// req.Header.Set("Authorization", "")
req.Var("input", input)
req.Header.Set("Authorization", "Bearer eyJhbGciOiJFUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJyb2d1ZXN0YXRzIiwiZXhwIjoxNjk0MjA0MjY1LCJpYXQiOjE2OTI5OTQ2NjUsImlzcyI6InJvZ3Vlc3RhdHMvdjAuMC4wIiwibmJmIjoxNjkyOTk0NjY1LCJzdWIiOiIwMWg4cTVlYnJuNWV0aG0xcDZ6anhyOWVmdyJ9.AHlIYrx7tKj6nnXO4MYRd_0mXqzOVWPyG6FHidPitfI2IbrtZI3-lXA-bZP_nl0Op7d4TgzacdYwJPDgYGLoZcznAfopT-ahoHmDZrflhrK-Soo8ji7OZENjOIH5VetkkTaKl9zuqdAivds4DQPefSYngsn5vqzIgIZhaoR8nJoaq6MT")
ctx := context.Background()
var respData interface{}
var respData any
if err := client.Run(ctx, req, &respData); err != nil {
log.Fatal(err)
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/app/cli/script/incident_csv_import.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ func (c *IncidentCSVImport) Run() error {
return nil
}

func (c *IncidentCSVImport) convertRowToContent(row []string) map[string]interface{} {
content := make(map[string]interface{})
func (c *IncidentCSVImport) convertRowToContent(row []string) map[string]any {
content := make(map[string]any)
columnHandler := GetColumnHandler()

grade := columnHandler.HandleInt(strings.TrimSpace(row[1]))
Expand Down
4 changes: 2 additions & 2 deletions cmd/app/cli/script/portal_csv_import.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ func (c *PortalCSVImport) Run() error {
return nil
}

func (c *PortalCSVImport) convertRowToContent(row []string) map[string]interface{} {
content := make(map[string]interface{})
func (c *PortalCSVImport) convertRowToContent(row []string) map[string]any {
content := make(map[string]any)
columnHandler := GetColumnHandler()

grade := columnHandler.HandleInt(strings.TrimSpace(row[1]))
Expand Down
4 changes: 2 additions & 2 deletions cmd/app/cli/script/rest_csv_import.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ func (c *RestCSVImport) Run() error {
return nil
}

func (c *RestCSVImport) convertRowToContent(row []string) map[string]interface{} {
content := make(map[string]interface{})
func (c *RestCSVImport) convertRowToContent(row []string) map[string]any {
content := make(map[string]any)
columnHandler := GetColumnHandler()

grade := columnHandler.HandleInt(strings.TrimSpace(row[1]))
Expand Down
4 changes: 4 additions & 0 deletions generate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package main

//go:generate go run -mod=mod ./internal/ent/entc.go
//go:generate go run -mod=mod github.com/99designs/gqlgen
34 changes: 22 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,45 @@ module exusiai.dev/roguestats-backend
go 1.19

require (
entgo.io/contrib v0.4.6-0.20230725054517-9e1dadfef7fa
entgo.io/ent v0.12.3
github.com/99designs/gqlgen v0.17.36
github.com/antonmedv/expr v1.14.3
github.com/bwmarrin/snowflake v0.3.0
github.com/dchest/uniuri v1.2.0
github.com/gofiber/adaptor/v2 v2.2.1
github.com/gofiber/fiber/v2 v2.48.0
github.com/golang-jwt/jwt/v5 v5.0.0
github.com/hashicorp/go-multierror v1.1.1
github.com/joho/godotenv v1.5.1
github.com/kelseyhightower/envconfig v1.4.0
github.com/lib/pq v1.10.9
github.com/machinebox/graphql v0.2.2
github.com/oklog/ulid/v2 v2.1.0
github.com/pkg/errors v0.9.1
github.com/resendlabs/resend-go v1.7.0
github.com/rs/zerolog v1.30.0
github.com/uptrace/bun v1.1.14
github.com/uptrace/bun/dialect/pgdialect v1.1.14
github.com/uptrace/bun/driver/pgdriver v1.1.14
github.com/urfave/cli/v2 v2.25.7
github.com/vektah/gqlparser/v2 v2.5.8
go.uber.org/fx v1.20.0
golang.org/x/crypto v0.12.0
gopkg.in/guregu/null.v3 v3.5.0
gopkg.in/guregu/null.v4 v4.0.0
)

require github.com/matryer/is v1.4.1 // indirect
require (
ariga.io/atlas v0.10.2-0.20230427182402-87a07dfb83bf // indirect
github.com/agext/levenshtein v1.2.1 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/go-openapi/inflect v0.19.0 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/hcl/v2 v2.13.0 // indirect
github.com/matryer/is v1.4.1 // indirect
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 // indirect
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/zclconf/go-cty v1.8.0 // indirect
golang.org/x/exp v0.0.0-20221230185412-738e83a70c30 // indirect
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
)

require (
github.com/agnivade/levenshtein v1.1.1 // indirect
Expand All @@ -37,7 +50,6 @@ require (
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.3 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/klauspost/compress v1.16.3 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
Expand All @@ -46,21 +58,19 @@ require (
github.com/rivo/uniseg v0.2.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.48.0 // indirect
github.com/valyala/tcplisten v1.0.0 // indirect
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/dig v1.17.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.23.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
golang.org/x/tools v0.9.3 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
mellium.im/sasl v0.3.1 // indirect
)
Loading

0 comments on commit bda3478

Please sign in to comment.