import { Inject, Injectable, NotFoundException } from '@nestjs/common' import { GetVersionQuery } from './get-version.query' import { AppVersionRepository, APP_VERSION_REPOSITORY } from '@/domain/repositories/app-version.repository' import { AppVersion } from '@/domain/entities/app-version.entity' @Injectable() export class GetVersionHandler { constructor( @Inject(APP_VERSION_REPOSITORY) private readonly appVersionRepository: AppVersionRepository, ) {} async execute(query: GetVersionQuery): Promise { const version = await this.appVersionRepository.findById(query.id) if (!version) { throw new NotFoundException(`Version with ID ${query.id} not found`) } return version } }