コード例 #1
0
ファイル: PictureViewProfile.cs プロジェクト: sheaft-app/api
 public PictureViewProfile()
 {
     CreateMap <ProfilePicture, PictureViewModel>()
     .ForMember(c => c.Url, opt => opt.MapFrom(e => PictureExtensions.GetPictureUrl(e.UserId, e.Url, PictureSize.MEDIUM)));
     CreateMap <ProductPicture, PictureViewModel>()
     .ForMember(c => c.Url, opt => opt.MapFrom(e => PictureExtensions.GetPictureUrl(e.ProductId, e.Url, PictureSize.MEDIUM)));
 }
コード例 #2
0
        protected override void Configure(IObjectTypeDescriptor <CatalogProduct> descriptor)
        {
            base.Configure(descriptor);

            descriptor.Name("ProductPrice");

            descriptor
            .Field("id")
            .Resolve(c => c.Parent <CatalogProduct>().Product.Id)
            .ID(nameof(Product));

            descriptor
            .Field("name")
            .Resolve(c => c.Parent <CatalogProduct>().Product.Name);

            descriptor
            .Field("reference")
            .Resolve(c => c.Parent <CatalogProduct>().Product.Reference);

            descriptor
            .Field("picture")
            .Resolve(c => PictureExtensions.GetPictureUrl(Guid.Empty, c.Parent <CatalogProduct>().Product.Picture, PictureSize.MEDIUM));

            descriptor
            .Field(c => c.VatPricePerUnit)
            .Name("vatPricePerUnit");

            descriptor
            .Field(c => c.OnSalePricePerUnit)
            .Name("onSalePricePerUnit");

            descriptor
            .Field(c => c.WholeSalePricePerUnit)
            .Name("wholeSalePricePerUnit");

            descriptor
            .Field(c => c.OnSalePrice)
            .Name("onSalePrice");

            descriptor
            .Field(c => c.WholeSalePrice)
            .Name("wholeSalePrice");

            descriptor
            .Field(c => c.VatPrice)
            .Name("vatPrice");

            descriptor
            .Field(c => c.CreatedOn)
            .Name("addedOn");
        }
コード例 #3
0
ファイル: ProductPictureType.cs プロジェクト: sheaft-app/api
        protected override void Configure(IObjectTypeDescriptor <ProductPicture> descriptor)
        {
            base.Configure(descriptor);

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

            descriptor
            .Field(c => c.Position)
            .Name("position");

            descriptor
            .Field(c => PictureExtensions.GetPictureUrl(Guid.Empty, c.Url, PictureSize.LARGE))
            .Name("large");
            descriptor
            .Field(c => PictureExtensions.GetPictureUrl(Guid.Empty, c.Url, PictureSize.MEDIUM))
            .Name("medium");
            descriptor
            .Field(c => PictureExtensions.GetPictureUrl(Guid.Empty, c.Url, PictureSize.SMALL))
            .Name("small");
        }
コード例 #4
0
 public TagViewProfile()
 {
     CreateMap <Domain.Tag, TagViewModel>()
     .ForMember(d => d.Picture, opt => opt.MapFrom(r => PictureExtensions.GetPictureUrl(r.Id, r.Picture, PictureSize.LARGE)));
 }
コード例 #5
0
        protected override void Configure(IObjectTypeDescriptor <Product> descriptor)
        {
            base.Configure(descriptor);

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

            descriptor
            .Field(c => c.Name)
            .Name("name")
            .Type <NonNullType <StringType> >();

            descriptor
            .Field(c => c.Reference)
            .Name("reference")
            .Type <NonNullType <StringType> >();

            descriptor
            .Field(c => c.CreatedOn)
            .Name("createdOn");

            descriptor
            .Field(c => c.UpdatedOn)
            .Name("updatedOn");

            descriptor
            .Field(c => c.Vat)
            .Name("vat");

            descriptor
            .Field(c => c.Available)
            .Name("available");

            descriptor
            .Field(c => c.RatingsCount)
            .Name("ratingsCount");

            descriptor
            .Field(c => c.PicturesCount)
            .Name("picturesCount");

            descriptor
            .Field(c => c.CatalogsPricesCount)
            .Name("catalogsCount")
            .Authorize(Policies.PRODUCER);

            descriptor
            .Field(c => c.QuantityPerUnit)
            .Name("quantityPerUnit");

            descriptor
            .Field(c => c.Unit)
            .Name("unit");

            descriptor
            .Field(c => c.Conditioning)
            .Name("conditioning");

            descriptor
            .Field(c => c.Description)
            .Name("description");

            descriptor
            .Field(c => c.Weight)
            .Name("weight");

            descriptor
            .Field(c => c.Rating)
            .Name("rating");

            descriptor
            .Field(c => c.Picture)
            .Resolve(c =>
                     PictureExtensions.GetPictureUrl(c.Parent <Product>().Id, c.Parent <Product>().Picture,
                                                     PictureSize.MEDIUM))
            .Name("picture");

            descriptor
            .Field("imageLarge")
            .Resolve(c =>
                     PictureExtensions.GetPictureUrl(c.Parent <Product>().Id, c.Parent <Product>().Picture,
                                                     PictureSize.LARGE))
            .Type <StringType>();

            descriptor
            .Field("imageMedium")
            .Resolve(c =>
                     PictureExtensions.GetPictureUrl(c.Parent <Product>().Id, c.Parent <Product>().Picture,
                                                     PictureSize.MEDIUM))
            .Type <StringType>();

            descriptor
            .Field("imageSmall")
            .Resolve(c =>
                     PictureExtensions.GetPictureUrl(c.Parent <Product>().Id, c.Parent <Product>().Picture,
                                                     PictureSize.SMALL))
            .Type <StringType>();

            descriptor
            .Field("isReturnable")
            .Resolve(c => c.Parent <Product>().ReturnableId.HasValue)
            .Type <BooleanType>();

            descriptor
            .Field("visibleTo")
            .Resolve(c => c.Parent <Product>().VisibleTo)
            .Authorize(Policies.PRODUCER);

            descriptor
            .Field("vatPricePerUnit")
            .UseDbContext <QueryDbContext>()
            .ResolveWith <ProductResolvers>(c => c.GetProductVatPricePerUnit(default, default, default, default, default, default))
コード例 #6
0
        protected override void Configure(IObjectTypeDescriptor <CatalogProduct> descriptor)
        {
            base.Configure(descriptor);

            descriptor.Name("OrderableProduct");

            descriptor
            .Field(c => c.ProductId)
            .Name("id")
            .ID(nameof(Product));

            descriptor
            .Field(c => c.VatPricePerUnit)
            .Name("vatPricePerUnit");

            descriptor
            .Field(c => c.OnSalePricePerUnit)
            .Name("onSalePricePerUnit");

            descriptor
            .Field(c => c.WholeSalePricePerUnit)
            .Name("wholeSalePricePerUnit");

            descriptor
            .Field(c => c.OnSalePrice)
            .Name("onSalePrice");

            descriptor
            .Field(c => c.WholeSalePrice)
            .Name("wholeSalePrice");

            descriptor
            .Field(c => c.VatPrice)
            .Name("vatPrice");

            descriptor
            .Field(c => c.Product.Name)
            .Name("name")
            .Type <NonNullType <StringType> >();

            descriptor
            .Field(c => c.Product.Reference)
            .Name("reference")
            .Type <NonNullType <StringType> >();

            descriptor
            .Field(c => c.Product.CreatedOn)
            .Name("createdOn");

            descriptor
            .Field(c => c.Product.UpdatedOn)
            .Name("updatedOn");

            descriptor
            .Field(c => c.Product.Vat)
            .Name("vat");

            descriptor
            .Field(c => c.Product.Available)
            .Name("available");

            descriptor
            .Field(c => c.Product.RatingsCount)
            .Name("ratingsCount");

            descriptor
            .Field(c => c.Product.PicturesCount)
            .Name("picturesCount");

            descriptor
            .Field(c => c.Product.CatalogsPricesCount)
            .Name("catalogsCount");

            descriptor
            .Field(c => c.Product.QuantityPerUnit)
            .Name("quantityPerUnit");

            descriptor
            .Field(c => c.Product.Unit)
            .Name("unit");

            descriptor
            .Field(c => c.Product.Conditioning)
            .Name("conditioning");

            descriptor
            .Field(c => c.Product.Description)
            .Name("description");

            descriptor
            .Field(c => c.Product.Weight)
            .Name("weight");

            descriptor
            .Field(c => c.Product.Rating)
            .Name("rating");

            descriptor
            .Field(c => c.Product.Picture)
            .Resolve(c =>
                     PictureExtensions.GetPictureUrl(c.Parent <CatalogProduct>().ProductId, c.Parent <CatalogProduct>().Product.Picture,
                                                     PictureSize.MEDIUM))
            .Name("picture");

            descriptor
            .Field("imageLarge")
            .Resolve(c =>
                     PictureExtensions.GetPictureUrl(c.Parent <CatalogProduct>().ProductId, c.Parent <CatalogProduct>().Product.Picture,
                                                     PictureSize.LARGE))
            .Type <StringType>();

            descriptor
            .Field("imageMedium")
            .Resolve(c =>
                     PictureExtensions.GetPictureUrl(c.Parent <CatalogProduct>().ProductId, c.Parent <CatalogProduct>().Product.Picture,
                                                     PictureSize.MEDIUM))
            .Type <StringType>();

            descriptor
            .Field("imageSmall")
            .Resolve(c =>
                     PictureExtensions.GetPictureUrl(c.Parent <CatalogProduct>().ProductId, c.Parent <CatalogProduct>().Product.Picture,
                                                     PictureSize.SMALL))
            .Type <StringType>();

            descriptor
            .Field("isReturnable")
            .Resolve(c => c.Parent <CatalogProduct>().Product.ReturnableId.HasValue)
            .Type <BooleanType>();

            descriptor
            .Field("visibleTo")
            .Resolve(c => c.Parent <CatalogProduct>().Product.VisibleTo)
            .Authorize(Policies.PRODUCER);

            descriptor
            .Field("returnable")
            .UseDbContext <QueryDbContext>()
            .ResolveWith <CatalogProductResolvers>(c => c.GetReturnable(default, default, default))