示例#1
0
        protected override void Configure(IObjectTypeDescriptor <RootMutations> descriptor)
        {
            if (!Program.Development)
            {
                descriptor.Authorize("ApiScope");
            }

            descriptor.Field(x => x.CreateTransactionAsync(default))
示例#2
0
        protected override void Configure(IObjectTypeDescriptor <PersonalBook> descriptor)
        {
            descriptor.Authorize();

            descriptor
            .ImplementsNode()
            .IdField(t => t.Id)
            .ResolveNode((ctx, id) => ctx.DataLoader <PersonalBookByIdDataLoader>().LoadAsync(id, ctx.RequestAborted));

            descriptor.Field(e => e.Book)
            .ResolveWith <PersonalBookResolvers>(t => t.GetRecommendedBookAsync(default !, default !, default));
示例#3
0
        protected override void Configure(IObjectTypeDescriptor descriptor)
        {
            descriptor.Authorize();

            /*
             * Users
             */
            descriptor
            .Field("user")
            .Argument(ID, arg => arg.Type <NonNullType <IdType> >().Description("User Id"))
            .Type <UserType>()
            .Resolver(async ctx =>
            {
                return(await ctx.Service <IUserRepository>().GetById(ctx.Argument <long>(ID)));
            });
            descriptor
            .Field("users")
            .Type <ListType <UserType> >()
            .Resolver(async ctx =>
            {
                return((await ctx.Service <IUserRepository>().GetAll()).AsQueryable());
            })
            .UseFiltering <UserFilterType>()
            .UseSorting <UserSortType>();

            /*
             *  Coding skills
             */
            descriptor
            .Field("codingSkill")
            .Argument(ID, arg => arg.Type <NonNullType <IdType> >().Description("Coding skill Id"))
            .Type <CodingSkillType>()
            .Resolver(async ctx =>
            {
                return(await ctx.Service <ICodingSkillRepository>().GetById(ctx.Argument <long>(ID)));
            });
            descriptor
            .Field("codingSkills")
            .Type <ListType <CodingSkillType> >()
            .Resolver(async ctx =>
            {
                return((await ctx.Service <ICodingSkillRepository>().GetAll()).AsQueryable());
            })
            .UseFiltering <CodingSkillFilterType>()
            .UseSorting <CodingSkillSortType>();
        }
示例#4
0
 protected override void Configure(IObjectTypeDescriptor <TimeLog> descriptor)
 {
     descriptor.Authorize();
 }
示例#5
0
 protected override void Configure(IObjectTypeDescriptor <Model> descriptor)
 {
     descriptor.Authorize();
     descriptor.Field(m => m.Name)
     .Authorize();
 }