Update rpc.ts

fix: 按照midway规则解析service identifier name,解决MidwayDefinitionNotFoundError
This commit is contained in:
Wang Jianhui 2023-08-28 14:37:12 +08:00 committed by GitHub
parent 803335fc5d
commit 5b0826aa78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,7 @@ import {
import { ServiceBroker } from 'moleculer';
import { CoolRpcConfig } from '.';
import { CoolCoreException, CoolValidateException } from '@cool-midway/core';
import { camelCase } from '@midwayjs/core/dist/util/camelCase';
import { v1 as uuid } from 'uuid';
import { BaseRpcService } from './service/base';
import { CurdOption, MOLECYLER_KEY } from './decorator/rpc';
@ -155,7 +156,7 @@ export class CoolRpc {
const cls = await _this.app
.getApplicationContext()
.getAsync(_.lowerFirst(service));
.getAsync(camelCase(service));
const serviceInstance: BaseRpcService = new target();
Object.assign(serviceInstance, cls);
serviceInstance.setModel(_this.getModel(curdOption));