import { NotFoundException } from '../exception' ; import { PlaceDetailsQuery } from '../model' ; import type { PlaceDetailsQueryInterface } from '../interface' ; import type { Location } from '../model' ; import type { AbstractLocationTransformer } from '../transformer' ; import { AbstractLocationCommand } from './abstract-location.command' ; export class PlaceDetailsCommand < ProviderRequestType = any , ProviderResponseType = any > extends AbstractLocationCommand < PlaceDetailsQueryInterface , ProviderRequestType , ProviderResponseType > { static queryClass ( ) { return PlaceDetailsQuery ; } async execute ( query ) { const locations = await super . execute ( query ) ; locations . map ( ( location ) => { if ( ! location . placeId ) { location . placeId = query . placeId ; } return location ; } ) ; if ( locations . length !== 1 ) { throw new NotFoundException ( `Place by id "${ query . placeId }" not found` ) ; } return locations ; } protected async parseOneResult < ProviderRawEntryType = any , ProviderLocationTransformer extends AbstractLocationTransformer = any > ( _raw ) { throw new Error ( 'PlaceDetailsCommand.parseOneResult: not implemented' ) ; } }