shopping-assistant-api/ShoppingAssistantApi.Api/ApiExtentions/GraphQlExtention.cs
2023-09-22 23:02:20 +03:00

25 lines
738 B
C#

using ShoppingAssistantApi.Api.Queries;
using ShoppingAssistantApi.Api.Mutations;
namespace ShoppingAssistantApi.Api.ApiExtentions;
public static class GraphQlExtention
{
public static IServiceCollection AddGraphQl(this IServiceCollection services)
{
services
.AddGraphQLServer()
.AddQueryType()
.AddTypeExtension<UsersQuery>()
.AddTypeExtension<RolesQuery>()
.AddMutationType()
.AddTypeExtension<AccessMutation>()
.AddTypeExtension<UsersMutation>()
.AddTypeExtension<RolesMutation>()
.AddAuthorization()
.InitializeOnStartup(keepWarm: true);
return services;
}
}