Skip to content

Commit

Permalink
Fix product routes
Browse files Browse the repository at this point in the history
  • Loading branch information
belsman committed Jan 18, 2024
1 parent 1ff88da commit af38d61
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 55 deletions.
47 changes: 0 additions & 47 deletions src/app/core/components/navigation/navigation.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,52 +9,5 @@
{{ category.name }}
</vcl-navigation-label>
</vcl-navigation-item>

<!--<vcl-navigation-item >
<vcl-navigation-label class="navigation-item">
{{ "Navigation.NewIn" | translate }}
</vcl-navigation-label>
</vcl-navigation-item>
<vcl-navigation-item>
<vcl-navigation-label class="navigation-item">
{{ "Navigation.Clothing" | translate }}
</vcl-navigation-label>
</vcl-navigation-item>
<vcl-navigation-item (click)="this.navigate('/shoes')">
<vcl-navigation-label class="navigation-item">
{{ "Navigation.Shoes" | translate }}
</vcl-navigation-label>
</vcl-navigation-item> -->

<!--<vcl-navigation-item>
<vcl-navigation-label>
{{ 'Navigation.Accessories' | translate }}
</vcl-navigation-label>
</vcl-navigation-item>
<vcl-navigation-item>
<vcl-navigation-label>
{{ 'Navigation.Suit' | translate }}
</vcl-navigation-label>
</vcl-navigation-item>
<vcl-navigation-item>
<vcl-navigation-label>
{{ 'Navigation.Specials' | translate }}
</vcl-navigation-label>
</vcl-navigation-item>
<vcl-navigation-item>
<vcl-navigation-label>
{{ 'Navigation.Gifts' | translate }}
</vcl-navigation-label>
</vcl-navigation-item>
<vcl-navigation-item>
<vcl-navigation-label>
{{ 'Navigation.Children' | translate }}
</vcl-navigation-label>
</vcl-navigation-item>
<vcl-navigation-item>
<vcl-navigation-label>
{{ 'Navigation.Inspiration' | translate }}
</vcl-navigation-label>
</vcl-navigation-item>-->
</vcl-navigation>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export class ProductVariantsComponent {
) {}

onProductClicked(productId: string, varaintId: string) {
// TODO Refactor code for route.
this.router.navigateByUrl(`shoes/${productId}/variants/${varaintId}`);
this.router.navigateByUrl(`products/${productId}/variants/${varaintId}`);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class ProductsComponent {
}

onProductClicked(productId: string) {
this.router.navigateByUrl(`shoes/${productId}`)
this.router.navigateByUrl(`products/${productId}`)
}

}
Expand Down
6 changes: 4 additions & 2 deletions src/app/features/products/services/product.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
ProductsQueryGQL,
} from '../../../generated/graphql';

export const PRODUCT_LIST_LIMIT = 20;
export const PRODUCT_LIST_OFFSET = 4;

