diff --git a/CHANGELOG.md b/CHANGELOG.md index aeaee7e..d72e5df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,47 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). +## [0.21.0] - 2026-09-25 + +### Added +- `Modules\Core\File` — a generic, storage-backend-agnostic file registry: `Models\File` (a + `files` table row per stored file — disk, path, original name, mime, size, a `purpose` tag, + and a nullable polymorphic owner), `Services\FileService` (store/retrieve/download/exists/ + delete/list/`pruneUnowned`, delegating every actual byte-level operation to a + `Contracts\FileAdapterInterface` resolved per disk — `Adapters\LocalFileAdapter` today, the + same contextual-binding pattern `Shipping\Contracts\CarrierFulfillmentInterface` already uses + per carrier, so a future `S3FileAdapter` is one class and one more match arm, nothing else + changes), and `Http\Controllers\DownloadFileController` — a signed-URL-only route + (`files.download`) any consuming app can mint a link to, serving either inline (a preview) or + as a forced download (`?download=1`). +- `Modules\Core\File\Http\Controllers\UploadFileController` — an abstract base for "accept an + upload, validate it, store it via `FileService`, return its id" endpoints. Which + extensions/sizes are acceptable is deliberately left to a concrete subclass's own + `purpose()`/`validationRules()` overrides (ordinary server-side PHP, never trusting anything + the request itself claims about its own limits) — a real policy decision that can differ per + site and even per product/field, not something a shared base class or config file could + express safely. +- `boboko:file:prune-unowned {purpose}` — deletes every unowned `File` of a given purpose past + its grace period (`--hours`, default 24). Generic: any consuming app schedules it once per + purpose string it stores files under. +- `Modules\Core\Cart\Events\CartLineAdded`/`Checkout\Events\OrderPlaced` listeners + (`File\Listeners\AttachCustomFieldFileToCartLine`/`TransferCustomFieldFileOwnership`) that + re-point a `File`'s ownership from unowned → the real `CartLine` once one exists, then from + that `CartLine` → the `OrderLine` an order is placed with — so a File referenced by a product + custom field survives the cart it originated from being cleared, without ever being copied. + +### Changed +- The admin order-lines table's collapsible details dropdown (next to the existing price + breakdown) now shows a product's custom-field answers (`OrderLine.meta.custom_fields`) — a + bordered table matching the existing price-breakdown one, with a thumbnail preview and a + download-icon link for a file answer, resolved through `File\Services\FileService`'s signed + route. Previously never shown anywhere in the admin. +- 3dealer's product custom-field photo upload (`CustomFieldUploadController`), cart line meta + (`CartController::customFieldsMeta()`), and pruning (formerly its own `PruneCustomFieldUploads` + command) now go through `Modules\Core\File` instead of a bespoke `Crypt::encryptString({disk, + path, name, mime})` reference scheme — a cart/order line's file answer is now just a `File` + row's `file_id`, with `File` as the single source of truth for every other detail. + ## [0.20.2] - 2026-09-25 ### Changed diff --git a/composer.json b/composer.json index 931c13d..234757a 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "boboko/core", "description": "Core module — authentication and shared panel behaviour", "type": "library", - "version": "0.20.2", + "version": "0.21.0", "autoload": { "psr-4": { "Modules\\Core\\": "src/"