package adminui import ( "context" "errors" "tug/internal/service/admin" "tug/internal/transport/web" ) func (b Backend) PendingAccount(ctx context.Context, id string) (web.AdminPendingAccount, error) { a, err := b.service.PendingAccount(ctx, id) if err != nil { return web.AdminPendingAccount{}, mapError(err) } return web.AdminPendingAccount{Username: a.Username, Spent: a.Spent, ExpiresAt: a.ExpiresAt}, nil } func (b Backend) ConfirmAccount(ctx context.Context, actor, id, code string) error { err := b.service.ConfirmAccount(ctx, actor, id, code) switch { case errors.Is(err, admin.ErrConfirmCode): return web.ErrAdminConfirmCode case errors.Is(err, admin.ErrConfirmSpent): return web.ErrAdminConfirmSpent } return mapError(err) } func (b Backend) RejectAccount(ctx context.Context, actor, id string) error { return mapError(b.service.RejectAccount(ctx, actor, id)) }