0.1.8 • Published 3 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
3 years ago
0.1.7
3 years ago
0.1.2
3 years ago
0.1.1
3 years ago
0.1.0-1621187192000-7
3 years ago
0.1.0-1621187192000-6
3 years ago
0.1.0-1621187192000-5
3 years ago
0.1.4
3 years ago
0.1.3
3 years ago
0.1.6
3 years ago
0.1.5
3 years ago
0.1.0-1621187192000-4
3 years ago
0.1.0-1621187192000-3
3 years ago
0.1.0-1621187192000-2
3 years ago
0.1.0-1621187192000-1
3 years ago
0.1.0-1618939828000-1
3 years ago
0.1.0-1618939828000
3 years ago