Skip to content

Commit

Permalink
Refactor project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
javaducky committed May 19, 2024
1 parent e9d6e8f commit 0232e6b
Show file tree
Hide file tree
Showing 20 changed files with 17 additions and 14 deletions.
4 changes: 2 additions & 2 deletions cmd/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"

"github.com/weesvc/weesvc-gorilla/app"
"github.com/weesvc/weesvc-gorilla/migrations"
"github.com/weesvc/weesvc-gorilla/internal/app"
"github.com/weesvc/weesvc-gorilla/internal/migrations"
)

var migrateCmd = &cobra.Command{
Expand Down
4 changes: 2 additions & 2 deletions cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"

"github.com/weesvc/weesvc-gorilla/api"
"github.com/weesvc/weesvc-gorilla/app"
"github.com/weesvc/weesvc-gorilla/internal/api"
"github.com/weesvc/weesvc-gorilla/internal/app"
)

func serveAPI(ctx context.Context, api *api.API) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/spf13/cobra"

"github.com/weesvc/weesvc-gorilla/env"
"github.com/weesvc/weesvc-gorilla/internal/env"
)

var versionCmd = &cobra.Command{
Expand Down
2 changes: 1 addition & 1 deletion api/api.go → internal/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/gorilla/mux"
"github.com/sirupsen/logrus"

"github.com/weesvc/weesvc-gorilla/app"
"github.com/weesvc/weesvc-gorilla/internal/app"
)

type statusCodeRecorder struct {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions api/place.go → internal/api/place.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (

"github.com/gorilla/mux"

"github.com/weesvc/weesvc-gorilla/app"
"github.com/weesvc/weesvc-gorilla/model"
"github.com/weesvc/weesvc-gorilla/internal/app"
"github.com/weesvc/weesvc-gorilla/internal/model"
)

func (a *API) getPlaces(ctx *app.Context, w http.ResponseWriter, _ *http.Request) error {
Expand Down
2 changes: 1 addition & 1 deletion app/app.go → internal/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package app
import (
"github.com/sirupsen/logrus"

"github.com/weesvc/weesvc-gorilla/db"
"github.com/weesvc/weesvc-gorilla/internal/db"
)

// App defines the main application state and behaviors.
Expand Down
2 changes: 1 addition & 1 deletion app/context.go → internal/app/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"github.com/google/uuid"
"github.com/sirupsen/logrus"

"github.com/weesvc/weesvc-gorilla/db"
"github.com/weesvc/weesvc-gorilla/internal/db"
)

// Context provides for a request-scoped context.
Expand Down
4 changes: 3 additions & 1 deletion app/place.go → internal/app/place.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package app

import "github.com/weesvc/weesvc-gorilla/model"
import (
"github.com/weesvc/weesvc-gorilla/internal/model"
)

// GetPlaces returns available places.
func (ctx *Context) GetPlaces() ([]*model.Place, error) {
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion db/place.go → internal/db/place.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package db
import (
"github.com/pkg/errors"

"github.com/weesvc/weesvc-gorilla/model"
"github.com/weesvc/weesvc-gorilla/internal/model"
)

// GetPlaces retrieves all available places from the database.
Expand Down
3 changes: 2 additions & 1 deletion db/place_test.go → internal/db/place_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import (
"log"
"testing"

"github.com/weesvc/weesvc-gorilla/model"
"github.com/weesvc/weesvc-gorilla/internal/model"

"github.com/weesvc/weesvc-gorilla/testhelpers"

"github.com/stretchr/testify/assert"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion testhelpers/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type PostgresContainer struct {
func CreatePostgresContainer(ctx context.Context) (*PostgresContainer, error) {
pgContainer, err := postgres.RunContainer(ctx,
testcontainers.WithImage("postgres:15.3-alpine"),
postgres.WithInitScripts(filepath.Join("..", "testdata", "init-db.sql")),
postgres.WithInitScripts(filepath.Join("..", "..", "testdata", "init-db.sql")),
postgres.WithDatabase("test-db"),
postgres.WithUsername("postgres"),
postgres.WithPassword("postgres"),
Expand Down

0 comments on commit 0232e6b

Please sign in to comment.