mirror of
https://github.com/aleksilassila/reiverr.git
synced 2026-04-18 03:53:14 +02:00
61 lines
1.0 KiB
TypeScript
61 lines
1.0 KiB
TypeScript
import { Type } from '@nestjs/common';
|
|
import {
|
|
ApiProperty,
|
|
IntersectionType,
|
|
OmitType,
|
|
PartialType,
|
|
PickType,
|
|
} from '@nestjs/swagger';
|
|
import {
|
|
PaginatedResponse,
|
|
PaginationParams,
|
|
} from '@aleksilassila/reiverr-shared/dist/src/old';
|
|
|
|
export const PickAndPartial = <T, K extends keyof T>(
|
|
clazz: Type<T>,
|
|
pick: K[] = [],
|
|
partial: K[] = [],
|
|
) =>
|
|
IntersectionType(
|
|
OmitType(PickType(clazz, pick), partial),
|
|
PickType(PartialType(clazz), partial),
|
|
);
|
|
|
|
export class PaginatedResponseDto<T> implements PaginatedResponse<T> {
|
|
@ApiProperty()
|
|
total: number;
|
|
|
|
@ApiProperty()
|
|
page: number;
|
|
|
|
@ApiProperty()
|
|
itemsPerPage: number;
|
|
|
|
// @ApiProperty()
|
|
items: T[];
|
|
}
|
|
|
|
export class PaginationDto implements PaginationParams {
|
|
@ApiProperty()
|
|
page: number;
|
|
|
|
@ApiProperty()
|
|
itemsPerPage: number;
|
|
}
|
|
|
|
export class SuccessResponseDto {
|
|
@ApiProperty()
|
|
success: boolean;
|
|
}
|
|
|
|
export enum MediaType {
|
|
Movie = 'movie',
|
|
Series = 'series',
|
|
}
|
|
|
|
export enum MediaTypeFull {
|
|
Movie = 'movie',
|
|
Series = 'series',
|
|
Episode = 'episode',
|
|
}
|