view data fixes
Some checks failed
Contract Testing / contract-tests (pull_request) Failing after 5m51s
Contract Testing / contract-snapshot (pull_request) Has been skipped

This commit is contained in:
2026-01-24 12:14:08 +01:00
parent dde77e717a
commit 046852703f
94 changed files with 1333 additions and 4885 deletions

View File

@@ -5,21 +5,24 @@
* Deterministic; side-effect free; no HTTP calls.
*/
import { MediaBinaryDTO } from '@/lib/types/MediaBinaryDTO';
import { TrackImageViewData } from '@/lib/view-data/TrackImageViewData';
import type { MediaBinaryDTO } from '@/lib/types/generated/MediaBinaryDTO';
import type { TrackImageViewData } from '@/lib/view-data/TrackImageViewData';
import { ViewDataBuilder } from "../../contracts/builders/ViewDataBuilder";
export class TrackImageViewDataBuilder implements ViewDataBuilder<any, any> {
build(input: any): any {
return TrackImageViewDataBuilder.build(input);
}
static build(
static build(apiDto: MediaBinaryDTO): TrackImageViewData {
export class TrackImageViewDataBuilder {
/**
* Transform API DTO to ViewData
*
* @param apiDto - The DTO from the service
* @returns ViewData for the track image
*/
public static build(apiDto: MediaBinaryDTO): TrackImageViewData {
return {
buffer: Buffer.from(apiDto.buffer).toString('base64'),
contentType: apiDto.contentType,
};
}
}
}
TrackImageViewDataBuilder satisfies ViewDataBuilder<MediaBinaryDTO, TrackImageViewData>;