Implement file storage layer with local provider, upload/download API, tests
- StorageProvider interface with LocalProvider (S3 placeholder) - File table with entity_type/entity_id references, content type, path - POST /v1/files (multipart upload), GET /v1/files (list by entity), GET /v1/files/:id (metadata), GET /v1/files/serve/* (content), DELETE /v1/files/:id - member_identifier drops base64 columns, uses file_id FKs - File validation: type whitelist, size limits, per-entity max - Fastify storage plugin injects provider into app - 6 API tests for upload, list, get, delete, validation - Test runner kills stale port before starting backend
This commit is contained in:
@@ -3,6 +3,8 @@ import { type TestResult, printSuiteHeader, printTestResult } from './reporter.j
|
||||
|
||||
export interface TestContext {
|
||||
api: ApiClient
|
||||
token: string
|
||||
baseUrl: string
|
||||
test: (name: string, optsOrFn: { tags?: string[] } | (() => Promise<void>), maybeFn?: () => Promise<void>) => void
|
||||
assert: {
|
||||
status: (res: ApiResponse, expected: number) => void
|
||||
@@ -117,6 +119,8 @@ export async function runSuite(
|
||||
|
||||
const ctx: TestContext = {
|
||||
api,
|
||||
token,
|
||||
baseUrl,
|
||||
assert: makeAssert(),
|
||||
test(name, optsOrFn, maybeFn) {
|
||||
const opts = typeof optsOrFn === 'function' ? {} : optsOrFn
|
||||
|
||||
Reference in New Issue
Block a user