Skip to content

Commit

Permalink
chore: Rename package
Browse files Browse the repository at this point in the history
Fixes #6
  • Loading branch information
codello committed Aug 14, 2023
1 parent db7a6ae commit d05a2e7
Show file tree
Hide file tree
Showing 63 changed files with 181 additions and 153 deletions.
7 changes: 4 additions & 3 deletions cmd/karman/migrate.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package main

import (
"log"

"github.com/pressly/goose/v3"
"github.com/psanford/memfs"
"github.com/spf13/cobra"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
"log"

_ "github.com/Karaoke-Manager/karman/migrations"
gormdb "github.com/Karaoke-Manager/karman/migrations/db"
_ "github.com/Karaoke-Manager/server/migrations"
gormdb "github.com/Karaoke-Manager/server/migrations/db"
)

func init() {
Expand Down
6 changes: 3 additions & 3 deletions cmd/karman/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
"gorm.io/driver/sqlite"
"gorm.io/gorm"

"github.com/Karaoke-Manager/karman/internal/api"
"github.com/Karaoke-Manager/karman/internal/service/media"
"github.com/Karaoke-Manager/karman/internal/service/song"
"github.com/Karaoke-Manager/server/internal/api"
"github.com/Karaoke-Manager/server/internal/service/media"
"github.com/Karaoke-Manager/server/internal/service/song"
)

func init() {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/Karaoke-Manager/karman
module github.com/Karaoke-Manager/server

go 1.21

Expand Down
5 changes: 3 additions & 2 deletions internal/api/apierror/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/Karaoke-Manager/karman/pkg/render"
"gorm.io/gorm"
"net/http"

"github.com/Karaoke-Manager/server/pkg/render"
"gorm.io/gorm"
)

// ProblemTypeDomain is the base domain for all custom problem types.
Expand Down
3 changes: 2 additions & 1 deletion internal/api/apierror/httperrors.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package apierror

import (
"github.com/Karaoke-Manager/karman/pkg/mediatype"
"net/http"

"github.com/Karaoke-Manager/server/pkg/mediatype"
)

