public TeamType(ITenantsApi api) { Name = "Team"; Field(h => h.Id).Description("The id of the Team."); Field(h => h.Name, nullable: true).Description("The name of the Team."); Field <ListGraphType <UserType> >("Users", "The users that belong to the team", resolve: context => api.ListUsersByTeamAsync(context.Source.Id)); Field <ListGraphType <RoleType> >("Roles", "The roles that belong to the team", resolve: context => api.ListRolesByTeamAsync(context.Source.Id)); }
public RoleType(ITenantsApi api) { Name = "Role"; Field(h => h.Id).Description("The id of the role."); Field(h => h.Name, nullable: true).Description("The name of the role."); Field <ListGraphType <StringGraphType> >("Permissions", "The permissions belonging to this role", resolve: context => api.ListPermissionsByRoleAsync(context.Source.Id)); Field <ListGraphType <TeamType> >("Teams", "The teams that have this role", resolve: context => api.ListTeamsByRoleAsync(context.Source.Id)); }
public UserType(ITenantsApi api) { Name = "User"; Field(h => h.Id).Description("The id of the user"); Field(h => h.Name, nullable: true).Description("The name of the user"); Field(h => h.FirstName, nullable: true).Description("The first name of the user"); Field(h => h.LastName, nullable: true).Description("The last name of the user"); Field <ListGraphType <TeamType> >("Teams", "The teams the user belongs to", resolve: context => api.ListTeamsByUserAsync(context.Source.Id)); }
public CustomQuery(ITenantsApi data) { Name = nameof(CustomQuery); Field <UserType>( "User", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <StringGraphType> > { Name = "id", Description = "id of the User" } ), resolve: context => data.GetUserAsync(context.GetArgument <string>("id"))); Field <TeamType>( "Team", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <StringGraphType> > { Name = "id", Description = "id of the Team" } ), resolve: context => data.GetTeamAsync(context.GetArgument <string>("id")) ); Field <RoleType>( "Role", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <StringGraphType> > { Name = "id", Description = "id of the Role" } ), resolve: context => data.GetRoleAsync(context.GetArgument <string>("id")) ); Field <ListGraphType <TeamType> >( "Teams", resolve: context => data.ListTeamsAsync() ); Field <ListGraphType <UserType> >( "Users", resolve: context => data.ListUsersAsync() ); Field <ListGraphType <RoleType> >( "Roles", resolve: context => data.ListRolesAsync() ); }
public CustomMutation(ITenantsApi data) { Name = "Mutation"; Field <UserType>( "createUser", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <UserInputType> > { Name = "User" } ), resolve: context => { var user = context.GetArgument <UserModel>("User"); return(data.CreateUser(user)); }); }
public TenantsSteps(ITenantsApi tenantsApi, IFixture autoFixture, TenantsContext tenantsContext) { _tenantsApi = tenantsApi; _autoFixture = autoFixture; _tenantsContext = tenantsContext; }