velody/backend/src/modules/library/library.dto.ts
2026-06-14 09:43:41 +02:00

76 lines
1.7 KiB
TypeScript

import { ApiProperty } from '@nestjs/swagger';
import { IsOptional, IsUUID } from 'class-validator';
export class LibraryTracksQueryDto {
@ApiProperty({
format: 'uuid',
required: false,
description:
'Optional client metadata. Authorization: Bearer <deviceAccessToken> is required and determines access.',
})
@IsOptional()
@IsUUID()
deviceId?: string;
}
export class RemoteArtworkDto {
@ApiProperty({ format: 'uuid' })
artworkId!: string;
@ApiProperty({
example:
'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',
})
sha256!: string;
@ApiProperty({ example: 'image/jpeg' })
mimeType!: string;
@ApiProperty({ example: 512, required: false, nullable: true })
width!: number | null;
@ApiProperty({ example: 512, required: false, nullable: true })
height!: number | null;
}
export class RemoteLibraryTrackDto {
@ApiProperty({ format: 'uuid' })
trackId!: string;
@ApiProperty({ example: 'Track Title' })
title!: string;
@ApiProperty({ example: 'Track Artist' })
artist!: string;
@ApiProperty({ example: 245 })
durationSeconds!: number;
@ApiProperty({
example:
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
})
sha256!: string;
@ApiProperty({ format: 'uuid' })
assetId!: string;
@ApiProperty({ example: '2026-05-29T08:00:00.000Z' })
createdAt!: string;
@ApiProperty({ example: '2026-05-29T08:05:00.000Z' })
updatedAt!: string;
@ApiProperty({
type: RemoteArtworkDto,
required: false,
nullable: true,
})
artwork!: RemoteArtworkDto | null;
}
export class LibraryTracksResponseDto {
@ApiProperty({ type: [RemoteLibraryTrackDto] })
tracks!: RemoteLibraryTrackDto[];
}