const (
Expand Down
5 changes: 3 additions & 2 deletions internal/api/apierror/rfc7807.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package apierror

import (
"encoding/json"
"github.com/Karaoke-Manager/karman/pkg/mediatype"
"github.com/Karaoke-Manager/karman/pkg/render"
"net/http"

"github.com/Karaoke-Manager/server/pkg/mediatype"
"github.com/Karaoke-Manager/server/pkg/render"
)

// ProblemDetails implements [RFC 7807] "Problem Details for HTTP APIs".
Expand Down
2 changes: 1 addition & 1 deletion internal/api/apierror/song.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"codello.dev/ultrastar/txt"

"github.com/Karaoke-Manager/karman/internal/model"
"github.com/Karaoke-Manager/server/internal/model"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion internal/api/apierror/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package apierror

import (
"fmt"
"github.com/Karaoke-Manager/karman/internal/entity"
"net/http"

"github.com/Karaoke-Manager/server/internal/entity"
)

// These constants identify known problem types related to uploads.
Expand Down
15 changes: 8 additions & 7 deletions internal/api/controller.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package api

import (
"github.com/Karaoke-Manager/karman/internal/api/apierror"
"github.com/Karaoke-Manager/karman/internal/service/media"
"github.com/Karaoke-Manager/karman/internal/service/song"
"github.com/Karaoke-Manager/karman/pkg/render"
"net/http"

"github.com/Karaoke-Manager/server/internal/api/apierror"
"github.com/Karaoke-Manager/server/internal/service/media"
"github.com/Karaoke-Manager/server/internal/service/song"
"github.com/Karaoke-Manager/server/pkg/render"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
"net/http"

"github.com/Karaoke-Manager/karman/internal/api/v1"
"github.com/Karaoke-Manager/karman/internal/service/upload"
"github.com/Karaoke-Manager/server/internal/api/v1"
"github.com/Karaoke-Manager/server/internal/service/upload"
)

// Controller is the main API controller.
Expand Down
6 changes: 3 additions & 3 deletions internal/api/middleware/contenttype.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package middleware
import (
"net/http"

"github.com/Karaoke-Manager/karman/internal/api/apierror"
"github.com/Karaoke-Manager/karman/pkg/mediatype"
"github.com/Karaoke-Manager/karman/pkg/render"
"github.com/Karaoke-Manager/server/internal/api/apierror"
"github.com/Karaoke-Manager/server/pkg/mediatype"
"github.com/Karaoke-Manager/server/pkg/render"
)

// ContentTypeJSON is an instance of the RequireContentType middleware for the common application of JSON requests.
Expand Down
9 changes: 5 additions & 4 deletions internal/api/middleware/contenttype_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package middleware

import (
"encoding/json"
"github.com/Karaoke-Manager/karman/internal/api/apierror"
_ "github.com/Karaoke-Manager/karman/pkg/render/json"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"net/http"
"net/http/httptest"
"testing"

"github.com/Karaoke-Manager/server/internal/api/apierror"
_ "github.com/Karaoke-Manager/server/pkg/render/json"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestRequireContentType(t *testing.T) {
Expand Down
5 changes: 3 additions & 2 deletions internal/api/middleware/paginate.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package middleware

import (
"context"
"github.com/Karaoke-Manager/karman/internal/api/apierror"
"github.com/Karaoke-Manager/karman/pkg/render"
"net/http"
"strconv"

"github.com/Karaoke-Manager/server/internal/api/apierror"
"github.com/Karaoke-Manager/server/pkg/render"
)

const (
Expand Down
7 changes: 4 additions & 3 deletions internal/api/middleware/paginate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package middleware

import (
"encoding/json"
"github.com/Karaoke-Manager/karman/internal/api/apierror"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"net/http"
"net/http/httptest"
"testing"

"github.com/Karaoke-Manager/server/internal/api/apierror"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestPaginate(t *testing.T) {
Expand Down
7 changes: 4 additions & 3 deletions internal/api/middleware/uuid.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package middleware

import (
"context"
"github.com/Karaoke-Manager/karman/internal/api/apierror"
"github.com/Karaoke-Manager/karman/pkg/render"
"net/http"

"github.com/Karaoke-Manager/server/internal/api/apierror"
"github.com/Karaoke-Manager/server/pkg/render"
"github.com/go-chi/chi/v5"
"github.com/google/uuid"
"net/http"
)

// UUID is a simple middleware that fetches a UUID value from a request parameter named param.
Expand Down
9 changes: 5 additions & 4 deletions internal/api/middleware/uuid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package middleware
import (
"context"
"encoding/json"
"github.com/Karaoke-Manager/karman/internal/api/apierror"
"net/http"
"net/http/httptest"
"testing"

"github.com/Karaoke-Manager/server/internal/api/apierror"
"github.com/go-chi/chi/v5"
"github.com/google/uuid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"net/http"
"net/http/httptest"
"testing"
)

func TestUUID(t *testing.T) {
Expand Down
10 changes: 5 additions & 5 deletions internal/api/v1/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package v1
import (
"github.com/go-chi/chi/v5"

"github.com/Karaoke-Manager/karman/internal/api/v1/songs"
"github.com/Karaoke-Manager/karman/internal/api/v1/uploads"
"github.com/Karaoke-Manager/karman/internal/service/media"
"github.com/Karaoke-Manager/karman/internal/service/song"
"github.com/Karaoke-Manager/karman/internal/service/upload"
"github.com/Karaoke-Manager/server/internal/api/v1/songs"
"github.com/Karaoke-Manager/server/internal/api/v1/uploads"
"github.com/Karaoke-Manager/server/internal/service/media"
"github.com/Karaoke-Manager/server/internal/service/song"
"github.com/Karaoke-Manager/server/internal/service/upload"
)

// Controller implements the /v1 API namespace.
Expand Down
10 changes: 5 additions & 5 deletions internal/api/v1/songs/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package songs
import (
"github.com/go-chi/chi/v5"

"github.com/Karaoke-Manager/karman/internal/api/middleware"
"github.com/Karaoke-Manager/karman/internal/service/media"
"github.com/Karaoke-Manager/karman/internal/service/song"
"github.com/Karaoke-Manager/karman/pkg/render"
_ "github.com/Karaoke-Manager/karman/pkg/render/json"
"github.com/Karaoke-Manager/server/internal/api/middleware"
"github.com/Karaoke-Manager/server/internal/service/media"
"github.com/Karaoke-Manager/server/internal/service/song"
"github.com/Karaoke-Manager/server/pkg/render"
_ "github.com/Karaoke-Manager/server/pkg/render/json"
)

// Controller implements the /v1/songs endpoint.
Expand Down
10 changes: 5 additions & 5 deletions internal/api/v1/songs/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import (
"net/http/httptest"
"testing"

"github.com/Karaoke-Manager/karman/internal/api/apierror"
"github.com/Karaoke-Manager/karman/internal/model"
"github.com/Karaoke-Manager/server/internal/api/apierror"
"github.com/Karaoke-Manager/server/internal/model"

"github.com/google/uuid"

"github.com/go-chi/chi/v5"

"github.com/Karaoke-Manager/karman/internal/service/media"
"github.com/Karaoke-Manager/karman/internal/service/song"
"github.com/Karaoke-Manager/karman/internal/test"
"github.com/Karaoke-Manager/server/internal/service/media"
"github.com/Karaoke-Manager/server/internal/service/song"
"github.com/Karaoke-Manager/server/internal/test"
)

// setup prepares a test instance of the songs.Controller.
Expand Down
10 changes: 5 additions & 5 deletions internal/api/v1/songs/crud.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"codello.dev/ultrastar/txt"
"gorm.io/gorm"

"github.com/Karaoke-Manager/karman/internal/api/apierror"
"github.com/Karaoke-Manager/karman/internal/api/middleware"
"github.com/Karaoke-Manager/karman/internal/model"
"github.com/Karaoke-Manager/karman/internal/schema"
"github.com/Karaoke-Manager/karman/pkg/render"
"github.com/Karaoke-Manager/server/internal/api/apierror"
"github.com/Karaoke-Manager/server/internal/api/middleware"
"github.com/Karaoke-Manager/server/internal/model"
"github.com/Karaoke-Manager/server/internal/schema"
"github.com/Karaoke-Manager/server/pkg/render"
)

// Create implements the POST /v1/songs endpoint.
Expand Down
6 changes: 3 additions & 3 deletions internal/api/v1/songs/crud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/Karaoke-Manager/karman/internal/api/apierror"
"github.com/Karaoke-Manager/karman/internal/schema"
"github.com/Karaoke-Manager/karman/internal/test"
"github.com/Karaoke-Manager/server/internal/api/apierror"
"github.com/Karaoke-Manager/server/internal/schema"
"github.com/Karaoke-Manager/server/internal/test"
)

//go:generate go run ../../../../tools/gensong -output testdata/valid-song.txt
Expand Down
10 changes: 5 additions & 5 deletions internal/api/v1/songs/media.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import (
"net/http"
"strconv"

"github.com/Karaoke-Manager/karman/internal/model"
"github.com/Karaoke-Manager/karman/pkg/mediatype"
"github.com/Karaoke-Manager/server/internal/model"
"github.com/Karaoke-Manager/server/pkg/mediatype"

"codello.dev/ultrastar/txt"

"github.com/Karaoke-Manager/karman/internal/api/apierror"
"github.com/Karaoke-Manager/karman/internal/schema"
"github.com/Karaoke-Manager/karman/pkg/render"
"github.com/Karaoke-Manager/server/internal/api/apierror"
"github.com/Karaoke-Manager/server/internal/schema"
"github.com/Karaoke-Manager/server/pkg/render"
)

// GetTxt implements the GET /v1/songs/{uuid}/txt endpoint.
Expand Down
10 changes: 5 additions & 5 deletions internal/api/v1/songs/media_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import (

"github.com/stretchr/testify/assert"

"github.com/Karaoke-Manager/karman/internal/api/apierror"
"github.com/Karaoke-Manager/karman/internal/model"
"github.com/Karaoke-Manager/karman/internal/schema"
"github.com/Karaoke-Manager/karman/internal/test"
"github.com/Karaoke-Manager/karman/pkg/mediatype"
"github.com/Karaoke-Manager/server/internal/api/apierror"
"github.com/Karaoke-Manager/server/internal/model"
"github.com/Karaoke-Manager/server/internal/schema"
"github.com/Karaoke-Manager/server/internal/test"
"github.com/Karaoke-Manager/server/pkg/mediatype"
)

func TestController_GetTxt(t *testing.T) {
Expand Down
8 changes: 4 additions & 4 deletions internal/api/v1/songs/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"context"
"net/http"

"github.com/Karaoke-Manager/karman/internal/api/apierror"
"github.com/Karaoke-Manager/karman/internal/api/middleware"
"github.com/Karaoke-Manager/karman/internal/model"
"github.com/Karaoke-Manager/karman/pkg/render"
"github.com/Karaoke-Manager/server/internal/api/apierror"
"github.com/Karaoke-Manager/server/internal/api/middleware"
"github.com/Karaoke-Manager/server/internal/model"
"github.com/Karaoke-Manager/server/pkg/render"
)

// contextKey is the type for context keys used in this package.
Expand Down
6 changes: 3 additions & 3 deletions internal/api/v1/songs/middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (

"github.com/stretchr/testify/assert"

"github.com/Karaoke-Manager/karman/internal/api/apierror"
"github.com/Karaoke-Manager/karman/internal/api/middleware"
"github.com/Karaoke-Manager/karman/internal/test"
"github.com/Karaoke-Manager/server/internal/api/apierror"
"github.com/Karaoke-Manager/server/internal/api/middleware"
"github.com/Karaoke-Manager/server/internal/test"
)

func TestController_FetchUpload(t *testing.T) {
Expand Down
9 changes: 5 additions & 4 deletions internal/api/v1/uploads/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package uploads

import (
"context"
"github.com/Karaoke-Manager/karman/internal/api/apierror"
"github.com/Karaoke-Manager/karman/internal/entity"
"github.com/Karaoke-Manager/karman/pkg/render"
"github.com/go-chi/chi/v5"
"io/fs"
"net/http"

"github.com/Karaoke-Manager/server/internal/api/apierror"
"github.com/Karaoke-Manager/server/internal/entity"
"github.com/Karaoke-Manager/server/pkg/render"
"github.com/go-chi/chi/v5"
)

type contextKey int
Expand Down
2 changes: 1 addition & 1 deletion internal/api/v1/uploads/controller.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package uploads

import (
"github.com/Karaoke-Manager/karman/internal/service/upload"
"github.com/Karaoke-Manager/server/internal/service/upload"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
)
Expand Down
Loading

0 comments on commit d05a2e7

Please sign in to comment.