feat: sites and authors integration into existing screens (& formated all frontend files kinda accidentally)

This commit is contained in:
Florian Sylvain committed 2026-10-15 05:25:44 +02:00
1 parent 3d81d2c717
commit 6b8990c55e
239 files changed
+9194 -1354

No files matched your search

@@ -11,6 +11,11 @@ import (
const maxOwnSlugAttempts = 50
type MyAuthorCreated struct {
Author author.Author
SlugAdjusted bool
}
type CreateMyAuthorUseCase struct {
authors author.Repository
users user.Repository
@@ -21,10 +26,10 @@ func NewCreateMyAuthorUseCase(authors author.Repository, users user.Repository,
return &CreateMyAuthorUseCase{authors: authors, users: users, recorder: recorder}
}
func (u *CreateMyAuthorUseCase) Create(ctx context.Context, userID uint32) (author.Author, error) {
func (u *CreateMyAuthorUseCase) Create(ctx context.Context, userID uint32) (MyAuthorCreated, error) {
caller, err := u.users.Get(userID)
if err != nil {
return author.Author{}, err
return MyAuthorCreated{}, err
}
name := authorNameOf(caller)
event := audit.NewEvent(audit.ActionAuthorCreate, audit.CategoryAuthors)
@@ -32,11 +37,11 @@ func (u *CreateMyAuthorUseCase) Create(ctx context.Context, userID uint32) (auth
created, err := u.create(caller, name)
if err != nil {
recordFailure(ctx, u.recorder, event, err)
return author.Author{}, err
return MyAuthorCreated{}, err
}
event.Target = authorTarget(created)
u.recorder.Record(ctx, event)
return created, nil
return MyAuthorCreated{Author: created, SlugAdjusted: created.Slug != author.GenerateSlug(name)}, nil
}
func authorNameOf(caller user.User) string {