Add consent-gated media exchange library

This commit is contained in:
jjbrunton committed 2026-08-09 19:24:38 +01:00
1 parent b8e4a1bb88
commit bf474dfe10
42 files changed
+2533 -9

No files matched your search

@@ -14,6 +14,7 @@ import {
LoginStatusResponseSchema,
LegacyDashboardStreamEventSchema,
MediaResponseSchema,
MediaLibraryAssetSchema,
MediaSyncStatusSchema,
MessagesResponseSchema,
ProcessedPostsResponseSchema,
@@ -215,6 +216,18 @@ describe('dashboard endpoint contracts', () => {
expect(MediaResponseSchema.safeParse([{ id: 'sha1', timestamp: 'now' }]).success).toBe(false);
});
it('validates exchange-library classifications without exposing local paths', () => {
const payload = {
id: '019fe789-1b99-7ce1-8402-b3cbc32a445a', tags: ['selfie', 'topless'], safety: 'nsfw',
classificationStatus: 'ready', description: 'A self portrait', confidence: 0.9,
fileName: 'portrait.jpg', mimeType: 'image/jpeg', sizeBytes: 100, width: 10, height: 20,
enabled: true, consentConfirmedAt: 1, createdAt: 1, updatedAt: 1, sendCount: 0, lastSentAt: null,
urlPath: '/library-media/id.jpg',
};
expect(MediaLibraryAssetSchema.safeParse(payload).success).toBe(true);
expect(MediaLibraryAssetSchema.safeParse({ ...payload, relativePath: 'private/id.jpg' }).success).toBe(false);
});
it('validates every current login-status branch', () => {
expect(LoginStatusResponseSchema.safeParse({
ready: true, loggedIn: true, status: 'authenticated',