Skip to content

Commit fe13d90

Browse files
authored
Redesigned create website, change manage to admin, used categories/tags (#6)
1 parent beae551 commit fe13d90

40 files changed

Lines changed: 2125 additions & 526 deletions

CLAUDE.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
88

99
Ferrio API is a Symfony 7.4 / PHP 8.5 application that serves holiday data (fixed and floating) across multiple
1010
languages and countries. It exposes a versioned JSON REST API (v1, v2, v3) and includes a Twig-based admin UI (
11-
`/manage`) protected by HTTP Basic Auth.
11+
`/admin`, with a 301 redirect from the legacy `/manage` prefix) protected by HTTP Basic Auth.
1212

1313
## Commands
1414

@@ -76,7 +76,8 @@ Single endpoint: `GET /v3/holidays` with query parameters:
7676
- `grouping` (optional, default `false`) — when `true`, groups holidays by day in v2-compatible `HolidayDay` format
7777

7878
The v3 merges fixed and floating holidays into a unified flat list sorted by date. Each item has a prefixed `id` (
79-
`fixed-*` or `floating-*`).
79+
`fixed-*` or `floating-*`) and includes a `categories` array of tag names translated into the requested `lang` (falling
80+
back to the tag slug when no translation exists). Categories are bulk-loaded once per side via DQL to avoid N+1.
8081

8182
### Algorithm Resolver (v3)
8283

@@ -105,14 +106,19 @@ Available algorithms with v1/v2 `args` → v3 `algorithmArgs` mapping (dayOfWeek
105106

106107
### Admin UI
107108

108-
`ManageController` + `WebController` serve Twig templates under `/manage` for managing holiday data (create, translate,
109-
check). Protected by `ROLE_USER` via HTTP Basic Auth.
110-
111-
`GenerateDescriptionController` (`POST /manage/generate-description`) calls the Anthropic API (Claude Haiku 4.5) to
112-
generate Polish holiday descriptions. It accepts `{day, month, name}` JSON and returns `{description}`. The system
113-
prompt enforces Ferrio's copywriting style (150-250 words, informative tone, Polish language). The API key is configured
114-
via `ANTHROPIC_API_KEY` env var. The create/update forms in `create.html.twig` have an AI generate button (sparkle icon)
115-
next to each description textarea that calls this endpoint via fetch.
109+
`ManageController` + `WebController` serve Twig templates under `/admin` for managing holiday data (create, translate,
110+
check). Protected by `ROLE_USER` via HTTP Basic Auth. `AdminTagController` (under `/admin/tags`) handles tag (category)
111+
management with chip UI and per-type usage counters. Legacy `/manage/*` URLs return 301 redirects to `/admin/*` via
112+
`ManageRedirectController`.
113+
114+
`GenerateDescriptionController` (`POST /admin/api/generate`) calls the Anthropic API (Claude Sonnet 4.6) to
115+
generate Polish holiday descriptions. It accepts `{day, month, name, type?, language?}` JSON and returns `{result}` (or
116+
`{error}`). `type` selects the prompt set: `description_pl` (default, Polish description), `description` (English-style
117+
description), or `name` (translates a Polish holiday name into the target `language`). The system prompts enforce
118+
Ferrio's copywriting style (150-250 words, informative tone) and live in `config/prompts/`. The API key is configured
119+
via `ANTHROPIC_API_KEY` env var. The create row in `create.html.twig` has an AI sparkle button next to its description
120+
textarea, and the per-row edit modal has sparkle buttons next to both the name and description fields. All call this
121+
endpoint via axios.
116122

117123
### Testing
118124

assets/app.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import './styles/app.scss';
22
import * as bootstrap from 'bootstrap';
33
import axios from 'axios';
44
import './reports';
5+
import './create';
56

67
(window as any).axios = axios;
78
(window as any).bootstrap = bootstrap;

0 commit comments

Comments
 (0)