Exemplo n.º 1
0
 public DiscoverBreweriesViewModel()
 {
     azure        = ServiceLocator.Instance.Resolve <IAzureClient>();
     breweryStore = ServiceLocator.Instance.Resolve <IBreweryStore>();
 }
 public DiscoverBreweriesViewModel()
 {
     azure = ServiceLocator.Instance.Resolve<IAzureClient>();
     breweryStore = ServiceLocator.Instance.Resolve<IBreweryStore>();
 }
        public BreweryType(IDataLoaderContextAccessor accessor, IBreweryStore breweryStore)
        {
            _breweryStore = breweryStore;

            Name        = "Brewery";
            Description = "A brewery of beer";

            Id(t => t.Id);

            Field(d => d.BreweryType, nullable: false)
            .Name("brewery_type")
            .Description("Type of Brewery");

            Field(t => t.BreweryId, nullable: false)
            .Name("brewery_id")
            .Description("Friendly id for Brewery");

            Field(t => t.City)
            .Name("city")
            .Description("The city of the brewery");

            Field(t => t.Country)
            .Name("country")
            .Description("The country of origin for the brewery");

            Field(t => t.Longitude)
            .Name("longitude")
            .Description("Longitude portion of lat/long coordinates");

            Field(t => t.Latitude)
            .Name("latitude")
            .Description("Latitude portion of lat/long coordinates");

            Field(t => t.Name)
            .Name("name")
            .Description("Name of brewery");

            Field(t => t.Phone)
            .Name("phone")
            .Description("The phone number for the brewery");

            Field(t => t.PostalCode)
            .Name("postal_code")
            .Description("The state of the brewery");

            Field(t => t.State)
            .Name("state")
            .Description("The state of the brewery");

            Field(t => t.Street)
            .Name("street")
            .Description("The street of the brewery");

            Field(t => t.UpdatedAt, nullable: false)
            .Name("updated_at")
            .Description("Date timestamp of the last time the record was updated");

            Field(t => t.WebsiteURL)
            .Name("website_url")
            .Description("Website address for the brewery");

            Field <NonNullGraphType <ListGraphType <StringGraphType> > >("tag_list", resolve: (context) =>
            {
                return(context.Source?.BreweryTags?
                       .Select(bt => bt.Tag.Name)
                       .Distinct()
                       .ToList() ?? new List <string>());
            });
        }