Skip to main content
Glama
get-weathers.handler.ts818 B
import { IQueryHandler, QueryHandler } from "@nestjs/cqrs" import { IWeatherRepository } from "src/domain/weather/weather.repository" import { CreateWeatherResponse } from "../../commands/create-weather/create-weather.response" import { GetWeathersQuery } from "./get-weathers.query" import { GetWeatherResponse } from "./get-weathers.response" @QueryHandler(GetWeathersQuery) export class GetWeathersHandler implements IQueryHandler<GetWeathersQuery, GetWeatherResponse[]> { constructor( private _weatherRepository: IWeatherRepository ) { } async execute(query: GetWeathersQuery): Promise<GetWeatherResponse[]> { const weathers = await this._weatherRepository.Find() return weathers.map(weather=>CreateWeatherResponse.from(weather.Date.toISOString(), weather.Temperature)) } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/RenzoReccio/nestjs-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server