Rename package
This commit is contained in:
parent
02544da725
commit
d08f5f55aa
@ -11,9 +11,9 @@ import (
|
|||||||
"os/signal"
|
"os/signal"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/mikestefanello/pagoda/pkg/handlers"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/handlers"
|
||||||
"github.com/mikestefanello/pagoda/pkg/services"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
|
||||||
"github.com/mikestefanello/pagoda/pkg/tasks"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/tasks"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -9,14 +9,14 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"github.com/mikestefanello/pagoda/ent/migrate"
|
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/dialect"
|
"entgo.io/ent/dialect"
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"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.
|
// Client is the client that holds all ent builders.
|
||||||
|
@ -12,8 +12,9 @@ import (
|
|||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"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.
|
// ent aliases to avoid import conflicts in user's code.
|
||||||
|
@ -5,12 +5,11 @@ package enttest
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/mikestefanello/pagoda/ent"
|
|
||||||
// required by schema hooks.
|
|
||||||
_ "github.com/mikestefanello/pagoda/ent/runtime"
|
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql/schema"
|
"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 (
|
type (
|
||||||
@ -71,6 +70,7 @@ func NewClient(t TestingT, opts ...Option) *ent.Client {
|
|||||||
migrateSchema(t, c, o)
|
migrateSchema(t, c, o)
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
func migrateSchema(t TestingT, c *ent.Client, o *options) {
|
func migrateSchema(t TestingT, c *ent.Client, o *options) {
|
||||||
tables, err := schema.CopyTables(migrate.Tables)
|
tables, err := schema.CopyTables(migrate.Tables)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/mikestefanello/pagoda/ent"
|
"git.grosinger.net/tgrosinger/saasitone/ent"
|
||||||
)
|
)
|
||||||
|
|
||||||
// The PasswordTokenFunc type is an adapter to allow the use of ordinary
|
// The PasswordTokenFunc type is an adapter to allow the use of ordinary
|
||||||
|
@ -11,9 +11,10 @@ import (
|
|||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"github.com/mikestefanello/pagoda/ent/passwordtoken"
|
|
||||||
"github.com/mikestefanello/pagoda/ent/predicate"
|
"git.grosinger.net/tgrosinger/saasitone/ent/passwordtoken"
|
||||||
"github.com/mikestefanello/pagoda/ent/user"
|
"git.grosinger.net/tgrosinger/saasitone/ent/predicate"
|
||||||
|
"git.grosinger.net/tgrosinger/saasitone/ent/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -9,8 +9,9 @@ import (
|
|||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/dialect/sql"
|
"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.
|
// PasswordToken is the model entity for the PasswordToken schema.
|
||||||
|
@ -7,7 +7,8 @@ import (
|
|||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"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.
|
// ID filters vertices based on their ID field.
|
||||||
|
@ -10,8 +10,9 @@ import (
|
|||||||
|
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"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.
|
// PasswordTokenCreate is the builder for creating a PasswordToken entity.
|
||||||
|
@ -8,8 +8,9 @@ import (
|
|||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"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.
|
// PasswordTokenDelete is the builder for deleting a PasswordToken entity.
|
||||||
|
@ -10,9 +10,10 @@ import (
|
|||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/mikestefanello/pagoda/ent/passwordtoken"
|
|
||||||
"github.com/mikestefanello/pagoda/ent/predicate"
|
"git.grosinger.net/tgrosinger/saasitone/ent/passwordtoken"
|
||||||
"github.com/mikestefanello/pagoda/ent/user"
|
"git.grosinger.net/tgrosinger/saasitone/ent/predicate"
|
||||||
|
"git.grosinger.net/tgrosinger/saasitone/ent/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PasswordTokenQuery is the builder for querying PasswordToken entities.
|
// PasswordTokenQuery is the builder for querying PasswordToken entities.
|
||||||
|
@ -11,9 +11,10 @@ import (
|
|||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/mikestefanello/pagoda/ent/passwordtoken"
|
|
||||||
"github.com/mikestefanello/pagoda/ent/predicate"
|
"git.grosinger.net/tgrosinger/saasitone/ent/passwordtoken"
|
||||||
"github.com/mikestefanello/pagoda/ent/user"
|
"git.grosinger.net/tgrosinger/saasitone/ent/predicate"
|
||||||
|
"git.grosinger.net/tgrosinger/saasitone/ent/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PasswordTokenUpdate is the builder for updating PasswordToken entities.
|
// PasswordTokenUpdate is the builder for updating PasswordToken entities.
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
package ent
|
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
|
||||||
|
@ -5,9 +5,9 @@ package runtime
|
|||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/mikestefanello/pagoda/ent/passwordtoken"
|
"git.grosinger.net/tgrosinger/saasitone/ent/passwordtoken"
|
||||||
"github.com/mikestefanello/pagoda/ent/schema"
|
"git.grosinger.net/tgrosinger/saasitone/ent/schema"
|
||||||
"github.com/mikestefanello/pagoda/ent/user"
|
"git.grosinger.net/tgrosinger/saasitone/ent/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// The init function reads all schema descriptors with runtime code
|
// The init function reads all schema descriptors with runtime code
|
||||||
|
@ -5,12 +5,12 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
ge "github.com/mikestefanello/pagoda/ent"
|
|
||||||
"github.com/mikestefanello/pagoda/ent/hook"
|
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/schema/edge"
|
"entgo.io/ent/schema/edge"
|
||||||
"entgo.io/ent/schema/field"
|
"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.
|
// User holds the schema definition for the User entity.
|
||||||
|
@ -9,7 +9,8 @@ import (
|
|||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/dialect/sql"
|
"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.
|
// User is the model entity for the User schema.
|
||||||
|
@ -62,7 +62,7 @@ func ValidColumn(column string) bool {
|
|||||||
// package on the initialization of the application. Therefore,
|
// package on the initialization of the application. Therefore,
|
||||||
// it should be imported in the main as follows:
|
// 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 (
|
var (
|
||||||
Hooks [1]ent.Hook
|
Hooks [1]ent.Hook
|
||||||
// NameValidator is a validator for the "name" field. It is called by the builders before save.
|
// 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...)...)
|
sqlgraph.OrderByNeighborTerms(s, newOwnerStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func newOwnerStep() *sqlgraph.Step {
|
func newOwnerStep() *sqlgraph.Step {
|
||||||
return sqlgraph.NewStep(
|
return sqlgraph.NewStep(
|
||||||
sqlgraph.From(Table, FieldID),
|
sqlgraph.From(Table, FieldID),
|
||||||
|
@ -7,7 +7,8 @@ import (
|
|||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"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.
|
// ID filters vertices based on their ID field.
|
||||||
|
@ -10,8 +10,9 @@ import (
|
|||||||
|
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"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.
|
// UserCreate is the builder for creating a User entity.
|
||||||
|
@ -8,8 +8,9 @@ import (
|
|||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"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.
|
// UserDelete is the builder for deleting a User entity.
|
||||||
|
@ -11,9 +11,10 @@ import (
|
|||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/mikestefanello/pagoda/ent/passwordtoken"
|
|
||||||
"github.com/mikestefanello/pagoda/ent/predicate"
|
"git.grosinger.net/tgrosinger/saasitone/ent/passwordtoken"
|
||||||
"github.com/mikestefanello/pagoda/ent/user"
|
"git.grosinger.net/tgrosinger/saasitone/ent/predicate"
|
||||||
|
"git.grosinger.net/tgrosinger/saasitone/ent/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserQuery is the builder for querying User entities.
|
// UserQuery is the builder for querying User entities.
|
||||||
|
@ -10,9 +10,10 @@ import (
|
|||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/mikestefanello/pagoda/ent/passwordtoken"
|
|
||||||
"github.com/mikestefanello/pagoda/ent/predicate"
|
"git.grosinger.net/tgrosinger/saasitone/ent/passwordtoken"
|
||||||
"github.com/mikestefanello/pagoda/ent/user"
|
"git.grosinger.net/tgrosinger/saasitone/ent/predicate"
|
||||||
|
"git.grosinger.net/tgrosinger/saasitone/ent/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserUpdate is the builder for updating User entities.
|
// UserUpdate is the builder for updating User entities.
|
||||||
|
2
go.mod
2
go.mod
@ -1,4 +1,4 @@
|
|||||||
module github.com/mikestefanello/pagoda
|
module git.grosinger.net/tgrosinger/saasitone
|
||||||
|
|
||||||
go 1.22
|
go 1.22
|
||||||
|
|
||||||
|
@ -2,7 +2,8 @@ package form
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/labstack/echo/v4"
|
"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
|
// Form represents a form that can be submitted and validated
|
||||||
|
@ -4,10 +4,11 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"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/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
|
"git.grosinger.net/tgrosinger/saasitone/pkg/context"
|
||||||
|
"git.grosinger.net/tgrosinger/saasitone/pkg/tests"
|
||||||
)
|
)
|
||||||
|
|
||||||
type mockForm struct {
|
type mockForm struct {
|
||||||
|
@ -5,9 +5,9 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/go-playground/validator/v10"
|
"github.com/go-playground/validator/v10"
|
||||||
"github.com/mikestefanello/pagoda/pkg/context"
|
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"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.
|
// Submission represents the state of the submission of a form, not including the form itself.
|
||||||
|
@ -8,9 +8,10 @@ import (
|
|||||||
|
|
||||||
"github.com/go-playground/validator/v10"
|
"github.com/go-playground/validator/v10"
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/mikestefanello/pagoda/pkg/services"
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
|
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFormSubmission(t *testing.T) {
|
func TestFormSubmission(t *testing.T) {
|
||||||
|
@ -9,13 +9,12 @@ import (
|
|||||||
"github.com/Masterminds/sprig"
|
"github.com/Masterminds/sprig"
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/labstack/gommon/random"
|
"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 stores a random string used as a cache buster for static files.
|
var CacheBuster = random.String(10)
|
||||||
CacheBuster = random.String(10)
|
|
||||||
)
|
|
||||||
|
|
||||||
type funcMap struct {
|
type funcMap struct {
|
||||||
web *echo.Echo
|
web *echo.Echo
|
||||||
|
@ -5,9 +5,9 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/mikestefanello/pagoda/config"
|
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
|
"git.grosinger.net/tgrosinger/saasitone/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNewFuncMap(t *testing.T) {
|
func TestNewFuncMap(t *testing.T) {
|
||||||
|
@ -6,17 +6,18 @@ import (
|
|||||||
|
|
||||||
"github.com/go-playground/validator/v10"
|
"github.com/go-playground/validator/v10"
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/mikestefanello/pagoda/ent"
|
|
||||||
"github.com/mikestefanello/pagoda/ent/user"
|
"git.grosinger.net/tgrosinger/saasitone/ent"
|
||||||
"github.com/mikestefanello/pagoda/pkg/context"
|
"git.grosinger.net/tgrosinger/saasitone/ent/user"
|
||||||
"github.com/mikestefanello/pagoda/pkg/form"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/context"
|
||||||
"github.com/mikestefanello/pagoda/pkg/log"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/form"
|
||||||
"github.com/mikestefanello/pagoda/pkg/middleware"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/log"
|
||||||
"github.com/mikestefanello/pagoda/pkg/msg"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/middleware"
|
||||||
"github.com/mikestefanello/pagoda/pkg/page"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/msg"
|
||||||
"github.com/mikestefanello/pagoda/pkg/redirect"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/page"
|
||||||
"github.com/mikestefanello/pagoda/pkg/services"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/redirect"
|
||||||
"github.com/mikestefanello/pagoda/templates"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
|
||||||
|
"git.grosinger.net/tgrosinger/saasitone/templates"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -159,7 +160,6 @@ func (h *Auth) ForgotPasswordSubmit(ctx echo.Context) error {
|
|||||||
Subject("Reset your password").
|
Subject("Reset your password").
|
||||||
Body(fmt.Sprintf("Go here to reset your password: %s", url)).
|
Body(fmt.Sprintf("Go here to reset your password: %s", url)).
|
||||||
Send(ctx)
|
Send(ctx)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fail(err, "error sending password reset email")
|
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").
|
Subject("Confirm your email address").
|
||||||
Body(fmt.Sprintf("Click here to confirm your email address: %s", url)).
|
Body(fmt.Sprintf("Click here to confirm your email address: %s", url)).
|
||||||
Send(ctx)
|
Send(ctx)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Ctx(ctx).Error("unable to send email verification link",
|
log.Ctx(ctx).Error("unable to send email verification link",
|
||||||
"user_id", usr.ID,
|
"user_id", usr.ID,
|
||||||
@ -384,7 +383,6 @@ func (h *Auth) ResetPasswordSubmit(ctx echo.Context) error {
|
|||||||
Update().
|
Update().
|
||||||
SetPassword(hash).
|
SetPassword(hash).
|
||||||
Save(ctx.Request().Context())
|
Save(ctx.Request().Context())
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fail(err, "unable to update password")
|
return fail(err, "unable to update password")
|
||||||
}
|
}
|
||||||
@ -429,7 +427,6 @@ func (h *Auth) VerifyEmail(ctx echo.Context) error {
|
|||||||
Query().
|
Query().
|
||||||
Where(user.Email(email)).
|
Where(user.Email(email)).
|
||||||
Only(ctx.Request().Context())
|
Only(ctx.Request().Context())
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fail(err, "query failed loading email verification token user")
|
return fail(err, "query failed loading email verification token user")
|
||||||
}
|
}
|
||||||
@ -441,7 +438,6 @@ func (h *Auth) VerifyEmail(ctx echo.Context) error {
|
|||||||
Update().
|
Update().
|
||||||
SetVerified(true).
|
SetVerified(true).
|
||||||
Save(ctx.Request().Context())
|
Save(ctx.Request().Context())
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fail(err, "failed to set user as verified")
|
return fail(err, "failed to set user as verified")
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,14 @@ package handlers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"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"
|
"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 (
|
const (
|
||||||
@ -81,7 +83,6 @@ func (h *Cache) Submit(ctx echo.Context) error {
|
|||||||
Data(input.Value).
|
Data(input.Value).
|
||||||
Expiration(30 * time.Minute).
|
Expiration(30 * time.Minute).
|
||||||
Save(ctx.Request().Context())
|
Save(ctx.Request().Context())
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fail(err, "unable to set cache")
|
return fail(err, "unable to set cache")
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,14 @@ package handlers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/go-playground/validator/v10"
|
"github.com/go-playground/validator/v10"
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/mikestefanello/pagoda/pkg/form"
|
|
||||||
"github.com/mikestefanello/pagoda/pkg/page"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/form"
|
||||||
"github.com/mikestefanello/pagoda/pkg/services"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/page"
|
||||||
"github.com/mikestefanello/pagoda/templates"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
|
||||||
|
"git.grosinger.net/tgrosinger/saasitone/templates"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -73,7 +75,6 @@ func (h *Contact) Submit(ctx echo.Context) error {
|
|||||||
Subject("Contact form submitted").
|
Subject("Contact form submitted").
|
||||||
Body(fmt.Sprintf("The message is: %s", input.Message)).
|
Body(fmt.Sprintf("The message is: %s", input.Message)).
|
||||||
Send(ctx)
|
Send(ctx)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fail(err, "unable to send email")
|
return fail(err, "unable to send email")
|
||||||
}
|
}
|
||||||
|
@ -4,11 +4,12 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/mikestefanello/pagoda/pkg/context"
|
|
||||||
"github.com/mikestefanello/pagoda/pkg/log"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/context"
|
||||||
"github.com/mikestefanello/pagoda/pkg/page"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/log"
|
||||||
"github.com/mikestefanello/pagoda/pkg/services"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/page"
|
||||||
"github.com/mikestefanello/pagoda/templates"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
|
||||||
|
"git.grosinger.net/tgrosinger/saasitone/templates"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Error struct {
|
type Error struct {
|
||||||
|
@ -5,7 +5,8 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/mikestefanello/pagoda/pkg/services"
|
|
||||||
|
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
|
||||||
)
|
)
|
||||||
|
|
||||||
var handlers []Handler
|
var handlers []Handler
|
||||||
|
@ -5,9 +5,10 @@ import (
|
|||||||
"html/template"
|
"html/template"
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/mikestefanello/pagoda/pkg/page"
|
|
||||||
"github.com/mikestefanello/pagoda/pkg/services"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/page"
|
||||||
"github.com/mikestefanello/pagoda/templates"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
|
||||||
|
"git.grosinger.net/tgrosinger/saasitone/templates"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -5,9 +5,10 @@ import (
|
|||||||
|
|
||||||
"github.com/gorilla/sessions"
|
"github.com/gorilla/sessions"
|
||||||
echomw "github.com/labstack/echo/v4/middleware"
|
echomw "github.com/labstack/echo/v4/middleware"
|
||||||
"github.com/mikestefanello/pagoda/config"
|
|
||||||
"github.com/mikestefanello/pagoda/pkg/middleware"
|
"git.grosinger.net/tgrosinger/saasitone/config"
|
||||||
"github.com/mikestefanello/pagoda/pkg/services"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/middleware"
|
||||||
|
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
|
||||||
)
|
)
|
||||||
|
|
||||||
// BuildRouter builds the router
|
// BuildRouter builds the router
|
||||||
|
@ -8,13 +8,12 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/mikestefanello/pagoda/config"
|
|
||||||
"github.com/mikestefanello/pagoda/pkg/services"
|
|
||||||
|
|
||||||
"github.com/PuerkitoBio/goquery"
|
"github.com/PuerkitoBio/goquery"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
|
"git.grosinger.net/tgrosinger/saasitone/config"
|
||||||
|
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -5,9 +5,10 @@ import (
|
|||||||
"math/rand"
|
"math/rand"
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/mikestefanello/pagoda/pkg/page"
|
|
||||||
"github.com/mikestefanello/pagoda/pkg/services"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/page"
|
||||||
"github.com/mikestefanello/pagoda/templates"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
|
||||||
|
"git.grosinger.net/tgrosinger/saasitone/templates"
|
||||||
)
|
)
|
||||||
|
|
||||||
const routeNameSearch = "search"
|
const routeNameSearch = "search"
|
||||||
|
@ -2,16 +2,17 @@ package handlers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/mikestefanello/pagoda/pkg/msg"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/go-playground/validator/v10"
|
"github.com/go-playground/validator/v10"
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/mikestefanello/pagoda/pkg/form"
|
|
||||||
"github.com/mikestefanello/pagoda/pkg/page"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/form"
|
||||||
"github.com/mikestefanello/pagoda/pkg/services"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/msg"
|
||||||
"github.com/mikestefanello/pagoda/pkg/tasks"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/page"
|
||||||
"github.com/mikestefanello/pagoda/templates"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
|
||||||
|
"git.grosinger.net/tgrosinger/saasitone/pkg/tasks"
|
||||||
|
"git.grosinger.net/tgrosinger/saasitone/templates"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -76,7 +77,6 @@ func (h *Task) Submit(ctx echo.Context) error {
|
|||||||
}).
|
}).
|
||||||
Wait(time.Duration(input.Delay) * time.Second).
|
Wait(time.Duration(input.Delay) * time.Second).
|
||||||
Save()
|
Save()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fail(err, "unable to create a task")
|
return fail(err, "unable to create a task")
|
||||||
}
|
}
|
||||||
|
@ -4,11 +4,10 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/mikestefanello/pagoda/pkg/tests"
|
"github.com/labstack/echo/v4"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/tests"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSetRequest(t *testing.T) {
|
func TestSetRequest(t *testing.T) {
|
||||||
|
@ -4,7 +4,8 @@ import (
|
|||||||
"log/slog"
|
"log/slog"
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"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
|
// Set sets a logger in the context
|
||||||
|
@ -4,8 +4,9 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/mikestefanello/pagoda/pkg/tests"
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
|
"git.grosinger.net/tgrosinger/saasitone/pkg/tests"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCtxSet(t *testing.T) {
|
func TestCtxSet(t *testing.T) {
|
||||||
|
@ -5,13 +5,13 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"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"
|
"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
|
// LoadAuthenticatedUser loads the authenticated user, if one, and stores in context
|
||||||
|
@ -5,13 +5,12 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/mikestefanello/pagoda/ent"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/mikestefanello/pagoda/pkg/context"
|
|
||||||
"github.com/mikestefanello/pagoda/pkg/tests"
|
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"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) {
|
func TestLoadAuthenticatedUser(t *testing.T) {
|
||||||
|
@ -6,11 +6,11 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/mikestefanello/pagoda/pkg/context"
|
|
||||||
"github.com/mikestefanello/pagoda/pkg/log"
|
|
||||||
"github.com/mikestefanello/pagoda/pkg/services"
|
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"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
|
// 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
|
// Attempt to load from cache
|
||||||
page, err := t.GetCachedPage(ctx, ctx.Request().URL.String())
|
page, err := t.GetCachedPage(ctx, ctx.Request().URL.String())
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
switch {
|
switch {
|
||||||
case errors.Is(err, services.ErrCacheMiss):
|
case errors.Is(err, services.ErrCacheMiss):
|
||||||
|
@ -5,13 +5,12 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/mikestefanello/pagoda/pkg/page"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/mikestefanello/pagoda/pkg/tests"
|
|
||||||
"github.com/mikestefanello/pagoda/templates"
|
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"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) {
|
func TestServeCachedPage(t *testing.T) {
|
||||||
|
@ -5,11 +5,11 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/mikestefanello/pagoda/ent"
|
|
||||||
"github.com/mikestefanello/pagoda/ent/user"
|
|
||||||
"github.com/mikestefanello/pagoda/pkg/context"
|
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"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
|
// LoadUser loads the user based on the ID provided as a path parameter
|
||||||
|
@ -4,12 +4,12 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"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/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"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) {
|
func TestLoadUser(t *testing.T) {
|
||||||
|
@ -6,7 +6,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"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.
|
// SetLogger initializes a logger for the current request and stores it in the context.
|
||||||
|
@ -7,11 +7,11 @@ import (
|
|||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
echomw "github.com/labstack/echo/v4/middleware"
|
echomw "github.com/labstack/echo/v4/middleware"
|
||||||
"github.com/mikestefanello/pagoda/pkg/log"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/mikestefanello/pagoda/pkg/tests"
|
|
||||||
"github.com/stretchr/testify/require"
|
"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 {
|
type mockLogHandler struct {
|
||||||
|
@ -4,10 +4,10 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/mikestefanello/pagoda/config"
|
"git.grosinger.net/tgrosinger/saasitone/config"
|
||||||
"github.com/mikestefanello/pagoda/ent"
|
"git.grosinger.net/tgrosinger/saasitone/ent"
|
||||||
"github.com/mikestefanello/pagoda/pkg/services"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
|
||||||
"github.com/mikestefanello/pagoda/pkg/tests"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/tests"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -4,7 +4,8 @@ import (
|
|||||||
"github.com/gorilla/context"
|
"github.com/gorilla/context"
|
||||||
"github.com/gorilla/sessions"
|
"github.com/gorilla/sessions"
|
||||||
"github.com/labstack/echo/v4"
|
"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
|
// Session sets the session storage in the request context
|
||||||
|
@ -4,10 +4,11 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/gorilla/sessions"
|
"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/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
|
"git.grosinger.net/tgrosinger/saasitone/pkg/session"
|
||||||
|
"git.grosinger.net/tgrosinger/saasitone/pkg/tests"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSession(t *testing.T) {
|
func TestSession(t *testing.T) {
|
||||||
|
@ -3,8 +3,9 @@ package msg
|
|||||||
import (
|
import (
|
||||||
"github.com/gorilla/sessions"
|
"github.com/gorilla/sessions"
|
||||||
"github.com/labstack/echo/v4"
|
"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
|
// Type is a message type
|
||||||
|
@ -3,12 +3,11 @@ package msg
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/mikestefanello/pagoda/pkg/tests"
|
"github.com/labstack/echo/v4"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/tests"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMsg(t *testing.T) {
|
func TestMsg(t *testing.T) {
|
||||||
|
@ -5,15 +5,14 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/mikestefanello/pagoda/ent"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/mikestefanello/pagoda/pkg/context"
|
|
||||||
"github.com/mikestefanello/pagoda/pkg/htmx"
|
|
||||||
"github.com/mikestefanello/pagoda/pkg/msg"
|
|
||||||
"github.com/mikestefanello/pagoda/templates"
|
|
||||||
|
|
||||||
echomw "github.com/labstack/echo/v4/middleware"
|
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.
|
// Page consists of all data that will be used to render a page response for a given route.
|
||||||
|
@ -5,13 +5,13 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"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"
|
echomw "github.com/labstack/echo/v4/middleware"
|
||||||
"github.com/stretchr/testify/assert"
|
"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) {
|
func TestNew(t *testing.T) {
|
||||||
|
@ -5,9 +5,9 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/mikestefanello/pagoda/pkg/tests"
|
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
|
"git.grosinger.net/tgrosinger/saasitone/pkg/tests"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNewPager(t *testing.T) {
|
func TestNewPager(t *testing.T) {
|
||||||
|
@ -7,7 +7,8 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"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.
|
// Redirect is a helper to perform HTTP redirects.
|
||||||
|
@ -6,10 +6,11 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"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/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
|
"git.grosinger.net/tgrosinger/saasitone/pkg/htmx"
|
||||||
|
"git.grosinger.net/tgrosinger/saasitone/pkg/tests"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRedirect(t *testing.T) {
|
func TestRedirect(t *testing.T) {
|
||||||
|
@ -8,15 +8,15 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang-jwt/jwt"
|
"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"
|
"github.com/labstack/echo/v4"
|
||||||
"golang.org/x/crypto/bcrypt"
|
"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 (
|
const (
|
||||||
@ -220,7 +220,6 @@ func (c *AuthClient) ValidateEmailVerificationToken(token string) (string, error
|
|||||||
|
|
||||||
return []byte(c.config.App.EncryptionKey), nil
|
return []byte(c.config.App.EncryptionKey), nil
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
@ -6,12 +6,11 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/mikestefanello/pagoda/ent/passwordtoken"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/mikestefanello/pagoda/ent/user"
|
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"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) {
|
func TestAuthClient_Auth(t *testing.T) {
|
||||||
|
@ -9,15 +9,13 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
entsql "entgo.io/ent/dialect/sql"
|
entsql "entgo.io/ent/dialect/sql"
|
||||||
_ "github.com/mattn/go-sqlite3"
|
|
||||||
"github.com/mikestefanello/pagoda/pkg/funcmap"
|
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/mikestefanello/pagoda/config"
|
_ "github.com/mattn/go-sqlite3"
|
||||||
"github.com/mikestefanello/pagoda/ent"
|
|
||||||
|
|
||||||
// Require by ent
|
"git.grosinger.net/tgrosinger/saasitone/config"
|
||||||
_ "github.com/mikestefanello/pagoda/ent/runtime"
|
"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
|
// Container contains all services used by the application and provides an easy way to handle dependency
|
||||||
|
@ -4,10 +4,10 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/mikestefanello/pagoda/config"
|
|
||||||
"github.com/mikestefanello/pagoda/pkg/log"
|
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
|
|
||||||
|
"git.grosinger.net/tgrosinger/saasitone/config"
|
||||||
|
"git.grosinger.net/tgrosinger/saasitone/pkg/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
@ -75,7 +75,6 @@ func (m *MailClient) send(email *mail, ctx echo.Context) error {
|
|||||||
Base(email.template).
|
Base(email.template).
|
||||||
Files(fmt.Sprintf("emails/%s", email.template)).
|
Files(fmt.Sprintf("emails/%s", email.template)).
|
||||||
Execute(email.templateData)
|
Execute(email.templateData)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -4,11 +4,11 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/mikestefanello/pagoda/config"
|
|
||||||
"github.com/mikestefanello/pagoda/ent"
|
|
||||||
"github.com/mikestefanello/pagoda/pkg/tests"
|
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"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 (
|
var (
|
||||||
|
@ -11,8 +11,9 @@ import (
|
|||||||
|
|
||||||
"github.com/maragudk/goqite"
|
"github.com/maragudk/goqite"
|
||||||
"github.com/maragudk/goqite/jobs"
|
"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 (
|
type (
|
||||||
|
@ -10,11 +10,12 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/mikestefanello/pagoda/config"
|
|
||||||
"github.com/mikestefanello/pagoda/pkg/context"
|
"git.grosinger.net/tgrosinger/saasitone/config"
|
||||||
"github.com/mikestefanello/pagoda/pkg/log"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/context"
|
||||||
"github.com/mikestefanello/pagoda/pkg/page"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/log"
|
||||||
"github.com/mikestefanello/pagoda/templates"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/page"
|
||||||
|
"git.grosinger.net/tgrosinger/saasitone/templates"
|
||||||
)
|
)
|
||||||
|
|
||||||
// cachedPageGroup stores the cache group for cached pages
|
// 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").
|
Directories("components").
|
||||||
Execute(page)
|
Execute(page)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return echo.NewHTTPError(
|
return echo.NewHTTPError(
|
||||||
http.StatusInternalServerError,
|
http.StatusInternalServerError,
|
||||||
@ -218,7 +218,6 @@ func (t *TemplateRenderer) GetCachedPage(ctx echo.Context, url string) (*CachedP
|
|||||||
Group(cachedPageGroup).
|
Group(cachedPageGroup).
|
||||||
Key(url).
|
Key(url).
|
||||||
Fetch(ctx.Request().Context())
|
Fetch(ctx.Request().Context())
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -8,14 +8,14 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"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/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"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) {
|
func TestTemplateRenderer(t *testing.T) {
|
||||||
|
@ -3,9 +3,9 @@ package session
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
|
"git.grosinger.net/tgrosinger/saasitone/pkg/context"
|
||||||
"github.com/gorilla/sessions"
|
"github.com/gorilla/sessions"
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/mikestefanello/pagoda/pkg/context"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ErrStoreNotFound indicates that the session store was not present in the context
|
// ErrStoreNotFound indicates that the session store was not present in the context
|
||||||
|
@ -3,8 +3,8 @@ package tasks
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/mikestefanello/pagoda/pkg/log"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/log"
|
||||||
"github.com/mikestefanello/pagoda/pkg/services"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ExampleTask is an example implementation of services.Task
|
// ExampleTask is an example implementation of services.Task
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package tasks
|
package tasks
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/mikestefanello/pagoda/pkg/services"
|
"git.grosinger.net/tgrosinger/saasitone/pkg/services"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Register registers all task queues with the task client
|
// Register registers all task queues with the task client
|
||||||
|
@ -10,14 +10,14 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/mikestefanello/pagoda/ent"
|
|
||||||
"github.com/mikestefanello/pagoda/pkg/session"
|
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/gorilla/sessions"
|
"github.com/gorilla/sessions"
|
||||||
"github.com/labstack/echo/v4"
|
"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
|
// NewContext creates a new Echo context for tests using an HTTP test request and response recorder
|
||||||
|
Loading…
Reference in New Issue
Block a user