Skip to content

Commit

Permalink
feat(wip): start work on character support
Browse files Browse the repository at this point in the history
  • Loading branch information
SomethingSexy committed Sep 24, 2024
1 parent f564227 commit ebf6636
Show file tree
Hide file tree
Showing 13 changed files with 323 additions and 417 deletions.
7 changes: 0 additions & 7 deletions internal/chronicle/adapter/http/game/game_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@ type GameRequest struct {
Name string `jsonapi:"attr,name"`
Type string `jsonapi:"attr,type"`
Worlds []*WorldRequest `jsonapi:"relation,worlds"`
// ID int `jsonapi:"primary,blogs"`
// Title string `jsonapi:"attr,title"`
// Posts []*Post `jsonapi:"relation,posts"`
// CurrentPost *Post `jsonapi:"relation,current_post"`
// CurrentPostID int `jsonapi:"attr,current_post_id"`
// CreatedAt time.Time `jsonapi:"attr,created_at"`
// ViewCount int `jsonapi:"attr,view_count"`
}

func (a *GameRequest) Bind(r *http.Request) error {
Expand Down
244 changes: 0 additions & 244 deletions internal/chronicle/adapter/http/game/game_server.go

This file was deleted.

31 changes: 25 additions & 6 deletions internal/chronicle/adapter/persistence/postgres/query/game.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package query
import (
"context"
"strings"
"time"

"github.com/SomethingSexy/chronicle/internal/chronicle/adapter/persistence/postgres/sqlc/repository"
"github.com/SomethingSexy/chronicle/internal/chronicle/core/domain"
Expand All @@ -23,10 +24,16 @@ type GameQuery struct {

// Create a game
func (g GameQuery) CreateGame(ctx context.Context, game domain.Game) (domain.Game, error) {
ts := pgtype.Timestamptz{
Time: time.Now(),
Valid: true,
}
args := repository.CreateGameParams{
GameID: game.GameId,
Name: game.Name,
Type: game.Type,
GameID: game.GameId,
Name: game.Name,
Type: game.Type,
CreatedAt: ts,
UpdatedAt: ts,
}

response, err := g.Queries.CreateGame(ctx, args)
Expand Down Expand Up @@ -104,10 +111,16 @@ func (g GameQuery) CreateWorld(ctx context.Context, world domain.World) (domain.
return domain.World{}, err
}

ts := pgtype.Timestamptz{
Time: time.Now(),
Valid: true,
}
args := repository.CreateWorldParams{
WorldID: world.WorldId,
Name: world.Name,
GameID: game.ID,
WorldID: world.WorldId,
Name: world.Name,
GameID: game.ID,
CreatedAt: ts,
UpdatedAt: ts,
}

response, err := g.Queries.CreateWorld(ctx, args)
Expand Down Expand Up @@ -154,6 +167,10 @@ func (g GameQuery) CreateLocation(ctx context.Context, location domain.Location)
}
}

ts := pgtype.Timestamptz{
Time: time.Now(),
Valid: true,
}
args := repository.CreateLocationParams{
LocationID: location.LocationId,
WorldID: world.ID,
Expand All @@ -164,6 +181,8 @@ func (g GameQuery) CreateLocation(ctx context.Context, location domain.Location)
String: path,
Valid: true,
},
CreatedAt: ts,
UpdatedAt: ts,
}

_, err = g.Queries.CreateLocation(ctx, args)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
h1:PmA+4B4HY9WeN+NxUCd14XupO1EHfzKekMUpCcc+OtA=
20240922180859_initial.sql h1:tDi7JzkIFGrhaZgallRrrYgCFXWJo8ickqK/Xn35gCY=
h1:DljSNBalsjIkrSZ+WOGYFkwLIstGT0W6kK3Zalo3/9Q=
20240924154059_initial.sql h1:YA7/O03b3X56utueibLwOYeFGKNHYWsGZ+3nyM+YWq8=
Loading

0 comments on commit ebf6636

Please sign in to comment.