46 lines
994 B
TypeScript
46 lines
994 B
TypeScript
import {
|
|
ApiProperty,
|
|
ApiPropertyOptional,
|
|
OmitType,
|
|
PickType,
|
|
} from '@nestjs/swagger';
|
|
import { Storage } from 'src/objects/storage/entities/storage.entity';
|
|
import { User } from 'src/objects/user/user.entity';
|
|
import { StorageStoredItemResponseDto } from './storage-item-response.dto';
|
|
|
|
export class StorageActorResponse extends PickType(User, [
|
|
'sub',
|
|
'name',
|
|
'picture',
|
|
'color',
|
|
]) {}
|
|
|
|
export class StorageResponseDto extends OmitType(Storage, [
|
|
'room',
|
|
'items',
|
|
'set',
|
|
'addedBy',
|
|
]) {
|
|
@ApiPropertyOptional({ type: StorageActorResponse })
|
|
addedBy: StorageActorResponse;
|
|
|
|
@ApiPropertyOptional({
|
|
type: () => StorageStoredItemResponseDto,
|
|
isArray: true,
|
|
})
|
|
items?: StorageStoredItemResponseDto[];
|
|
}
|
|
|
|
export class StorageResponseWithItemCountDto extends OmitType(Storage, [
|
|
'room',
|
|
'items',
|
|
'set',
|
|
'addedBy',
|
|
]) {
|
|
@ApiPropertyOptional({ type: StorageActorResponse })
|
|
addedBy: StorageActorResponse;
|
|
|
|
@ApiProperty()
|
|
itemCount: number;
|
|
}
|