Rename package

This commit is contained in:
Tony Grosinger 2024-07-09 17:57:05 -07:00
parent 02544da725
commit d08f5f55aa
72 changed files with 250 additions and 234 deletions

View File

@ -11,9 +11,9 @@ import (
"os/signal"
"time"
"github.com/mikestefanello/pagoda/pkg/handlers"
"github.com/mikestefanello/pagoda/pkg/services"
"github.com/mikestefanello/pagoda/pkg/tasks"
"git.grosinger.net/tgrosinger/saasitone/pkg/handlers"
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
"git.grosinger.net/tgrosinger/saasitone/pkg/tasks"
)
func main() {

View File

@ -9,14 +9,14 @@ import (
"log"
"reflect"
"github.com/mikestefanello/pagoda/ent/migrate"
"entgo.io/ent"
"entgo.io/ent/dialect"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/mikestefanello/pagoda/ent/passwordtoken"
"github.com/mikestefanello/pagoda/ent/user"
"git.grosinger.net/tgrosinger/saasitone/ent/migrate"
"git.grosinger.net/tgrosinger/saasitone/ent/passwordtoken"
"git.grosinger.net/tgrosinger/saasitone/ent/user"
)
// Client is the client that holds all ent builders.

View File

@ -12,8 +12,9 @@ import (
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/mikestefanello/pagoda/ent/passwordtoken"
"github.com/mikestefanello/pagoda/ent/user"
"git.grosinger.net/tgrosinger/saasitone/ent/passwordtoken"
"git.grosinger.net/tgrosinger/saasitone/ent/user"
)
// ent aliases to avoid import conflicts in user's code.

View File

@ -5,12 +5,11 @@ package enttest
import (
"context"
"github.com/mikestefanello/pagoda/ent"
// required by schema hooks.
_ "github.com/mikestefanello/pagoda/ent/runtime"
"entgo.io/ent/dialect/sql/schema"
"github.com/mikestefanello/pagoda/ent/migrate"
"git.grosinger.net/tgrosinger/saasitone/ent"
"git.grosinger.net/tgrosinger/saasitone/ent/migrate"
_ "git.grosinger.net/tgrosinger/saasitone/ent/runtime" // required by schema hooks.
)
type (
@ -71,6 +70,7 @@ func NewClient(t TestingT, opts ...Option) *ent.Client {
migrateSchema(t, c, o)
return c
}
func migrateSchema(t TestingT, c *ent.Client, o *options) {
tables, err := schema.CopyTables(migrate.Tables)
if err != nil {

View File

@ -6,7 +6,7 @@ import (
"context"
"fmt"
"github.com/mikestefanello/pagoda/ent"
"git.grosinger.net/tgrosinger/saasitone/ent"
)
// The PasswordTokenFunc type is an adapter to allow the use of ordinary

View File

@ -11,9 +11,10 @@ import (
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"github.com/mikestefanello/pagoda/ent/passwordtoken"
"github.com/mikestefanello/pagoda/ent/predicate"
"github.com/mikestefanello/pagoda/ent/user"
"git.grosinger.net/tgrosinger/saasitone/ent/passwordtoken"
"git.grosinger.net/tgrosinger/saasitone/ent/predicate"
"git.grosinger.net/tgrosinger/saasitone/ent/user"
)
const (

View File

@ -9,8 +9,9 @@ import (
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"github.com/mikestefanello/pagoda/ent/passwordtoken"
"github.com/mikestefanello/pagoda/ent/user"
"git.grosinger.net/tgrosinger/saasitone/ent/passwordtoken"
"git.grosinger.net/tgrosinger/saasitone/ent/user"
)
// PasswordToken is the model entity for the PasswordToken schema.

View File

@ -7,7 +7,8 @@ import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/mikestefanello/pagoda/ent/predicate"
"git.grosinger.net/tgrosinger/saasitone/ent/predicate"
)
// ID filters vertices based on their ID field.

View File

@ -10,8 +10,9 @@ import (
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
"github.com/mikestefanello/pagoda/ent/passwordtoken"
"github.com/mikestefanello/pagoda/ent/user"
"git.grosinger.net/tgrosinger/saasitone/ent/passwordtoken"
"git.grosinger.net/tgrosinger/saasitone/ent/user"
)
// PasswordTokenCreate is the builder for creating a PasswordToken entity.

View File

@ -8,8 +8,9 @@ import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
"github.com/mikestefanello/pagoda/ent/passwordtoken"
"github.com/mikestefanello/pagoda/ent/predicate"
"git.grosinger.net/tgrosinger/saasitone/ent/passwordtoken"
"git.grosinger.net/tgrosinger/saasitone/ent/predicate"
)
// PasswordTokenDelete is the builder for deleting a PasswordToken entity.

View File

@ -10,9 +10,10 @@ import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
"github.com/mikestefanello/pagoda/ent/passwordtoken"
"github.com/mikestefanello/pagoda/ent/predicate"
"github.com/mikestefanello/pagoda/ent/user"
"git.grosinger.net/tgrosinger/saasitone/ent/passwordtoken"
"git.grosinger.net/tgrosinger/saasitone/ent/predicate"
"git.grosinger.net/tgrosinger/saasitone/ent/user"
)
// PasswordTokenQuery is the builder for querying PasswordToken entities.

View File

@ -11,9 +11,10 @@ import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
"github.com/mikestefanello/pagoda/ent/passwordtoken"
"github.com/mikestefanello/pagoda/ent/predicate"
"github.com/mikestefanello/pagoda/ent/user"
"git.grosinger.net/tgrosinger/saasitone/ent/passwordtoken"
"git.grosinger.net/tgrosinger/saasitone/ent/predicate"
"git.grosinger.net/tgrosinger/saasitone/ent/user"
)
// PasswordTokenUpdate is the builder for updating PasswordToken entities.

View File

@ -2,4 +2,4 @@
package ent
// The schema-stitching logic is generated in github.com/mikestefanello/pagoda/ent/runtime/runtime.go
// The schema-stitching logic is generated in git.grosinger.net/tgrosinger/saasitone/ent/runtime/runtime.go

View File

@ -5,9 +5,9 @@ package runtime
import (
"time"
"github.com/mikestefanello/pagoda/ent/passwordtoken"
"github.com/mikestefanello/pagoda/ent/schema"
"github.com/mikestefanello/pagoda/ent/user"
"git.grosinger.net/tgrosinger/saasitone/ent/passwordtoken"
"git.grosinger.net/tgrosinger/saasitone/ent/schema"
"git.grosinger.net/tgrosinger/saasitone/ent/user"
)
// The init function reads all schema descriptors with runtime code

View File

@ -5,12 +5,12 @@ import (
"strings"
"time"
ge "github.com/mikestefanello/pagoda/ent"
"github.com/mikestefanello/pagoda/ent/hook"
"entgo.io/ent"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
ge "git.grosinger.net/tgrosinger/saasitone/ent"
"git.grosinger.net/tgrosinger/saasitone/ent/hook"
)
// User holds the schema definition for the User entity.

View File

@ -9,7 +9,8 @@ import (
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"github.com/mikestefanello/pagoda/ent/user"
"git.grosinger.net/tgrosinger/saasitone/ent/user"
)
// User is the model entity for the User schema.

View File

@ -62,7 +62,7 @@ func ValidColumn(column string) bool {
// package on the initialization of the application. Therefore,
// it should be imported in the main as follows:
//
// import _ "github.com/mikestefanello/pagoda/ent/runtime"
// import _ "git.grosinger.net/tgrosinger/saasitone/ent/runtime"
var (
Hooks [1]ent.Hook
// NameValidator is a validator for the "name" field. It is called by the builders before save.
@ -123,6 +123,7 @@ func ByOwner(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
sqlgraph.OrderByNeighborTerms(s, newOwnerStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
func newOwnerStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),

View File

@ -7,7 +7,8 @@ import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/mikestefanello/pagoda/ent/predicate"
"git.grosinger.net/tgrosinger/saasitone/ent/predicate"
)
// ID filters vertices based on their ID field.

View File

@ -10,8 +10,9 @@ import (
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
"github.com/mikestefanello/pagoda/ent/passwordtoken"
"github.com/mikestefanello/pagoda/ent/user"
"git.grosinger.net/tgrosinger/saasitone/ent/passwordtoken"
"git.grosinger.net/tgrosinger/saasitone/ent/user"
)
// UserCreate is the builder for creating a User entity.

View File

@ -8,8 +8,9 @@ import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
"github.com/mikestefanello/pagoda/ent/predicate"
"github.com/mikestefanello/pagoda/ent/user"
"git.grosinger.net/tgrosinger/saasitone/ent/predicate"
"git.grosinger.net/tgrosinger/saasitone/ent/user"
)
// UserDelete is the builder for deleting a User entity.

View File

@ -11,9 +11,10 @@ import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
"github.com/mikestefanello/pagoda/ent/passwordtoken"
"github.com/mikestefanello/pagoda/ent/predicate"
"github.com/mikestefanello/pagoda/ent/user"
"git.grosinger.net/tgrosinger/saasitone/ent/passwordtoken"
"git.grosinger.net/tgrosinger/saasitone/ent/predicate"
"git.grosinger.net/tgrosinger/saasitone/ent/user"
)
// UserQuery is the builder for querying User entities.

View File

@ -10,9 +10,10 @@ import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
"github.com/mikestefanello/pagoda/ent/passwordtoken"
"github.com/mikestefanello/pagoda/ent/predicate"
"github.com/mikestefanello/pagoda/ent/user"
"git.grosinger.net/tgrosinger/saasitone/ent/passwordtoken"
"git.grosinger.net/tgrosinger/saasitone/ent/predicate"
"git.grosinger.net/tgrosinger/saasitone/ent/user"
)
// UserUpdate is the builder for updating User entities.

