0.1.8 • Published 4 years ago
@proteria/type-graphql v0.1.8
TypeGraphQL
Fork of MichalLytek/type-graphql.
Differences
Babel macro
import {
Authorized,
FieldResolver,
ObjectType,
Query,
Resolver,
} from "@proteria/type-graphql/macro";
@ObjectType()
class Recipe {
@Field()
id: string;
@Field()
title: string;
@Field()
ratings: Rate[];
@Field()
averageRating?: number;
}
@Resolver(Recipe)
class RecipeResolver {
constructor(private recipeService: RecipeService) {}
@Query()
recipes(): Promise<Recipe[]> {
return this.recipeService.findAll();
}
@Mutation()
@Authorized(Roles.Admin)
removeRecipe(@Arg() id: string): boolean {
return this.recipeService.removeById(id);
}
@FieldResolver()
averageRating(@Root() recipe: Recipe) {
return recipe.ratings.reduce((a, b) => a + b, 0) / recipe.ratings.length;
}
}
0.1.8
4 years ago
0.1.7
4 years ago
0.1.2
4 years ago
0.1.1
4 years ago
0.1.0-1621187192000-7
4 years ago
0.1.0-1621187192000-6
4 years ago
0.1.0-1621187192000-5
4 years ago
0.1.4
4 years ago
0.1.3
4 years ago
0.1.6
4 years ago
0.1.5
4 years ago
0.1.0-1621187192000-4
4 years ago
0.1.0-1621187192000-3
4 years ago
0.1.0-1621187192000-2
4 years ago
0.1.0-1621187192000-1
4 years ago
0.1.0-1618939828000-1
4 years ago
0.1.0-1618939828000
4 years ago