import { SpaceEntity } from '@app/common/modules/space/entities/space.entity'; import { SubspaceEntity } from '@app/common/modules/space/entities/subspace/subspace.entity'; import { QueryRunner } from 'typeorm'; import { CreateProductAllocationDto } from './create-product-allocation.dto'; export enum AllocationsOwnerType { SPACE = 'space', SUBSPACE = 'subspace', } export class BaseCreateAllocationsDto { productAllocations: CreateProductAllocationDto[]; projectUuid: string; queryRunner: QueryRunner; type: AllocationsOwnerType; } export class CreateSpaceAllocationsDto extends BaseCreateAllocationsDto { space: SpaceEntity; type: AllocationsOwnerType.SPACE; } export class CreateSubspaceAllocationsDto extends BaseCreateAllocationsDto { subspace: SubspaceEntity; type: AllocationsOwnerType.SUBSPACE; } export type CreateAllocationsDto = | CreateSpaceAllocationsDto | CreateSubspaceAllocationsDto;