feat(media): full Clean Architecture scaffold

Media is now a complete vertical-feature package mirroring auth/blog
structure: entities (models + errors), application (repositories +
use-cases), infrastructure (real Payload-backed + mock siblings),
interface-adapters (per-use-case controllers), DI (symbols + module +
container + bind-production), integrations/api (mediaRouter), factory,
contract suite, and feature integration tests.

Wired into:
- packages/core-api/src/root.ts (added `media: mediaRouter`)
- apps/web-next/src/server/bind-production.ts (calls bindProductionMedia)
- tsconfig.base.json (added @repo/media/api and ./di/bind-production aliases)

56 new tests in @repo/media (13 test files); core-api router test updated
to assert media. procedures. All 26 turbo tasks green.

Refactor log: §2, §4.1, §4.2, §5.1, §6.1
Spec: §6.5

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-06 00:29:05 +02:00
parent 69623b995d
commit 8a36d803b3
42 changed files with 1121 additions and 23 deletions

View File

@@ -0,0 +1,5 @@
export class InputParseError extends Error {
constructor(message: string, options?: ErrorOptions) {
super(message, options);
}
}

View File

@@ -0,0 +1,20 @@
import { describe, it, expect } from "vitest";
import { MediaNotFoundError } from "@/entities/errors/media";
describe("MediaNotFoundError", () => {
it("is an instance of Error", () => {
const err = new MediaNotFoundError();
expect(err).toBeInstanceOf(Error);
expect(err).toBeInstanceOf(MediaNotFoundError);
});
it("has default message", () => {
const err = new MediaNotFoundError();
expect(err.message).toBe("Media not found");
});
it("accepts a custom message", () => {
const err = new MediaNotFoundError("Custom message");
expect(err.message).toBe("Custom message");
});
});

View File

@@ -0,0 +1,5 @@
export class MediaNotFoundError extends Error {
constructor(message = "Media not found", options?: ErrorOptions) {
super(message, options);
}
}