Files
freya/apps/aelis-backend/src/weather/provider.ts
kenneth ce5dc7fbd3 feat(backend): make FeedSourceProvider async
Make feedSourceForUser and FeedSourceProviderFn return promises.
Use Promise.allSettled to tolerate partial provider failures.
Guard concurrent getOrCreate calls with in-flight promise dedup.
Return 503 from HTTP handlers when session creation fails.

Co-authored-by: Ona <no-reply@ona.com>
2026-03-15 19:11:03 +00:00

16 lines
468 B
TypeScript

import { WeatherSource, type WeatherSourceOptions } from "@aelis/source-weatherkit"
import type { FeedSourceProvider } from "../session/feed-source-provider.ts"
export class WeatherSourceProvider implements FeedSourceProvider {
private readonly options: WeatherSourceOptions
constructor(options: WeatherSourceOptions) {
this.options = options
}
async feedSourceForUser(_userId: string): Promise<WeatherSource> {
return new WeatherSource(this.options)
}
}