Skip to content

Commit

Permalink
fix(core): Correctly update Seller custom fields
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Jun 12, 2023
1 parent 1faf5e3 commit 4a4691d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/core/src/service/services/seller.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { Seller } from '../../entity/seller/seller.entity';
import { EventBus, SellerEvent } from '../../event-bus/index';
import { CustomFieldRelationService } from '../helpers/custom-field-relation/custom-field-relation.service';
import { ListQueryBuilder } from '../helpers/list-query-builder/list-query-builder';
import { patchEntity } from '../helpers/utils/patch-entity';

/**
* @description
Expand Down Expand Up @@ -66,10 +67,8 @@ export class SellerService {

async update(ctx: RequestContext, input: UpdateSellerInput) {
const seller = await this.connection.getEntityOrThrow(ctx, Seller, input.id);
if (input.name) {
seller.name = input.name;
await this.connection.getRepository(ctx, Seller).save(seller);
}
const updatedSeller = patchEntity(seller, input);
await this.connection.getRepository(ctx, Seller).save(updatedSeller);
const sellerWithRelations = await this.customFieldRelationService.updateRelations(
ctx,
Seller,
Expand Down

0 comments on commit 4a4691d

Please sign in to comment.