Commit Graph
3 Commits
Author SHA1 Message Date
Parsa Aghayi 6b03c0fbc3 Add a locked-down image upload endpoint for the admin panel
Posts, projects and about-me all carry an image column that could only ever
be filled by typing a URL by hand, so every featured image in the database is
still a placeholder. Uploads are the missing half of content management.

Filenames are generated rather than reused from the client, which is what
keeps a double extension or a path traversal out of a web-served directory.
The upload surface is restricted to raster formats (no SVG, which can carry
script) with a size and dimension ceiling, and throttled at 12/min against
the general admin API's 30/min because an upload costs far more than a JSON
write.

Routes move to per-feature files registered from bootstrap/app.php, since
api.php had become a chokepoint for parallel work on this repo.
2026-10-01 17:41:49 -04:00
Parsa Aghayi 3f386c7be8 Add the admin content API the CMS needs
Two gaps blocked building the admin panel:

About-me writes could only set the image. Title and description live in the
JSON translations column and were unreachable from the API, so the homepage
bio could never be edited through the app. Accept title_fa/title_en/
description_fa/description_en on both About Me form requests and write them
per locale through setTranslation().

Editing also needs raw rows. The public project and about-me endpoints only
return display-oriented payloads - one translated title, reshaped image
arrays, no second locale - which is not enough to populate a form. Add
GET /api/admin/resources/{resource} behind the same auth:sanctum + admin
middleware as the write routes, returning stored rows including every locale,
plus a public GET /api/website/project-categories so project forms have a
category picker.

Covered by AdminResourceReadTest: anonymous and non-admin callers are
rejected for every resource, unknown resource names 404, and project rows
expose both locales.
2026-10-01 15:28:23 -04:00
parsa aghaei f3568ab277 0.1: replace Request with FormRequest in all controllers 2026-06-23 18:04:57 +03:30