- C1-01: Create CloudService with CRUD folders/files, quota, ownership - C1-02: Create CloudHandler with 11 REST endpoints - C1-03: Register cloud routes in Go router - C1-04: Implement file streaming with HTTP Range support - C1-05: Add publish cloud file as track endpoint - C1-06: Add MSW mock handlers for cloud API - C1-07: Auto-init 5GB storage quota on user registration - C1-08: Add 12 unit tests for CloudService
44 lines
1.7 KiB
TypeScript
44 lines
1.7 KiB
TypeScript
/**
|
|
* FE-API-019: MSW Mock Handlers
|
|
* Mock request handlers for development and testing
|
|
*
|
|
* Handlers are split by feature:
|
|
* - handlers-common: external images, csrf
|
|
* - handlers-auth: auth, 2fa, sessions
|
|
* - handlers-admin: audit, dashboard, roles, users list, monitoring, webhooks, api-keys
|
|
* - handlers-social: social feed, posts, groups
|
|
* - handlers-marketplace: marketplace, commerce, cart, orders
|
|
* - handlers-tracks: tracks, comments
|
|
* - handlers-playlists: playlists
|
|
* - handlers-misc: search, notifications, users profile, chat, streaming, inventory, live
|
|
* - handlers-cloud: cloud storage, folders, files, quota
|
|
*/
|
|
|
|
import { http, HttpResponse } from 'msw';
|
|
import { handlersCommon } from './handlers-common';
|
|
import { handlersAuth } from './handlers-auth';
|
|
import { handlersAdmin } from './handlers-admin';
|
|
import { handlersSocial } from './handlers-social';
|
|
import { handlersMarketplace } from './handlers-marketplace';
|
|
import { handlersTracks } from './handlers-tracks';
|
|
import { handlersPlaylists } from './handlers-playlists';
|
|
import { handlersMisc } from './handlers-misc';
|
|
import { handlersCloud } from './handlers-cloud';
|
|
|
|
export const handlers = [
|
|
...handlersCommon,
|
|
...handlersAuth,
|
|
...handlersAdmin,
|
|
...handlersSocial,
|
|
...handlersMarketplace,
|
|
...handlersTracks,
|
|
...handlersPlaylists,
|
|
...handlersMisc,
|
|
...handlersCloud,
|
|
|
|
// Catch-all for API to prevent network leaks (Phase 1: Stabilization)
|
|
http.all('*/api/v1/*', ({ request }) => {
|
|
console.warn('[MSW] Intercepted unhandled API request:', request.method, request.url);
|
|
return HttpResponse.json({ success: true, message: 'Mocked fallback response from Storybook' });
|
|
}),
|
|
];
|