Przeglądaj źródła

feat(server): create ProductCategory entity, service, resolver

Relates to #43
Michael Bromley 7 lat temu
rodzic
commit
cd4c87f521

Plik diff jest za duży
+ 0 - 0
schema.json


+ 2 - 0
server/src/api/api.module.ts

@@ -23,6 +23,7 @@ import { CustomerResolver } from './resolvers/customer.resolver';
 import { FacetResolver } from './resolvers/facet.resolver';
 import { OrderResolver } from './resolvers/order.resolver';
 import { PaymentMethodResolver } from './resolvers/payment-method.resolver';
+import { ProductCategoryResolver } from './resolvers/product-category.resolver';
 import { ProductOptionResolver } from './resolvers/product-option.resolver';
 import { ProductResolver } from './resolvers/product.resolver';
 import { PromotionResolver } from './resolvers/promotion.resolver';
@@ -47,6 +48,7 @@ const exportedProviders = [
     PaymentMethodResolver,
     ProductOptionResolver,
     ProductResolver,
+    ProductCategoryResolver,
     RoleResolver,
     ShippingMethodResolver,
     TaxCategoryResolver,

+ 62 - 0
server/src/api/resolvers/product-category.resolver.ts

@@ -0,0 +1,62 @@
+import { Args, Mutation, Query, Resolver } from '@nestjs/graphql';
+import {
+    CreateProductCategoryMutationArgs,
+    Permission,
+    ProductCategoriesQueryArgs,
+    ProductCategoryQueryArgs,
+    UpdateProductCategoryMutationArgs,
+} from 'shared/generated-types';
+import { PaginatedList } from 'shared/shared-types';
+
+import { Translated } from '../../common/types/locale-types';
+import { ProductCategory } from '../../entity/product-category/product-category.entity';
+import { ProductCategoryService } from '../../service/services/product-category.service';
+import { RequestContext } from '../common/request-context';
+import { Allow } from '../decorators/allow.decorator';
+import { Decode } from '../decorators/decode.decorator';
+import { Ctx } from '../decorators/request-context.decorator';
+
+@Resolver('ProductCategory')
+export class ProductCategoryResolver {
+    constructor(private productCategoryService: ProductCategoryService) {}
+
+    @Query()
+    @Allow(Permission.ReadCatalog, Permission.Public)
+    async productCategories(
+        @Ctx() ctx: RequestContext,
+        @Args() args: ProductCategoriesQueryArgs,
+    ): Promise<PaginatedList<Translated<ProductCategory>>> {
+        return this.productCategoryService.findAll(ctx, args.options || undefined);
+    }
+
+    @Query()
+    @Allow(Permission.ReadCatalog, Permission.Public)
+    async productCategory(
+        @Ctx() ctx: RequestContext,
+        @Args() args: ProductCategoryQueryArgs,
+    ): Promise<Translated<ProductCategory> | undefined> {
+        return this.productCategoryService.findOne(ctx, args.id);
+    }
+
+    @Mutation()
+    @Allow(Permission.CreateCatalog)
+    @Decode('assetIds', 'featuredAssetId')
+    async createProductCategory(
+        @Ctx() ctx: RequestContext,
+        @Args() args: CreateProductCategoryMutationArgs,
+    ): Promise<Translated<ProductCategory>> {
+        const { input } = args;
+        return this.productCategoryService.create(ctx, input);
+    }
+
+    @Mutation()
+    @Allow(Permission.UpdateCatalog)
+    @Decode('assetIds', 'featuredAssetId')
+    async updateProductCategory(
+        @Ctx() ctx: RequestContext,
+        @Args() args: UpdateProductCategoryMutationArgs,
+    ): Promise<Translated<ProductCategory>> {
+        const { input } = args;
+        return this.productCategoryService.update(ctx, input);
+    }
+}

+ 39 - 0
server/src/api/types/product-category.graphql

@@ -0,0 +1,39 @@
+type Query {
+    productCategories(languageCode: LanguageCode, options: ProductCategoryListOptions): ProductCategoryList!
+    productCategory(id: ID!, languageCode: LanguageCode): ProductCategory
+}
+
+type Mutation {
+    "Create a new ProductCategory"
+    createProductCategory(input: CreateProductCategoryInput!): ProductCategory!
+
+    "Update an existing ProductCategory"
+    updateProductCategory(input: UpdateProductCategoryInput!): ProductCategory!
+}
+
+type ProductCategoryList implements PaginatedList {
+    items: [ProductCategory!]!
+    totalItems: Int!
+}
+
+input ProductCategoryListOptions {
+    take: Int
+    skip: Int
+    sort: ProductCategorySortParameter
+    filter: ProductCategoryFilterParameter
+}
+
+input ProductCategorySortParameter {
+    id: SortOrder
+    createdAt: SortOrder
+    updatedAt: SortOrder
+    name: SortOrder
+    description: SortOrder
+}
+
+input ProductCategoryFilterParameter {
+    name: StringOperators
+    description: StringOperators
+    createdAt: DateOperators
+    updatedAt: DateOperators
+}

+ 1 - 0
server/src/config/default-config.ts

@@ -78,6 +78,7 @@ export const defaultConfig: ReadOnlyRequired<VendureConfig> = {
         Facet: [],
         FacetValue: [],
         Product: [],
+        ProductCategory: [],
         ProductOption: [],
         ProductOptionGroup: [],
         ProductVariant: [],

+ 6 - 0
server/src/entity/custom-entity-fields.ts

@@ -24,6 +24,10 @@ export class CustomProductFields {}
 @Entity()
 export class CustomProductFieldsTranslation {}
 @Entity()
+export class CustomProductCategoryFields {}
+@Entity()
+export class CustomProductCategoryFieldsTranslation {}
+@Entity()
 export class CustomProductOptionFields {}
 @Entity()
 export class CustomProductOptionFieldsTranslation {}
@@ -151,6 +155,8 @@ export function registerCustomEntityFields(config: VendureConfig) {
     registerCustomFieldsForEntity(config, 'FacetValue', CustomFacetValueFieldsTranslation, true);
     registerCustomFieldsForEntity(config, 'Product', CustomProductFields);
     registerCustomFieldsForEntity(config, 'Product', CustomProductFieldsTranslation, true);
+    registerCustomFieldsForEntity(config, 'ProductCategory', CustomProductCategoryFields);
+    registerCustomFieldsForEntity(config, 'ProductCategory', CustomProductCategoryFieldsTranslation, true);
     registerCustomFieldsForEntity(config, 'ProductOption', CustomProductOptionFields);
     registerCustomFieldsForEntity(config, 'ProductOption', CustomProductOptionFieldsTranslation, true);
     registerCustomFieldsForEntity(config, 'ProductOptionGroup', CustomProductOptionGroupFields);

+ 4 - 0
server/src/entity/entities.ts

@@ -15,6 +15,8 @@ import { OrderLine } from './order-line/order-line.entity';
 import { Order } from './order/order.entity';
 import { PaymentMethod } from './payment-method/payment-method.entity';
 import { Payment } from './payment/payment.entity';
+import { ProductCategoryTranslation } from './product-category/product-category-translation.entity';
+import { ProductCategory } from './product-category/product-category.entity';
 import { ProductOptionGroupTranslation } from './product-option-group/product-option-group-translation.entity';
 import { ProductOptionGroup } from './product-option-group/product-option-group.entity';
 import { ProductOptionTranslation } from './product-option/product-option-translation.entity';
@@ -59,6 +61,8 @@ export const coreEntitiesMap = {
     Payment,
     PaymentMethod,
     Product,
+    ProductCategory,
+    ProductCategoryTranslation,
     ProductOption,
     ProductOptionGroup,
     ProductOptionGroupTranslation,

+ 29 - 0
server/src/entity/product-category/product-category-translation.entity.ts

@@ -0,0 +1,29 @@
+import { LanguageCode } from 'shared/generated-types';
+import { DeepPartial, HasCustomFields } from 'shared/shared-types';
+import { Column, Entity, ManyToOne } from 'typeorm';
+
+import { Translation } from '../../common/types/locale-types';
+import { VendureEntity } from '../base/base.entity';
+import { CustomProductCategoryFieldsTranslation } from '../custom-entity-fields';
+
+import { ProductCategory } from './product-category.entity';
+
+@Entity()
+export class ProductCategoryTranslation extends VendureEntity
+    implements Translation<ProductCategory>, HasCustomFields {
+    constructor(input?: DeepPartial<Translation<ProductCategory>>) {
+        super(input);
+    }
+
+    @Column('varchar') languageCode: LanguageCode;
+
+    @Column() name: string;
+
+    @Column() description: string;
+
+    @ManyToOne(type => ProductCategory, base => base.translations)
+    base: ProductCategory;
+
+    @Column(type => CustomProductCategoryFieldsTranslation)
+    customFields: CustomProductCategoryFieldsTranslation;
+}

+ 61 - 0
server/src/entity/product-category/product-category.entity.ts

@@ -0,0 +1,61 @@
+import { DeepPartial, HasCustomFields } from 'shared/shared-types';
+import {
+    Column,
+    Entity,
+    JoinTable,
+    ManyToMany,
+    ManyToOne,
+    OneToMany,
+    Tree,
+    TreeChildren,
+    TreeParent,
+} from 'typeorm';
+
+import { ChannelAware } from '../../common/types/common-types';
+import { LocaleString, Translatable, Translation } from '../../common/types/locale-types';
+import { Asset } from '../asset/asset.entity';
+import { VendureEntity } from '../base/base.entity';
+import { Channel } from '../channel/channel.entity';
+import { CustomProductCategoryFields } from '../custom-entity-fields';
+import { FacetValue } from '../facet-value/facet-value.entity';
+
+import { ProductCategoryTranslation } from './product-category-translation.entity';
+
+@Entity()
+@Tree('closure-table')
+export class ProductCategory extends VendureEntity implements Translatable, HasCustomFields, ChannelAware {
+    constructor(input?: DeepPartial<ProductCategory>) {
+        super(input);
+    }
+
+    name: LocaleString;
+
+    description: LocaleString;
+
+    @OneToMany(type => ProductCategoryTranslation, translation => translation.base, { eager: true })
+    translations: Array<Translation<ProductCategory>>;
+
+    @ManyToOne(type => Asset)
+    featuredAsset: Asset;
+
+    @ManyToMany(type => Asset)
+    @JoinTable()
+    assets: Asset[];
+
+    @ManyToMany(type => FacetValue)
+    @JoinTable()
+    facetValues: FacetValue[];
+
+    @Column(type => CustomProductCategoryFields)
+    customFields: CustomProductCategoryFields;
+
+    @TreeChildren()
+    children: ProductCategory[];
+
+    @TreeParent()
+    parent: ProductCategory;
+
+    @ManyToMany(type => Channel)
+    @JoinTable()
+    channels: Channel[];
+}

+ 43 - 0
server/src/entity/product-category/product-category.graphql

@@ -0,0 +1,43 @@
+type ProductCategory implements Node {
+    id: ID!
+    createdAt: DateTime!
+    updatedAt: DateTime!
+    languageCode: LanguageCode
+    name: String!
+    description: String!
+    featuredAsset: Asset
+    assets: [Asset!]!
+    parent: ProductCategory
+    children: [ProductCategory!]
+    facetValues: [FacetValue!]!
+    translations: [ProductCategoryTranslation!]!
+}
+
+type ProductCategoryTranslation {
+    id: ID!
+    createdAt: DateTime!
+    updatedAt: DateTime!
+    languageCode: LanguageCode!
+    name: String!
+    description: String!
+}
+
+input ProductCategoryTranslationInput {
+    id: ID
+    languageCode: LanguageCode!
+    name: String
+    description: String
+}
+
+input CreateProductCategoryInput {
+    featuredAssetId: ID
+    assetIds: [ID!]
+    translations: [ProductCategoryTranslationInput!]!
+}
+
+input UpdateProductCategoryInput {
+    id: ID!
+    featuredAssetId: ID
+    assetIds: [ID!]
+    translations: [ProductCategoryTranslationInput!]!
+}

+ 2 - 0
server/src/service/service.module.ts

@@ -24,6 +24,7 @@ import { FacetValueService } from './services/facet-value.service';
 import { FacetService } from './services/facet.service';
 import { OrderService } from './services/order.service';
 import { PaymentMethodService } from './services/payment-method.service';
+import { ProductCategoryService } from './services/product-category.service';
 import { ProductOptionGroupService } from './services/product-option-group.service';
 import { ProductOptionService } from './services/product-option.service';
 import { ProductVariantService } from './services/product-variant.service';
@@ -49,6 +50,7 @@ const exportedProviders = [
     FacetValueService,
     OrderService,
     PaymentMethodService,
+    ProductCategoryService,
     ProductOptionService,
     ProductOptionGroupService,
     ProductService,

+ 106 - 0
server/src/service/services/product-category.service.ts

@@ -0,0 +1,106 @@
+import { InjectConnection } from '@nestjs/typeorm';
+import {
+    CreateProductCategoryInput,
+    CreateProductInput,
+    UpdateProductCategoryInput,
+    UpdateProductInput,
+} from 'shared/generated-types';
+import { ID, PaginatedList } from 'shared/shared-types';
+import { Connection } from 'typeorm';
+
+import { RequestContext } from '../../api/common/request-context';
+import { ListQueryOptions } from '../../common/types/common-types';
+import { Translated } from '../../common/types/locale-types';
+import { assertFound } from '../../common/utils';
+import { ProductCategoryTranslation } from '../../entity/product-category/product-category-translation.entity';
+import { ProductCategory } from '../../entity/product-category/product-category.entity';
+import { ListQueryBuilder } from '../helpers/list-query-builder/list-query-builder';
+import { TranslatableSaver } from '../helpers/translatable-saver/translatable-saver';
+import { translateDeep } from '../helpers/utils/translate-entity';
+
+import { AssetService } from './asset.service';
+import { ChannelService } from './channel.service';
+
+export class ProductCategoryService {
+    constructor(
+        @InjectConnection() private connection: Connection,
+        private channelService: ChannelService,
+        private assetService: AssetService,
+        private listQueryBuilder: ListQueryBuilder,
+        private translatableSaver: TranslatableSaver,
+    ) {}
+
+    findAll(
+        ctx: RequestContext,
+        options?: ListQueryOptions<ProductCategory>,
+    ): Promise<PaginatedList<Translated<ProductCategory>>> {
+        const relations = ['featuredAsset', 'assets', 'facetValues', 'channels'];
+
+        return this.listQueryBuilder
+            .build(ProductCategory, options, relations, ctx.channelId)
+            .getManyAndCount()
+            .then(async ([productCategories, totalItems]) => {
+                const items = productCategories.map(productCategory =>
+                    translateDeep(productCategory, ctx.languageCode, ['facetValues']),
+                );
+                return {
+                    items,
+                    totalItems,
+                };
+            });
+    }
+
+    async findOne(ctx: RequestContext, productId: ID): Promise<Translated<ProductCategory> | undefined> {
+        const relations = ['featuredAsset', 'assets', 'facetValues', 'channels'];
+        const productCategory = await this.connection.manager.findOne(ProductCategory, productId, {
+            relations,
+        });
+        if (!productCategory) {
+            return;
+        }
+        return translateDeep(productCategory, ctx.languageCode, ['facetValues']);
+    }
+
+    async create(
+        ctx: RequestContext,
+        input: CreateProductCategoryInput,
+    ): Promise<Translated<ProductCategory>> {
+        const productCategory = await this.translatableSaver.create({
+            input,
+            entityType: ProductCategory,
+            translationType: ProductCategoryTranslation,
+            beforeSave: category => this.channelService.assignToChannels(category, ctx),
+        });
+        await this.saveAssetInputs(productCategory, input);
+        return assertFound(this.findOne(ctx, productCategory.id));
+    }
+
+    async update(
+        ctx: RequestContext,
+        input: UpdateProductCategoryInput,
+    ): Promise<Translated<ProductCategory>> {
+        const productCategory = await this.translatableSaver.update({
+            input,
+            entityType: ProductCategory,
+            translationType: ProductCategoryTranslation,
+        });
+        await this.saveAssetInputs(productCategory, input);
+        return assertFound(this.findOne(ctx, productCategory.id));
+    }
+
+    private async saveAssetInputs(productCategory: ProductCategory, input: any) {
+        if (input.assetIds || input.featuredAssetId) {
+            if (input.assetIds) {
+                const assets = await this.assetService.findByIds(input.assetIds);
+                productCategory.assets = assets;
+            }
+            if (input.featuredAssetId) {
+                const featuredAsset = await this.assetService.findOne(input.featuredAssetId);
+                if (featuredAsset) {
+                    productCategory.featuredAsset = featuredAsset;
+                }
+            }
+            await this.connection.manager.save(productCategory);
+        }
+    }
+}

+ 235 - 0
shared/generated-types.ts

@@ -66,6 +66,8 @@ export interface Query {
     eligibleShippingMethods: ShippingMethodQuote[];
     paymentMethods: PaymentMethodList;
     paymentMethod?: PaymentMethod | null;
+    productCategories: ProductCategoryList;
+    productCategory?: ProductCategory | null;
     productOptionGroups: ProductOptionGroup[];
     productOptionGroup?: ProductOptionGroup | null;
     products: ProductList;
@@ -470,6 +472,36 @@ export interface PaymentMethod extends Node {
     configArgs: ConfigArg[];
 }
 
+export interface ProductCategoryList extends PaginatedList {
+    items: ProductCategory[];
+    totalItems: number;
+}
+
+export interface ProductCategory extends Node {
+    id: string;
+    createdAt: DateTime;
+    updatedAt: DateTime;
+    languageCode?: LanguageCode | null;
+    name: string;
+    description: string;
+    featuredAsset?: Asset | null;
+    assets: Asset[];
+    parent?: ProductCategory | null;
+    children?: ProductCategory[] | null;
+    facetValues: FacetValue[];
+    translations: ProductCategoryTranslation[];
+    customFields?: Json | null;
+}
+
+export interface ProductCategoryTranslation {
+    id: string;
+    createdAt: DateTime;
+    updatedAt: DateTime;
+    languageCode: LanguageCode;
+    name: string;
+    description: string;
+}
+
 export interface ProductOptionGroup extends Node {
     id: string;
     createdAt: DateTime;
@@ -605,6 +637,8 @@ export interface Mutation {
     addPaymentToOrder?: Order | null;
     setCustomerForOrder?: Order | null;
     updatePaymentMethod: PaymentMethod;
+    createProductCategory: ProductCategory;
+    updateProductCategory: ProductCategory;
     createProductOptionGroup: ProductOptionGroup;
     updateProductOptionGroup: ProductOptionGroup;
     createProduct: Product;
@@ -819,6 +853,28 @@ export interface PaymentMethodFilterParameter {
     updatedAt?: DateOperators | null;
 }
 
+export interface ProductCategoryListOptions {
+    take?: number | null;
+    skip?: number | null;
+    sort?: ProductCategorySortParameter | null;
+    filter?: ProductCategoryFilterParameter | null;
+}
+
+export interface ProductCategorySortParameter {
+    id?: SortOrder | null;
+    createdAt?: SortOrder | null;
+    updatedAt?: SortOrder | null;
+    name?: SortOrder | null;
+    description?: SortOrder | null;
+}
+
+export interface ProductCategoryFilterParameter {
+    name?: StringOperators | null;
+    description?: StringOperators | null;
+    createdAt?: DateOperators | null;
+    updatedAt?: DateOperators | null;
+}
+
 export interface ProductListOptions {
     take?: number | null;
     skip?: number | null;
@@ -1122,6 +1178,29 @@ export interface ConfigArgInput {
     value: string;
 }
 
+export interface CreateProductCategoryInput {
+    featuredAssetId?: string | null;
+    assetIds?: string[] | null;
+    translations: ProductCategoryTranslationInput[];
+    customFields?: Json | null;
+}
+
+export interface ProductCategoryTranslationInput {
+    id?: string | null;
+    languageCode: LanguageCode;
+    name?: string | null;
+    description?: string | null;
+    customFields?: Json | null;
+}
+
+export interface UpdateProductCategoryInput {
+    id: string;
+    featuredAssetId?: string | null;
+    assetIds?: string[] | null;
+    translations: ProductCategoryTranslationInput[];
+    customFields?: Json | null;
+}
+
 export interface CreateProductOptionGroupInput {
     code: string;
     translations: ProductOptionGroupTranslationInput[];
@@ -1357,6 +1436,14 @@ export interface PaymentMethodsQueryArgs {
 export interface PaymentMethodQueryArgs {
     id: string;
 }
+export interface ProductCategoriesQueryArgs {
+    languageCode?: LanguageCode | null;
+    options?: ProductCategoryListOptions | null;
+}
+export interface ProductCategoryQueryArgs {
+    id: string;
+    languageCode?: LanguageCode | null;
+}
 export interface ProductOptionGroupsQueryArgs {
     languageCode?: LanguageCode | null;
     filterTerm?: string | null;
@@ -1512,6 +1599,12 @@ export interface SetCustomerForOrderMutationArgs {
 export interface UpdatePaymentMethodMutationArgs {
     input: UpdatePaymentMethodInput;
 }
+export interface CreateProductCategoryMutationArgs {
+    input: CreateProductCategoryInput;
+}
+export interface UpdateProductCategoryMutationArgs {
+    input: UpdateProductCategoryInput;
+}
 export interface CreateProductOptionGroupMutationArgs {
     input: CreateProductOptionGroupInput;
 }
@@ -1861,6 +1954,8 @@ export namespace QueryResolvers {
         eligibleShippingMethods?: EligibleShippingMethodsResolver<ShippingMethodQuote[], any, Context>;
         paymentMethods?: PaymentMethodsResolver<PaymentMethodList, any, Context>;
         paymentMethod?: PaymentMethodResolver<PaymentMethod | null, any, Context>;
+        productCategories?: ProductCategoriesResolver<ProductCategoryList, any, Context>;
+        productCategory?: ProductCategoryResolver<ProductCategory | null, any, Context>;
         productOptionGroups?: ProductOptionGroupsResolver<ProductOptionGroup[], any, Context>;
         productOptionGroup?: ProductOptionGroupResolver<ProductOptionGroup | null, any, Context>;
         products?: ProductsResolver<ProductList, any, Context>;
@@ -2104,6 +2199,28 @@ export namespace QueryResolvers {
         id: string;
     }
 
+    export type ProductCategoriesResolver<R = ProductCategoryList, Parent = any, Context = any> = Resolver<
+        R,
+        Parent,
+        Context,
+        ProductCategoriesArgs
+    >;
+    export interface ProductCategoriesArgs {
+        languageCode?: LanguageCode | null;
+        options?: ProductCategoryListOptions | null;
+    }
+
+    export type ProductCategoryResolver<R = ProductCategory | null, Parent = any, Context = any> = Resolver<
+        R,
+        Parent,
+        Context,
+        ProductCategoryArgs
+    >;
+    export interface ProductCategoryArgs {
+        id: string;
+        languageCode?: LanguageCode | null;
+    }
+
     export type ProductOptionGroupsResolver<R = ProductOptionGroup[], Parent = any, Context = any> = Resolver<
         R,
         Parent,
@@ -3348,6 +3465,102 @@ export namespace PaymentMethodResolvers {
     >;
 }
 
+export namespace ProductCategoryListResolvers {
+    export interface Resolvers<Context = any> {
+        items?: ItemsResolver<ProductCategory[], any, Context>;
+        totalItems?: TotalItemsResolver<number, any, Context>;
+    }
+
+    export type ItemsResolver<R = ProductCategory[], Parent = any, Context = any> = Resolver<
+        R,
+        Parent,
+        Context
+    >;
+    export type TotalItemsResolver<R = number, Parent = any, Context = any> = Resolver<R, Parent, Context>;
+}
+
+export namespace ProductCategoryResolvers {
+    export interface Resolvers<Context = any> {
+        id?: IdResolver<string, any, Context>;
+        createdAt?: CreatedAtResolver<DateTime, any, Context>;
+        updatedAt?: UpdatedAtResolver<DateTime, any, Context>;
+        languageCode?: LanguageCodeResolver<LanguageCode | null, any, Context>;
+        name?: NameResolver<string, any, Context>;
+        description?: DescriptionResolver<string, any, Context>;
+        featuredAsset?: FeaturedAssetResolver<Asset | null, any, Context>;
+        assets?: AssetsResolver<Asset[], any, Context>;
+        parent?: ParentResolver<ProductCategory | null, any, Context>;
+        children?: ChildrenResolver<ProductCategory[] | null, any, Context>;
+        facetValues?: FacetValuesResolver<FacetValue[], any, Context>;
+        translations?: TranslationsResolver<ProductCategoryTranslation[], any, Context>;
+        customFields?: CustomFieldsResolver<Json | null, any, Context>;
+    }
+
+    export type IdResolver<R = string, Parent = any, Context = any> = Resolver<R, Parent, Context>;
+    export type CreatedAtResolver<R = DateTime, Parent = any, Context = any> = Resolver<R, Parent, Context>;
+    export type UpdatedAtResolver<R = DateTime, Parent = any, Context = any> = Resolver<R, Parent, Context>;
+    export type LanguageCodeResolver<R = LanguageCode | null, Parent = any, Context = any> = Resolver<
+        R,
+        Parent,
+        Context
+    >;
+    export type NameResolver<R = string, Parent = any, Context = any> = Resolver<R, Parent, Context>;
+    export type DescriptionResolver<R = string, Parent = any, Context = any> = Resolver<R, Parent, Context>;
+    export type FeaturedAssetResolver<R = Asset | null, Parent = any, Context = any> = Resolver<
+        R,
+        Parent,
+        Context
+    >;
+    export type AssetsResolver<R = Asset[], Parent = any, Context = any> = Resolver<R, Parent, Context>;
+    export type ParentResolver<R = ProductCategory | null, Parent = any, Context = any> = Resolver<
+        R,
+        Parent,
+        Context
+    >;
+    export type ChildrenResolver<R = ProductCategory[] | null, Parent = any, Context = any> = Resolver<
+        R,
+        Parent,
+        Context
+    >;
+    export type FacetValuesResolver<R = FacetValue[], Parent = any, Context = any> = Resolver<
+        R,
+        Parent,
+        Context
+    >;
+    export type TranslationsResolver<
+        R = ProductCategoryTranslation[],
+        Parent = any,
+        Context = any
+    > = Resolver<R, Parent, Context>;
+    export type CustomFieldsResolver<R = Json | null, Parent = any, Context = any> = Resolver<
+        R,
+        Parent,
+        Context
+    >;
+}
+
+export namespace ProductCategoryTranslationResolvers {
+    export interface Resolvers<Context = any> {
+        id?: IdResolver<string, any, Context>;
+        createdAt?: CreatedAtResolver<DateTime, any, Context>;
+        updatedAt?: UpdatedAtResolver<DateTime, any, Context>;
+        languageCode?: LanguageCodeResolver<LanguageCode, any, Context>;
+        name?: NameResolver<string, any, Context>;
+        description?: DescriptionResolver<string, any, Context>;
+    }
+
+    export type IdResolver<R = string, Parent = any, Context = any> = Resolver<R, Parent, Context>;
+    export type CreatedAtResolver<R = DateTime, Parent = any, Context = any> = Resolver<R, Parent, Context>;
+    export type UpdatedAtResolver<R = DateTime, Parent = any, Context = any> = Resolver<R, Parent, Context>;
+    export type LanguageCodeResolver<R = LanguageCode, Parent = any, Context = any> = Resolver<
+        R,
+        Parent,
+        Context
+    >;
+    export type NameResolver<R = string, Parent = any, Context = any> = Resolver<R, Parent, Context>;
+    export type DescriptionResolver<R = string, Parent = any, Context = any> = Resolver<R, Parent, Context>;
+}
+
 export namespace ProductOptionGroupResolvers {
     export interface Resolvers<Context = any> {
         id?: IdResolver<string, any, Context>;
@@ -3660,6 +3873,8 @@ export namespace MutationResolvers {
         addPaymentToOrder?: AddPaymentToOrderResolver<Order | null, any, Context>;
         setCustomerForOrder?: SetCustomerForOrderResolver<Order | null, any, Context>;
         updatePaymentMethod?: UpdatePaymentMethodResolver<PaymentMethod, any, Context>;
+        createProductCategory?: CreateProductCategoryResolver<ProductCategory, any, Context>;
+        updateProductCategory?: UpdateProductCategoryResolver<ProductCategory, any, Context>;
         createProductOptionGroup?: CreateProductOptionGroupResolver<ProductOptionGroup, any, Context>;
         updateProductOptionGroup?: UpdateProductOptionGroupResolver<ProductOptionGroup, any, Context>;
         createProduct?: CreateProductResolver<Product, any, Context>;
@@ -4035,6 +4250,26 @@ export namespace MutationResolvers {
         input: UpdatePaymentMethodInput;
     }
 
+    export type CreateProductCategoryResolver<R = ProductCategory, Parent = any, Context = any> = Resolver<
+        R,
+        Parent,
+        Context,
+        CreateProductCategoryArgs
+    >;
+    export interface CreateProductCategoryArgs {
+        input: CreateProductCategoryInput;
+    }
+
+    export type UpdateProductCategoryResolver<R = ProductCategory, Parent = any, Context = any> = Resolver<
+        R,
+        Parent,
+        Context,
+        UpdateProductCategoryArgs
+    >;
+    export interface UpdateProductCategoryArgs {
+        input: UpdateProductCategoryInput;
+    }
+
     export type CreateProductOptionGroupResolver<
         R = ProductOptionGroup,
         Parent = any,

+ 1 - 0
shared/shared-types.ts

@@ -46,6 +46,7 @@ export interface CustomFields {
     Facet?: CustomFieldConfig[];
     FacetValue?: CustomFieldConfig[];
     Product?: CustomFieldConfig[];
+    ProductCategory?: CustomFieldConfig[];
     ProductOption?: CustomFieldConfig[];
     ProductOptionGroup?: CustomFieldConfig[];
     ProductVariant?: CustomFieldConfig[];

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików