-
-
Save annitya/fd156bc98976219c1e108f3267560ec6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ObjectType() | |
export default class GraphTimeseries { | |
@Field() | |
assetId: number; | |
@Field() | |
asset: GraphAsset; | |
@Field(() => [Number]) | |
eventsOwnerIds: number[] = []; | |
} | |
@Resolver(() => GraphTimeseries) | |
export default class GraphTimeseriesResolver implements ResolverInterface<GraphTimeseries> { | |
@Query(() => [GraphTimeseries]) | |
async getTimeseriesByIds(@Arg('ids', () => [Float]) ids: number[], @Ctx() source: Source) { | |
return source.getTimeseriesByIds(ids); | |
} | |
@FieldResolver() | |
async asset(@Root() timeseries: GraphTimeseries, @Ctx() source: Source) { | |
return await source.getAssetById(timeseries.assetId); | |
} | |
@FieldResolver() | |
async eventsOwnerIds(@Root() timeseries: GraphTimeseries, @Ctx() source: Source, @Info() info) { | |
const { asset } = timeseries; // undefined | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment