Skip to content

Commit

Permalink
[framework] [frontend-api] universal product list (#2901)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitek-rostislav authored Dec 1, 2023
2 parents ba0afeb + 9334b53 commit bf6a413
Show file tree
Hide file tree
Showing 140 changed files with 2,173 additions and 4,269 deletions.
8 changes: 2 additions & 6 deletions app/config/cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,9 @@ services:
tags:
- { name: shopsys.cron, hours: '3', minutes: '0', instanceName: service, readableName: 'Download Heureka categories' }

App\Model\Product\Comparison\RemoveOldComparisonsCronModule:
Shopsys\FrameworkBundle\Model\Product\List\RemoveOldProductListsCronModule:
tags:
- { name: shopsys.cron, hours: '3', minutes: '0', instanceName: service, readableName: 'Delete old comparisons' }

App\Model\Wishlist\RemoveOldWishlistsCronModule:
tags:
- { name: shopsys.cron, hours: '3', minutes: '0', instanceName: service, readableName: 'Delete old wishlists' }
- { name: shopsys.cron, hours: '3', minutes: '0', instanceName: service, readableName: 'Delete old product lists' }

# This module should run as last because it creates multiple kernels and fake requests.
Shopsys\FrameworkBundle\Component\Error\ErrorPageCronModule:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ProductListTypeEnum:
type: enum
inherits:
- 'ProductListTypeEnumDecorator'

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ProductList:
type: object
inherits:
- 'ProductListDecorator'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ProductListInput:
type: input-object
inherits:
- 'ProductListInputDecorator'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ProductListUpdateInput:
type: input-object
inherits:
- 'ProductListUpdateInputDecorator'
11 changes: 0 additions & 11 deletions app/config/graphql/types/ModelType/Wishlist/Wishlist.types.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions app/config/graphql/types/Mutation/Mutation.types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,3 @@ Mutation:
- 'RegisterMutation'
- 'LoginMutation'
- 'OrderMutation'
- 'ComparisonMutation'
- 'WishlistMutation'

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions app/config/graphql/types/Query/Query.types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,4 @@ Query:
- 'GoPayQuery'
- 'LanguageConstantQuery'
- 'SettingsQuery'
- 'ComparisonQuery'
- 'SeoPageQuery'
- 'WishlistQuery'
11 changes: 0 additions & 11 deletions app/config/graphql/types/Query/Wishlist/WishlistQuery.types.yaml

This file was deleted.

6 changes: 3 additions & 3 deletions app/config/packages/overblog_dataloader.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ overblog_dataloader:
loaders:
productsVisibleByIdsBatchLoader:
alias: "products_visible_by_ids_batch_loader"
batch_load_fn: "@App\\FrontendApi\\Model\\Product\\ProductsBatchLoader:loadVisibleByIds"
batch_load_fn: "@Shopsys\\FrontendApiBundle\\Model\\Product\\BatchLoad\\ProductsBatchLoader:loadVisibleByIds"
productsVisibleAndSortedByIdsBatchLoader:
alias: "products_visible_and_sorted_by_ids_batch_loader"
batch_load_fn: "@App\\FrontendApi\\Model\\Product\\ProductsBatchLoader:loadVisibleAndSortedByIds"
batch_load_fn: "@Shopsys\\FrontendApiBundle\\Model\\Product\\BatchLoad\\ProductsBatchLoader:loadVisibleAndSortedByIds"
productsByEntitiesBatchLoader:
alias: "products_by_entities_batch_loader"
batch_load_fn: "@App\\FrontendApi\\Model\\Product\\ProductsBatchLoader:loadByEntities"
productsSellableByIdsBatchLoader:
alias: "products_sellable_by_ids_batch_loader"
batch_load_fn: "@App\\FrontendApi\\Model\\Product\\ProductsBatchLoader:loadSellableByIds"
batch_load_fn: "@Shopsys\\FrontendApiBundle\\Model\\Product\\BatchLoad\\ProductsBatchLoader:loadSellableByIds"
imagesBatchLoader:
alias: "images_batch_loader"
batch_load_fn: "@App\\FrontendApi\\Model\\Image\\ImagesBatchLoader:loadByBatchData"
Expand Down
6 changes: 6 additions & 0 deletions app/config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -930,3 +930,9 @@ services:
Psr\Http\Message\ServerRequestInterface:
factory: ['@Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory', 'createRequest']
arguments: ['@=service("request_stack").getMainRequest()']

Shopsys\FrontendApiBundle\Model\Product\BatchLoad\ProductsBatchLoader:
alias: App\FrontendApi\Model\Product\ProductsBatchLoader

Shopsys\FrameworkBundle\Model\Product\ProductElasticsearchProvider:
alias: App\Model\Product\ProductElasticsearchProvider
71 changes: 41 additions & 30 deletions app/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -591,13 +591,6 @@ type CompanyCustomerUser implements CustomerUser {
uuid: Uuid!
}

type Comparison {
"List of compared products"
products: [Product!]!
"Comparison identifier"
uuid: Uuid!
}

input ContactInput {
"Email address of the sender"
email: String!
Expand Down Expand Up @@ -816,6 +809,8 @@ input LoginInput {
email: String!
"The user password."
password: Password!
"Uuids of product lists that should be merged to the product lists of the user"
productListsUuids: [Uuid!]! = []
}

type LoginResult {
Expand Down Expand Up @@ -902,10 +897,8 @@ scalar Money
type Mutation {
"Fills cart based on a given order, possibly merging it with the current cart"
AddOrderItemsToCart(input: AddOrderItemsToCartInput!): Cart!
"Add product to Comparison and create if not exists."
addProductToComparison(comparisonUuid: Uuid, productUuid: Uuid!): Comparison!
"Add product to wishlist and create if not exists."
addProductToWishlist(productUuid: Uuid!, wishlistUuid: Uuid): Wishlist!
"Adds a product to a product list"
AddProductToList(input: ProductListUpdateInput!): ProductList!
"Add product to cart for future checkout"
AddToCart(input: AddToCartInput!): AddToCartResult!
"Apply new promo code for the future checkout"
Expand All @@ -918,10 +911,6 @@ type Mutation {
ChangePersonalData(input: ChangePersonalDataInput!): CustomerUser!
"Add a transport to the cart, or remove a transport from the cart"
ChangeTransportInCart(input: ChangeTransportInCartInput!): Cart!
"Remove all products from Comparison and remove it."
cleanComparison(comparisonUuid: Uuid): String!
"Remove all products from wishlist and remove it."
cleanWishlist(wishlistUuid: Uuid): Wishlist
"Send message to the site owner"
Contact(input: ContactInput!): Boolean!
"Creates complete order with products and addresses"
Expand All @@ -946,10 +935,10 @@ type Mutation {
Register(input: RegistrationDataInput!): LoginResult!
"Remove product from cart"
RemoveFromCart(input: RemoveFromCartInput!): Cart!
"Remove product from Comparison and if is Comparison empty remove it."
removeProductFromComparison(comparisonUuid: Uuid, productUuid: Uuid!): Comparison
"Remove product from wishlist and if is wishlist empty remove it."
removeProductFromWishlist(productUuid: Uuid!, wishlistUuid: Uuid): Wishlist
"Removes a product from a product list"
RemoveProductFromList(input: ProductListUpdateInput!): ProductList
"Removes the product list"
RemoveProductList(input: ProductListInput!): ProductList
"Remove already used promo code from cart"
RemovePromoCodeFromCart(input: RemovePromoCodeFromCartInput!): Cart!
"Request password recovery - email with hash will be sent"
Expand Down Expand Up @@ -1610,12 +1599,40 @@ type ProductFilterOptions {
parameters: [ParameterFilterOptionInterface!]
}

type ProductList {
"An array of the products in the list"
products: [Product!]!
"Product list type"
type: ProductListTypeEnum!
"Product list identifier"
uuid: Uuid!
}

"Paginated and ordered products"
interface ProductListable {
"Paginated and ordered products"
products(after: String, before: String, brandSlug: String, categorySlug: String, filter: ProductFilter, first: Int, flagSlug: String, last: Int, orderingMode: ProductOrderingModeEnum, search: String): ProductConnection!
}

input ProductListInput {
"Product list type"
type: ProductListTypeEnum!
"Product list identifier"
uuid: Uuid = null
}

"One of possible types of the product list"
enum ProductListTypeEnum {
WISHLIST
COMPARISON
}

input ProductListUpdateInput {
productListInput: ProductListInput!
"Product identifier"
productUuid: Uuid!
}

"One of possible ordering modes for product"
enum ProductOrderingModeEnum {
"Order by priority"
Expand Down Expand Up @@ -1694,8 +1711,6 @@ type Query {
"Returns category filtered using UUID or URL slug"
category(filter: ProductFilter, orderingMode: ProductOrderingModeEnum, urlSlug: String, uuid: Uuid): Category
CompanyCustomerUser: CompanyCustomerUser
"Get comparison by UUID or comparison of logged customer user."
comparison(uuid: Uuid): Comparison
"Returns information about cookies article"
cookiesArticle: ArticleSite
"Returns available countries"
Expand Down Expand Up @@ -1742,6 +1757,9 @@ type Query {
privacyPolicyArticle: ArticleSite
"Returns product filtered using UUID or URL slug"
product(urlSlug: String, uuid: Uuid): Product
"Find product list by UUID and type or if customer is logged, try find the the oldest list of the given type for the logged customer. The logged customer can also optionally pass the UUID of his product list."
productList(input: ProductListInput!): ProductList
productListsByType(productListType: ProductListTypeEnum!): [ProductList!]!
"Returns list of ordered products that can be paginated using `first`, `last`, `before` and `after` keywords"
products(after: String, before: String, brandSlug: String, categorySlug: String, filter: ProductFilter, first: Int, flagSlug: String, last: Int, orderingMode: ProductOrderingModeEnum, search: String): ProductConnection!
"Returns list of products by catalog numbers"
Expand Down Expand Up @@ -1774,8 +1792,6 @@ type Query {
"Returns available transport methods based on the current cart state"
transports(cartUuid: Uuid): [Transport!]!
Variant: Variant
"Get wishlist by uuid or if customer is logged, try find for logged customer."
wishlist(wishlistUuid: Uuid): Wishlist
}

input RecoverPasswordInput {
Expand Down Expand Up @@ -1822,6 +1838,8 @@ input RegistrationDataInput {
password: Password!
"Billing address zip code (will be on the tax invoice)"
postcode: String!
"Uuids of product lists that should be merged to the product lists of the user after registration"
productListsUuids: [Uuid!]! = []
"Billing address street name (will be on the tax invoice)"
street: String!
"The customer's telephone number"
Expand Down Expand Up @@ -2213,10 +2231,3 @@ type VideoToken {
description: String!
token: String!
}

type Wishlist {
"List of wishlist products"
products: [Product!]!
"Wishlist identifier"
uuid: Uuid!
}
52 changes: 0 additions & 52 deletions app/src/Component/Elasticsearch/MultipleSearchQuery.php

This file was deleted.

Loading

0 comments on commit bf6a413

Please sign in to comment.