2
go.mod
View File

@ -1,4 +1,4 @@
module github.com/mikestefanello/pagoda
module git.grosinger.net/tgrosinger/saasitone
go 1.22

View File

@ -2,7 +2,8 @@ package form
import (
"github.com/labstack/echo/v4"
"github.com/mikestefanello/pagoda/pkg/context"
"git.grosinger.net/tgrosinger/saasitone/pkg/context"
)
// Form represents a form that can be submitted and validated

View File

@ -4,10 +4,11 @@ import (
"testing"
"github.com/labstack/echo/v4"
"github.com/mikestefanello/pagoda/pkg/context"
"github.com/mikestefanello/pagoda/pkg/tests"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"git.grosinger.net/tgrosinger/saasitone/pkg/context"
"git.grosinger.net/tgrosinger/saasitone/pkg/tests"
)
type mockForm struct {

View File

@ -5,9 +5,9 @@ import (
"net/http"
"github.com/go-playground/validator/v10"
"github.com/mikestefanello/pagoda/pkg/context"
"github.com/labstack/echo/v4"
"git.grosinger.net/tgrosinger/saasitone/pkg/context"
)
// Submission represents the state of the submission of a form, not including the form itself.

View File

@ -8,9 +8,10 @@ import (
"github.com/go-playground/validator/v10"
"github.com/labstack/echo/v4"
"github.com/mikestefanello/pagoda/pkg/services"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
)
func TestFormSubmission(t *testing.T) {

View File

@ -9,13 +9,12 @@ import (
"github.com/Masterminds/sprig"
"github.com/labstack/echo/v4"
"github.com/labstack/gommon/random"
"github.com/mikestefanello/pagoda/config"
"git.grosinger.net/tgrosinger/saasitone/config"
)
var (
// CacheBuster stores a random string used as a cache buster for static files.
CacheBuster = random.String(10)
)
var CacheBuster = random.String(10)
type funcMap struct {
web *echo.Echo

View File

@ -5,9 +5,9 @@ import (
"testing"
"github.com/labstack/echo/v4"
"github.com/mikestefanello/pagoda/config"
"github.com/stretchr/testify/assert"
"git.grosinger.net/tgrosinger/saasitone/config"
)
func TestNewFuncMap(t *testing.T) {

View File

@ -6,17 +6,18 @@ import (
"github.com/go-playground/validator/v10"
"github.com/labstack/echo/v4"
"github.com/mikestefanello/pagoda/ent"
"github.com/mikestefanello/pagoda/ent/user"
"github.com/mikestefanello/pagoda/pkg/context"
"github.com/mikestefanello/pagoda/pkg/form"
"github.com/mikestefanello/pagoda/pkg/log"
"github.com/mikestefanello/pagoda/pkg/middleware"
"github.com/mikestefanello/pagoda/pkg/msg"
"github.com/mikestefanello/pagoda/pkg/page"
"github.com/mikestefanello/pagoda/pkg/redirect"
"github.com/mikestefanello/pagoda/pkg/services"
"github.com/mikestefanello/pagoda/templates"
"git.grosinger.net/tgrosinger/saasitone/ent"
"git.grosinger.net/tgrosinger/saasitone/ent/user"
"git.grosinger.net/tgrosinger/saasitone/pkg/context"
"git.grosinger.net/tgrosinger/saasitone/pkg/form"
"git.grosinger.net/tgrosinger/saasitone/pkg/log"
"git.grosinger.net/tgrosinger/saasitone/pkg/middleware"
"git.grosinger.net/tgrosinger/saasitone/pkg/msg"
"git.grosinger.net/tgrosinger/saasitone/pkg/page"
"git.grosinger.net/tgrosinger/saasitone/pkg/redirect"
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
"git.grosinger.net/tgrosinger/saasitone/templates"
)
const (
@ -159,7 +160,6 @@ func (h *Auth) ForgotPasswordSubmit(ctx echo.Context) error {
Subject("Reset your password").
Body(fmt.Sprintf("Go here to reset your password: %s", url)).
Send(ctx)
if err != nil {
return fail(err, "error sending password reset email")
}
@ -335,7 +335,6 @@ func (h *Auth) sendVerificationEmail(ctx echo.Context, usr *ent.User) {
Subject("Confirm your email address").
Body(fmt.Sprintf("Click here to confirm your email address: %s", url)).
Send(ctx)
if err != nil {
log.Ctx(ctx).Error("unable to send email verification link",
"user_id", usr.ID,
@ -384,7 +383,6 @@ func (h *Auth) ResetPasswordSubmit(ctx echo.Context) error {
Update().
SetPassword(hash).
Save(ctx.Request().Context())
if err != nil {
return fail(err, "unable to update password")
}
@ -429,7 +427,6 @@ func (h *Auth) VerifyEmail(ctx echo.Context) error {
Query().
Where(user.Email(email)).
Only(ctx.Request().Context())
if err != nil {
return fail(err, "query failed loading email verification token user")
}
@ -441,7 +438,6 @@ func (h *Auth) VerifyEmail(ctx echo.Context) error {
Update().
SetVerified(true).
Save(ctx.Request().Context())
if err != nil {
return fail(err, "failed to set user as verified")
}

View File

@ -2,12 +2,14 @@ package handlers
import (
"errors"
"github.com/labstack/echo/v4"
"github.com/mikestefanello/pagoda/pkg/form"
"github.com/mikestefanello/pagoda/pkg/page"
"github.com/mikestefanello/pagoda/pkg/services"
"github.com/mikestefanello/pagoda/templates"
"time"
"github.com/labstack/echo/v4"
"git.grosinger.net/tgrosinger/saasitone/pkg/form"
"git.grosinger.net/tgrosinger/saasitone/pkg/page"
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
"git.grosinger.net/tgrosinger/saasitone/templates"
)
const (
@ -81,7 +83,6 @@ func (h *Cache) Submit(ctx echo.Context) error {
Data(input.Value).
Expiration(30 * time.Minute).
Save(ctx.Request().Context())
if err != nil {
return fail(err, "unable to set cache")
}

View File

@ -2,12 +2,14 @@ package handlers
import (
"fmt"
"github.com/go-playground/validator/v10"
"github.com/labstack/echo/v4"
"github.com/mikestefanello/pagoda/pkg/form"
"github.com/mikestefanello/pagoda/pkg/page"
"github.com/mikestefanello/pagoda/pkg/services"
"github.com/mikestefanello/pagoda/templates"
"git.grosinger.net/tgrosinger/saasitone/pkg/form"
"git.grosinger.net/tgrosinger/saasitone/pkg/page"
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
"git.grosinger.net/tgrosinger/saasitone/templates"
)
const (
@ -73,7 +75,6 @@ func (h *Contact) Submit(ctx echo.Context) error {
Subject("Contact form submitted").
Body(fmt.Sprintf("The message is: %s", input.Message)).
Send(ctx)
if err != nil {
return fail(err, "unable to send email")
}

View File

@ -4,11 +4,12 @@ import (
"net/http"
"github.com/labstack/echo/v4"
"github.com/mikestefanello/pagoda/pkg/context"
"github.com/mikestefanello/pagoda/pkg/log"
"github.com/mikestefanello/pagoda/pkg/page"
"github.com/mikestefanello/pagoda/pkg/services"
"github.com/mikestefanello/pagoda/templates"
"git.grosinger.net/tgrosinger/saasitone/pkg/context"
"git.grosinger.net/tgrosinger/saasitone/pkg/log"
"git.grosinger.net/tgrosinger/saasitone/pkg/page"
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
"git.grosinger.net/tgrosinger/saasitone/templates"
)
type Error struct {

View File

@ -5,7 +5,8 @@ import (
"net/http"
"github.com/labstack/echo/v4"
"github.com/mikestefanello/pagoda/pkg/services"
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
)
var handlers []Handler

View File

@ -5,9 +5,10 @@ import (
"html/template"
"github.com/labstack/echo/v4"
"github.com/mikestefanello/pagoda/pkg/page"
"github.com/mikestefanello/pagoda/pkg/services"
"github.com/mikestefanello/pagoda/templates"
"git.grosinger.net/tgrosinger/saasitone/pkg/page"
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
"git.grosinger.net/tgrosinger/saasitone/templates"
)
const (

View File

@ -5,9 +5,10 @@ import (
"github.com/gorilla/sessions"
echomw "github.com/labstack/echo/v4/middleware"
"github.com/mikestefanello/pagoda/config"
"github.com/mikestefanello/pagoda/pkg/middleware"
"github.com/mikestefanello/pagoda/pkg/services"
"git.grosinger.net/tgrosinger/saasitone/config"
"git.grosinger.net/tgrosinger/saasitone/pkg/middleware"
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
)
// BuildRouter builds the router

View File

@ -8,13 +8,12 @@ import (
"os"
"testing"
"github.com/mikestefanello/pagoda/config"
"github.com/mikestefanello/pagoda/pkg/services"
"github.com/PuerkitoBio/goquery"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"git.grosinger.net/tgrosinger/saasitone/config"
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
)
var (

View File

@ -5,9 +5,10 @@ import (
"math/rand"
"github.com/labstack/echo/v4"
"github.com/mikestefanello/pagoda/pkg/page"
"github.com/mikestefanello/pagoda/pkg/services"
"github.com/mikestefanello/pagoda/templates"
"git.grosinger.net/tgrosinger/saasitone/pkg/page"
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
"git.grosinger.net/tgrosinger/saasitone/templates"
)
const routeNameSearch = "search"

View File

@ -2,16 +2,17 @@ package handlers
import (
"fmt"
"github.com/mikestefanello/pagoda/pkg/msg"
"time"
"github.com/go-playground/validator/v10"
"github.com/labstack/echo/v4"
"github.com/mikestefanello/pagoda/pkg/form"
"github.com/mikestefanello/pagoda/pkg/page"
"github.com/mikestefanello/pagoda/pkg/services"
"github.com/mikestefanello/pagoda/pkg/tasks"
"github.com/mikestefanello/pagoda/templates"
"git.grosinger.net/tgrosinger/saasitone/pkg/form"
"git.grosinger.net/tgrosinger/saasitone/pkg/msg"
"git.grosinger.net/tgrosinger/saasitone/pkg/page"
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
"git.grosinger.net/tgrosinger/saasitone/pkg/tasks"
"git.grosinger.net/tgrosinger/saasitone/templates"
)
const (
@ -76,7 +77,6 @@ func (h *Task) Submit(ctx echo.Context) error {
}).
Wait(time.Duration(input.Delay) * time.Second).
Save()
if err != nil {
return fail(err, "unable to create a task")
}

View File

@ -4,11 +4,10 @@ import (
"net/http"
"testing"
"github.com/mikestefanello/pagoda/pkg/tests"
"github.com/labstack/echo/v4"
"github.com/stretchr/testify/assert"
"github.com/labstack/echo/v4"
"git.grosinger.net/tgrosinger/saasitone/pkg/tests"
)
func TestSetRequest(t *testing.T) {

View File

@ -4,7 +4,8 @@ import (
"log/slog"
"github.com/labstack/echo/v4"
"github.com/mikestefanello/pagoda/pkg/context"
"git.grosinger.net/tgrosinger/saasitone/pkg/context"
)
// Set sets a logger in the context

View File

@ -4,8 +4,9 @@ import (
"testing"
"github.com/labstack/echo/v4"
"github.com/mikestefanello/pagoda/pkg/tests"
"github.com/stretchr/testify/assert"
"git.grosinger.net/tgrosinger/saasitone/pkg/tests"
)
func TestCtxSet(t *testing.T) {

View File

@ -5,13 +5,13 @@ import (
"net/http"
"strconv"
"github.com/mikestefanello/pagoda/ent"
"github.com/mikestefanello/pagoda/pkg/context"
"github.com/mikestefanello/pagoda/pkg/log"
"github.com/mikestefanello/pagoda/pkg/msg"
"github.com/mikestefanello/pagoda/pkg/services"
"github.com/labstack/echo/v4"
"git.grosinger.net/tgrosinger/saasitone/ent"
"git.grosinger.net/tgrosinger/saasitone/pkg/context"
"git.grosinger.net/tgrosinger/saasitone/pkg/log"
"git.grosinger.net/tgrosinger/saasitone/pkg/msg"
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
)
// LoadAuthenticatedUser loads the authenticated user, if one, and stores in context

View File

@ -5,13 +5,12 @@ import (
"net/http"
"testing"
"github.com/mikestefanello/pagoda/ent"
"github.com/mikestefanello/pagoda/pkg/context"
"github.com/mikestefanello/pagoda/pkg/tests"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/assert"
"git.grosinger.net/tgrosinger/saasitone/ent"
"git.grosinger.net/tgrosinger/saasitone/pkg/context"
"git.grosinger.net/tgrosinger/saasitone/pkg/tests"
)
func TestLoadAuthenticatedUser(t *testing.T) {

View File

@ -6,11 +6,11 @@ import (
"net/http"
"time"
"github.com/mikestefanello/pagoda/pkg/context"
"github.com/mikestefanello/pagoda/pkg/log"
"github.com/mikestefanello/pagoda/pkg/services"
"github.com/labstack/echo/v4"
"git.grosinger.net/tgrosinger/saasitone/pkg/context"
"git.grosinger.net/tgrosinger/saasitone/pkg/log"
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
)
// ServeCachedPage attempts to load a page from the cache by matching on the complete request URL
@ -31,7 +31,6 @@ func ServeCachedPage(t *services.TemplateRenderer) echo.MiddlewareFunc {
// Attempt to load from cache
page, err := t.GetCachedPage(ctx, ctx.Request().URL.String())
if err != nil {
switch {
case errors.Is(err, services.ErrCacheMiss):

View File

@ -5,13 +5,12 @@ import (
"testing"
"time"
"github.com/mikestefanello/pagoda/pkg/page"
"github.com/mikestefanello/pagoda/pkg/tests"
"github.com/mikestefanello/pagoda/templates"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/assert"
"git.grosinger.net/tgrosinger/saasitone/pkg/page"
"git.grosinger.net/tgrosinger/saasitone/pkg/tests"
"git.grosinger.net/tgrosinger/saasitone/templates"
)
func TestServeCachedPage(t *testing.T) {

View File

@ -5,11 +5,11 @@ import (
"net/http"
"strconv"
"github.com/mikestefanello/pagoda/ent"
"github.com/mikestefanello/pagoda/ent/user"
"github.com/mikestefanello/pagoda/pkg/context"
"github.com/labstack/echo/v4"
"git.grosinger.net/tgrosinger/saasitone/ent"
"git.grosinger.net/tgrosinger/saasitone/ent/user"
"git.grosinger.net/tgrosinger/saasitone/pkg/context"
)
// LoadUser loads the user based on the ID provided as a path parameter

View File

@ -4,12 +4,12 @@ import (
"fmt"
"testing"
"github.com/mikestefanello/pagoda/ent"
"github.com/mikestefanello/pagoda/pkg/context"
"github.com/mikestefanello/pagoda/pkg/tests"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"git.grosinger.net/tgrosinger/saasitone/ent"
"git.grosinger.net/tgrosinger/saasitone/pkg/context"
"git.grosinger.net/tgrosinger/saasitone/pkg/tests"
)
func TestLoadUser(t *testing.T) {

View File

@ -6,7 +6,8 @@ import (
"time"
"github.com/labstack/echo/v4"
"github.com/mikestefanello/pagoda/pkg/log"
"git.grosinger.net/tgrosinger/saasitone/pkg/log"
)
// SetLogger initializes a logger for the current request and stores it in the context.

View File

@ -7,11 +7,11 @@ import (
"github.com/labstack/echo/v4"
echomw "github.com/labstack/echo/v4/middleware"
"github.com/mikestefanello/pagoda/pkg/log"
"github.com/mikestefanello/pagoda/pkg/tests"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/assert"
"git.grosinger.net/tgrosinger/saasitone/pkg/log"
"git.grosinger.net/tgrosinger/saasitone/pkg/tests"
)
type mockLogHandler struct {

View File

@ -4,10 +4,10 @@ import (
"os"
"testing"
"github.com/mikestefanello/pagoda/config"
"github.com/mikestefanello/pagoda/ent"
"github.com/mikestefanello/pagoda/pkg/services"
"github.com/mikestefanello/pagoda/pkg/tests"
"git.grosinger.net/tgrosinger/saasitone/config"
"git.grosinger.net/tgrosinger/saasitone/ent"
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
"git.grosinger.net/tgrosinger/saasitone/pkg/tests"
)
var (

View File

@ -4,7 +4,8 @@ import (
"github.com/gorilla/context"
"github.com/gorilla/sessions"
"github.com/labstack/echo/v4"
"github.com/mikestefanello/pagoda/pkg/session"
"git.grosinger.net/tgrosinger/saasitone/pkg/session"
)
// Session sets the session storage in the request context

View File

@ -4,10 +4,11 @@ import (
"testing"
"github.com/gorilla/sessions"
"github.com/mikestefanello/pagoda/pkg/session"
"github.com/mikestefanello/pagoda/pkg/tests"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"git.grosinger.net/tgrosinger/saasitone/pkg/session"
"git.grosinger.net/tgrosinger/saasitone/pkg/tests"
)
func TestSession(t *testing.T) {

View File

@ -3,8 +3,9 @@ package msg
import (
"github.com/gorilla/sessions"
"github.com/labstack/echo/v4"
"github.com/mikestefanello/pagoda/pkg/log"
"github.com/mikestefanello/pagoda/pkg/session"
"git.grosinger.net/tgrosinger/saasitone/pkg/log"
"git.grosinger.net/tgrosinger/saasitone/pkg/session"
)
// Type is a message type

View File

@ -3,12 +3,11 @@ package msg
import (
"testing"
"github.com/mikestefanello/pagoda/pkg/tests"
"github.com/labstack/echo/v4"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/labstack/echo/v4"
"git.grosinger.net/tgrosinger/saasitone/pkg/tests"
)
func TestMsg(t *testing.T) {

View File

@ -5,15 +5,14 @@ import (
"net/http"
"time"
"github.com/mikestefanello/pagoda/ent"
"github.com/mikestefanello/pagoda/pkg/context"
"github.com/mikestefanello/pagoda/pkg/htmx"
"github.com/mikestefanello/pagoda/pkg/msg"
"github.com/mikestefanello/pagoda/templates"
"github.com/labstack/echo/v4"
echomw "github.com/labstack/echo/v4/middleware"
"github.com/labstack/echo/v4"
"git.grosinger.net/tgrosinger/saasitone/ent"
"git.grosinger.net/tgrosinger/saasitone/pkg/context"
"git.grosinger.net/tgrosinger/saasitone/pkg/htmx"
"git.grosinger.net/tgrosinger/saasitone/pkg/msg"
"git.grosinger.net/tgrosinger/saasitone/templates"
)
// Page consists of all data that will be used to render a page response for a given route.

View File

@ -5,13 +5,13 @@ import (
"testing"
"github.com/labstack/echo/v4"
"github.com/mikestefanello/pagoda/ent"
"github.com/mikestefanello/pagoda/pkg/context"
"github.com/mikestefanello/pagoda/pkg/msg"
"github.com/mikestefanello/pagoda/pkg/tests"
echomw "github.com/labstack/echo/v4/middleware"
"github.com/stretchr/testify/assert"
"git.grosinger.net/tgrosinger/saasitone/ent"
"git.grosinger.net/tgrosinger/saasitone/pkg/context"
"git.grosinger.net/tgrosinger/saasitone/pkg/msg"
"git.grosinger.net/tgrosinger/saasitone/pkg/tests"
)
func TestNew(t *testing.T) {

View File

@ -5,9 +5,9 @@ import (
"testing"
"github.com/labstack/echo/v4"
"github.com/mikestefanello/pagoda/pkg/tests"
"github.com/stretchr/testify/assert"
"git.grosinger.net/tgrosinger/saasitone/pkg/tests"
)
func TestNewPager(t *testing.T) {

View File

@ -7,7 +7,8 @@ import (
"net/url"
"github.com/labstack/echo/v4"
"github.com/mikestefanello/pagoda/pkg/htmx"
"git.grosinger.net/tgrosinger/saasitone/pkg/htmx"
)
// Redirect is a helper to perform HTTP redirects.

View File

@ -6,10 +6,11 @@ import (
"testing"
"github.com/labstack/echo/v4"
"github.com/mikestefanello/pagoda/pkg/htmx"
"github.com/mikestefanello/pagoda/pkg/tests"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"git.grosinger.net/tgrosinger/saasitone/pkg/htmx"
"git.grosinger.net/tgrosinger/saasitone/pkg/tests"
)
func TestRedirect(t *testing.T) {

View File

@ -8,15 +8,15 @@ import (
"time"
"github.com/golang-jwt/jwt"
"github.com/mikestefanello/pagoda/config"
"github.com/mikestefanello/pagoda/ent"
"github.com/mikestefanello/pagoda/ent/passwordtoken"
"github.com/mikestefanello/pagoda/ent/user"
"github.com/mikestefanello/pagoda/pkg/context"
"github.com/mikestefanello/pagoda/pkg/session"
"github.com/labstack/echo/v4"
"golang.org/x/crypto/bcrypt"
"git.grosinger.net/tgrosinger/saasitone/config"
"git.grosinger.net/tgrosinger/saasitone/ent"
"git.grosinger.net/tgrosinger/saasitone/ent/passwordtoken"
"git.grosinger.net/tgrosinger/saasitone/ent/user"
"git.grosinger.net/tgrosinger/saasitone/pkg/context"
"git.grosinger.net/tgrosinger/saasitone/pkg/session"
)
const (
@ -220,7 +220,6 @@ func (c *AuthClient) ValidateEmailVerificationToken(token string) (string, error
return []byte(c.config.App.EncryptionKey), nil
})
if err != nil {
return "", err
}

View File

@ -6,12 +6,11 @@ import (
"testing"
"time"
"github.com/mikestefanello/pagoda/ent/passwordtoken"
"github.com/mikestefanello/pagoda/ent/user"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/assert"
"git.grosinger.net/tgrosinger/saasitone/ent/passwordtoken"
"git.grosinger.net/tgrosinger/saasitone/ent/user"
)
func TestAuthClient_Auth(t *testing.T) {

View File

@ -9,15 +9,13 @@ import (
"strings"
entsql "entgo.io/ent/dialect/sql"
_ "github.com/mattn/go-sqlite3"
"github.com/mikestefanello/pagoda/pkg/funcmap"
"github.com/labstack/echo/v4"
"github.com/mikestefanello/pagoda/config"
"github.com/mikestefanello/pagoda/ent"
_ "github.com/mattn/go-sqlite3"
// Require by ent
_ "github.com/mikestefanello/pagoda/ent/runtime"
"git.grosinger.net/tgrosinger/saasitone/config"
"git.grosinger.net/tgrosinger/saasitone/ent"
_ "git.grosinger.net/tgrosinger/saasitone/ent/runtime" // Require by ent
"git.grosinger.net/tgrosinger/saasitone/pkg/funcmap"
)
// Container contains all services used by the application and provides an easy way to handle dependency

View File

@ -4,10 +4,10 @@ import (
"errors"
"fmt"
"github.com/mikestefanello/pagoda/config"
"github.com/mikestefanello/pagoda/pkg/log"
"github.com/labstack/echo/v4"
"git.grosinger.net/tgrosinger/saasitone/config"
"git.grosinger.net/tgrosinger/saasitone/pkg/log"
)
type (
@ -75,7 +75,6 @@ func (m *MailClient) send(email *mail, ctx echo.Context) error {
Base(email.template).
Files(fmt.Sprintf("emails/%s", email.template)).
Execute(email.templateData)
if err != nil {
return err
}

View File

@ -4,11 +4,11 @@ import (
"os"
"testing"
"github.com/mikestefanello/pagoda/config"
"github.com/mikestefanello/pagoda/ent"
"github.com/mikestefanello/pagoda/pkg/tests"
"github.com/labstack/echo/v4"
"git.grosinger.net/tgrosinger/saasitone/config"
"git.grosinger.net/tgrosinger/saasitone/ent"
"git.grosinger.net/tgrosinger/saasitone/pkg/tests"
)
var (

View File

@ -11,8 +11,9 @@ import (
"github.com/maragudk/goqite"
"github.com/maragudk/goqite/jobs"
"github.com/mikestefanello/pagoda/config"
"github.com/mikestefanello/pagoda/pkg/log"
"git.grosinger.net/tgrosinger/saasitone/config"
"git.grosinger.net/tgrosinger/saasitone/pkg/log"
)
type (

View File

@ -10,11 +10,12 @@ import (
"sync"
"github.com/labstack/echo/v4"
"github.com/mikestefanello/pagoda/config"
"github.com/mikestefanello/pagoda/pkg/context"
"github.com/mikestefanello/pagoda/pkg/log"
"github.com/mikestefanello/pagoda/pkg/page"
"github.com/mikestefanello/pagoda/templates"
"git.grosinger.net/tgrosinger/saasitone/config"
"git.grosinger.net/tgrosinger/saasitone/pkg/context"
"git.grosinger.net/tgrosinger/saasitone/pkg/log"
"git.grosinger.net/tgrosinger/saasitone/pkg/page"
"git.grosinger.net/tgrosinger/saasitone/templates"
)
// cachedPageGroup stores the cache group for cached pages
@ -138,7 +139,6 @@ func (t *TemplateRenderer) RenderPage(ctx echo.Context, page page.Page) error {
).
Directories("components").
Execute(page)
if err != nil {
return echo.NewHTTPError(
http.StatusInternalServerError,
@ -218,7 +218,6 @@ func (t *TemplateRenderer) GetCachedPage(ctx echo.Context, url string) (*CachedP
Group(cachedPageGroup).
Key(url).
Fetch(ctx.Request().Context())
if err != nil {
return nil, err
}

View File

@ -8,14 +8,14 @@ import (
"testing"
"github.com/labstack/echo/v4"
"github.com/mikestefanello/pagoda/config"
"github.com/mikestefanello/pagoda/pkg/htmx"
"github.com/mikestefanello/pagoda/pkg/page"
"github.com/mikestefanello/pagoda/pkg/tests"
"github.com/mikestefanello/pagoda/templates"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"git.grosinger.net/tgrosinger/saasitone/config"
"git.grosinger.net/tgrosinger/saasitone/pkg/htmx"
"git.grosinger.net/tgrosinger/saasitone/pkg/page"
"git.grosinger.net/tgrosinger/saasitone/pkg/tests"
"git.grosinger.net/tgrosinger/saasitone/templates"
)
func TestTemplateRenderer(t *testing.T) {

View File

@ -3,9 +3,9 @@ package session
import (
"errors"
"git.grosinger.net/tgrosinger/saasitone/pkg/context"
"github.com/gorilla/sessions"
"github.com/labstack/echo/v4"
"github.com/mikestefanello/pagoda/pkg/context"
)
// ErrStoreNotFound indicates that the session store was not present in the context

View File

@ -3,8 +3,8 @@ package tasks
import (
"context"
"github.com/mikestefanello/pagoda/pkg/log"
"github.com/mikestefanello/pagoda/pkg/services"
"git.grosinger.net/tgrosinger/saasitone/pkg/log"
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
)
// ExampleTask is an example implementation of services.Task

View File

@ -1,7 +1,7 @@
package tasks
import (
"github.com/mikestefanello/pagoda/pkg/services"
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
)
// Register registers all task queues with the task client

View File

@ -10,14 +10,14 @@ import (
"testing"
"time"
"github.com/mikestefanello/pagoda/ent"
"github.com/mikestefanello/pagoda/pkg/session"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/gorilla/sessions"
"github.com/labstack/echo/v4"
"git.grosinger.net/tgrosinger/saasitone/ent"
"git.grosinger.net/tgrosinger/saasitone/pkg/session"
)
// NewContext creates a new Echo context for tests using an HTTP test request and response recorder