public LockQueries(LockRead.LockReadClient lockReadClient) { FieldAsync <LockType>(nameof(Contracts.Lock), "a lock", new QueryArguments(new QueryArgument(typeof(StringGraphType)) { Name = "resourceId" } ), async ctx => await ctx.TryAsyncResolve(async context => await lockReadClient.GetLockAsync( new LockRequest { ResourceId = ctx.Arguments["resourceId"].ToString() } ) )); // FieldAsync<ListGraphType<LockType>>("locks", // "all locks", // null, // async ctx => await ctx.TryAsyncResolve(async context => // { // var response = await locationReadClient.GetAllLocationsAsync(new Empty()); // return response.Elements; // })); }
public LockSubscription(LockRead.LockReadClient lockReadClient) { _lockReadClient = lockReadClient; AddField(new EventStreamFieldType { Name = "lockExpire", Type = typeof(LockType), Resolver = new FuncFieldResolver <Contracts.Lock>(ctx => ctx.Source as Contracts.Lock), Subscriber = new EventStreamResolver <Contracts.Lock>(GetLockChangeSubscription) }); }
public VehicleLockResolver(LockRead.LockReadClient lockReadClient) => _lockReadClient = lockReadClient;