瀏覽代碼

refactor(core): Simplify some methods

Michael Bromley 7 月之前
父節點
當前提交
e4c012fd9e

+ 5 - 6
packages/core/src/api/resolvers/admin/channel.resolver.ts

@@ -24,7 +24,10 @@ import { Transaction } from '../../decorators/transaction.decorator';
 
 @Resolver('Channel')
 export class ChannelResolver {
-    constructor(private channelService: ChannelService, private roleService: RoleService) {}
+    constructor(
+        private channelService: ChannelService,
+        private roleService: RoleService,
+    ) {}
 
     @Query()
     @Allow(Permission.ReadSettings, Permission.ReadChannel)
@@ -72,11 +75,7 @@ export class ChannelResolver {
         @Ctx() ctx: RequestContext,
         @Args() args: MutationUpdateChannelArgs,
     ): Promise<ErrorResultUnion<UpdateChannelResult, Channel>> {
-        const result = await this.channelService.update(ctx, args.input);
-        if (isGraphQlErrorResult(result)) {
-            return result;
-        }
-        return result;
+        return this.channelService.update(ctx, args.input);
     }
 
     @Transaction()

+ 2 - 8
packages/core/src/service/services/order.service.ts

@@ -1295,20 +1295,14 @@ export class OrderService {
 
     /**
      * @description
-     * Transitions the given {@link Payment} to a new state. If the order totalWithTax price is then
-     * covered by Payments, the Order state will be automatically transitioned to `PaymentSettled`
-     * or `PaymentAuthorized`.
+     * Transitions the given {@link Payment} to a new state.
      */
     async transitionPaymentToState(
         ctx: RequestContext,
         paymentId: ID,
         state: PaymentState,
     ): Promise<ErrorResultUnion<TransitionPaymentToStateResult, Payment>> {
-        const result = await this.paymentService.transitionToState(ctx, paymentId, state);
-        if (isGraphQlErrorResult(result)) {
-            return result;
-        }
-        return result;
+        return this.paymentService.transitionToState(ctx, paymentId, state);
     }
 
     /**