@Injectable({
providedIn: 'root',
Expand All @@ -17,8 +19,8 @@ export class ProductService {
products$ = this.productGQL
.fetch({
input: {
offset: 0,
limit: 10,
offset: PRODUCT_LIST_OFFSET * PRODUCT_LIST_LIMIT, // TODO Implementing pagination.
limit: PRODUCT_LIST_LIMIT,
filters: [
{
// TODO Refactor this code as In-house boilerplate code.
Expand Down
36 changes: 33 additions & 3 deletions src/app/generated/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5226,14 +5226,14 @@ export type ProductCategoryQueryQueryVariables = Exact<{
}>;


export type ProductCategoryQueryQuery = { __typename?: 'Query', catalog: { __typename?: 'CatalogQuery', product_category: { __typename?: 'CatalogProductCategoryQuery', Read?: { __typename?: 'ProtoIoRestorecommerceProductCategoryProductCategoryListResponse', details?: { __typename?: 'IoRestorecommerceProductCategoryProductCategoryListResponse', items?: Array<{ __typename?: 'IoRestorecommerceProductCategoryProductCategoryResponse', payload?: { __typename?: 'IoRestorecommerceProductCategoryProductCategory', id?: string | null, name?: string | null, description?: string | null, parent?: { __typename?: 'IoRestorecommerceProductCategoryParent', parentId?: string | null } | null } | null }> | null } | null } | null } } };
export type ProductCategoryQueryQuery = { __typename?: 'Query', catalog: { __typename?: 'CatalogQuery', product_category: { __typename?: 'CatalogProductCategoryQuery', Read?: { __typename?: 'ProtoIoRestorecommerceProductCategoryProductCategoryListResponse', details?: { __typename?: 'IoRestorecommerceProductCategoryProductCategoryListResponse', totalCount?: number | null, items?: Array<{ __typename?: 'IoRestorecommerceProductCategoryProductCategoryResponse', payload?: { __typename?: 'IoRestorecommerceProductCategoryProductCategory', id?: string | null, name?: string | null, description?: string | null, parent?: { __typename?: 'IoRestorecommerceProductCategoryParent', parentId?: string | null } | null, image?: { __typename?: 'IoRestorecommerceImageImage', filename?: string | null, caption?: string | null, url?: string | null } | null } | null, status?: { __typename?: 'IoRestorecommerceStatusStatus', code?: number | null, message?: string | null } | null }> | null, operationStatus?: { __typename?: 'IoRestorecommerceStatusOperationStatus', code?: number | null, message?: string | null } | null } | null } | null } } };

export type ProductsQueryQueryVariables = Exact<{
input: IIoRestorecommerceResourcebaseReadRequest;
}>;


export type ProductsQueryQuery = { __typename?: 'Query', catalog: { __typename?: 'CatalogQuery', product: { __typename?: 'CatalogProductQuery', Read?: { __typename?: 'ProtoIoRestorecommerceProductProductListResponse', details?: { __typename?: 'IoRestorecommerceProductProductListResponse', items?: Array<{ __typename?: 'IoRestorecommerceProductProductResponse', payload?: { __typename?: 'IoRestorecommerceProductProduct', id?: string | null, product?: { __typename?: 'IoRestorecommerceProductIndividualProduct', name?: string | null, description?: string | null, physical?: { __typename?: 'IoRestorecommerceProductPhysicalProduct', variants?: Array<{ __typename?: 'IoRestorecommerceProductPhysicalVariant', id?: string | null, name?: string | null, description?: string | null, stockKeepingUnit?: string | null, stockLevel?: number | null, parentVariantId?: string | null, price?: { __typename?: 'IoRestorecommercePricePrice', regularPrice?: number | null, sale?: boolean | null, salePrice?: number | null } | null, package?: { __typename?: 'IoRestorecommerceProductPackage', rotatable?: boolean | null, weightInKg?: number | null, sizeInCm?: { __typename?: 'IoRestorecommerceGeometryBoundingBox3D', height?: number | null, length?: number | null, width?: number | null } | null } | null, images?: Array<{ __typename?: 'IoRestorecommerceImageImage', id?: string | null, filename?: string | null, url?: string | null, caption?: string | null }> | null, properties?: Array<{ __typename?: 'IoRestorecommercePropertyProperty', id?: string | null, value?: string | null }> | null }> | null } | null } | null, meta?: { __typename?: 'IoRestorecommerceMetaMeta', owners?: Array<{ __typename?: 'IoRestorecommerceAttributeAttribute', id?: string | null, value?: string | null, attributes?: Array<{ __typename?: 'IoRestorecommerceAttributeAttribute', id?: string | null, value?: string | null }> | null }> | null } | null } | null }> | null } | null } | null } } };
export type ProductsQueryQuery = { __typename?: 'Query', catalog: { __typename?: 'CatalogQuery', product: { __typename?: 'CatalogProductQuery', Read?: { __typename?: 'ProtoIoRestorecommerceProductProductListResponse', details?: { __typename?: 'IoRestorecommerceProductProductListResponse', totalCount?: number | null, items?: Array<{ __typename?: 'IoRestorecommerceProductProductResponse', payload?: { __typename?: 'IoRestorecommerceProductProduct', id?: string | null, product?: { __typename?: 'IoRestorecommerceProductIndividualProduct', name?: string | null, description?: string | null, categoryId?: string | null, category?: { __typename?: 'IoRestorecommerceProductCategoryProductCategory', id?: string | null, name?: string | null, parent?: { __typename?: 'IoRestorecommerceProductCategoryParent', parentId?: string | null } | null } | null, physical?: { __typename?: 'IoRestorecommerceProductPhysicalProduct', variants?: Array<{ __typename?: 'IoRestorecommerceProductPhysicalVariant', id?: string | null, name?: string | null, description?: string | null, stockKeepingUnit?: string | null, stockLevel?: number | null, parentVariantId?: string | null, price?: { __typename?: 'IoRestorecommercePricePrice', regularPrice?: number | null, sale?: boolean | null, salePrice?: number | null } | null, package?: { __typename?: 'IoRestorecommerceProductPackage', rotatable?: boolean | null, weightInKg?: number | null, sizeInCm?: { __typename?: 'IoRestorecommerceGeometryBoundingBox3D', height?: number | null, length?: number | null, width?: number | null } | null } | null, images?: Array<{ __typename?: 'IoRestorecommerceImageImage', filename?: string | null, url?: string | null, caption?: string | null }> | null, properties?: Array<{ __typename?: 'IoRestorecommercePropertyProperty', id?: string | null, value?: string | null }> | null }> | null } | null } | null, meta?: { __typename?: 'IoRestorecommerceMetaMeta', owners?: Array<{ __typename?: 'IoRestorecommerceAttributeAttribute', id?: string | null, value?: string | null, attributes?: Array<{ __typename?: 'IoRestorecommerceAttributeAttribute', id?: string | null, value?: string | null }> | null }> | null } | null } | null, status?: { __typename?: 'IoRestorecommerceStatusStatus', code?: number | null, message?: string | null } | null }> | null, operationStatus?: { __typename?: 'IoRestorecommerceStatusOperationStatus', code?: number | null, message?: string | null } | null } | null } | null } } };

export const ProductCategoryQueryDocument = gql`
query ProductCategoryQuery($input: IIoRestorecommerceResourcebaseReadRequest!) {
Expand All @@ -5249,8 +5249,22 @@ export const ProductCategoryQueryDocument = gql`
parent {
parentId
}
image {
filename
caption
url
}
}
status {
code
message
}
}
totalCount
operationStatus {
code
message
}
}
}
}
Expand Down Expand Up @@ -5280,6 +5294,14 @@ export const ProductsQueryDocument = gql`
product {
name
description
categoryId
category {
id
name
parent {
parentId
}
}
physical {
variants {
id
Expand All @@ -5303,7 +5325,6 @@ export const ProductsQueryDocument = gql`
weightInKg
}
images {
id
filename
url
caption
Expand All @@ -5326,6 +5347,15 @@ export const ProductsQueryDocument = gql`
}
}
}
status {
code
message
}
}
totalCount
operationStatus {
code
message
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/app/gql/product.gql
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ query ProductsQuery($input: IIoRestorecommerceResourcebaseReadRequest!) {
product {
name
description
categoryId
category {
id
name
parent {
parentId
}
}
physical {
variants {
id
Expand Down

0 comments on commit af38d61

Please sign in to comment.