Add make command to create an admin user.

This commit is contained in:
mikestefanello 2025-04-20 10:44:14 -04:00
parent 96fc0ea600
commit 5245c9484b
4 changed files with 71 additions and 5 deletions

View file

@ -47,7 +47,7 @@ func (h *Admin) Init(c *services.Container) error {
}
func (h *Admin) Routes(g *echo.Group) {
entities := g.Group("/admin/content", middleware.RequireAdmin)
entities := g.Group("/admin/entity", middleware.RequireAdmin)
for _, n := range h.graph.Nodes {
ng := entities.Group(fmt.Sprintf("/%s", strings.ToLower(n.Name)))

View file

@ -10,7 +10,7 @@ import (
"entgo.io/ent/schema/field"
"github.com/labstack/echo/v4"
"github.com/mikestefanello/pagoda/ent/admin"
"github.com/mikestefanello/pagoda/pkg/pager" // todo make this easier
"github.com/mikestefanello/pagoda/pkg/pager"
"github.com/mikestefanello/pagoda/pkg/routenames"
"github.com/mikestefanello/pagoda/pkg/ui"
. "github.com/mikestefanello/pagoda/pkg/ui/components"
@ -26,7 +26,7 @@ func AdminEntityDelete(ctx echo.Context, entityTypeName string) error {
form := Form(
Method(http.MethodPost),
H2(Textf("Are you sure you want to delete this %s?", entityTypeName)),
P(Class("subtitle"), Textf("Are you sure you want to delete this %s?", entityTypeName)),
ControlGroup(
FormButton("is-link", "Delete"),
ButtonLink(
@ -176,7 +176,7 @@ func AdminEntityList(ctx echo.Context, params AdminEntityListParams) error {
r.Path(routenames.AdminEntityEdit(params.EntityType.Name), row.ID),
"is-link",
"Edit",
), // todo make this easier
),
),
Td(
ButtonLink(r.Path(routenames.AdminEntityDelete(params.EntityType.Name), row.ID),