Skip to content
This repository has been archived by the owner on Jun 15, 2024. It is now read-only.

Commit

Permalink
fix typo bug
Browse files Browse the repository at this point in the history
  • Loading branch information
matus-sabo committed Jan 14, 2020
1 parent 41a70b2 commit 62f0107
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Service, Action, Event, Method } from 'moleculer-decorators';
import * as Broker from '@first.broker/moleculer';
import { UserServiceTypes, V1apiServiceTypes } from '@first.broker/types';
import { UserServiceTypes, V1ApiServiceTypes } from '@first.broker/types';

interface V1ApiService {
name: 'api';
Expand All @@ -11,7 +11,7 @@ interface V1ApiService {
mixins: [],
})
class V1ApiService extends Broker.Service<{}>
implements V1apiServiceTypes.ServiceOwnActions {
implements V1ApiServiceTypes.ServiceOwnActions {
settings: any;
@Event({
name: Broker.eventName('user.nodeChange'),
Expand All @@ -27,8 +27,8 @@ class V1ApiService extends Broker.Service<{}>

@Action()
async request(
ctx: Broker.Context<V1apiServiceTypes.ActionParams<'request'>>,
): Promise<V1apiServiceTypes.ActionReturn<'request'>> {
ctx: Broker.Context<V1ApiServiceTypes.ActionParams<'request'>>,
): Promise<V1ApiServiceTypes.ActionReturn<'request'>> {
const params = ctx.params;
params.req;
params.res;
Expand All @@ -40,8 +40,8 @@ class V1ApiService extends Broker.Service<{}>

@Action()
async context(
ctx: Broker.Context<V1apiServiceTypes.ActionParams<'context'>>,
): Promise<V1apiServiceTypes.ActionReturn<'context'>> {
ctx: Broker.Context<V1ApiServiceTypes.ActionParams<'context'>>,
): Promise<V1ApiServiceTypes.ActionReturn<'context'>> {
const params = ctx.params;
params.account.id;
params.user.id;
Expand Down
File renamed without changes.
30 changes: 15 additions & 15 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ const capitalize = (s: string) => {
return s.charAt(0).toUpperCase() + s.slice(1);
};

const serviceTemplate = fs.readFileSync(
path.join(__dirname, 'templates', 'service.ts.mustache'),
const servicesTemplate = fs.readFileSync(
path.join(__dirname, 'templates', 'services.ts.mustache'),
'utf-8',
);

const serviceParamsSchemaTemplate = fs.readFileSync(
path.join(__dirname, 'templates', 'service.params.schema.ts.mustache'),
const servicesParamsSchemaTemplate = fs.readFileSync(
path.join(__dirname, 'templates', 'services.params.schema.ts.mustache'),
'utf-8',
);

const serviceParamsAssertTemplate = fs.readFileSync(
path.join(__dirname, 'templates', 'service.params.assert.ts.mustache'),
const servicesParamsAssertTemplate = fs.readFileSync(
path.join(__dirname, 'templates', 'services.params.assert.ts.mustache'),
'utf-8',
);

Expand Down Expand Up @@ -205,7 +205,7 @@ export async function generateBroker(options: GenerateBrokerOptions) {
});

// service types file content
const serviceTypesFileContent = Mustache.render(serviceTemplate, {
const serviceTypesFileContent = Mustache.render(servicesTemplate, {
services: services.map(({ path, name }) => {
return {
path,
Expand Down Expand Up @@ -292,30 +292,30 @@ export async function generateBroker(options: GenerateBrokerOptions) {
);

if (options.generateParamsAssert) {
const serviceParamsAssertFileContent = Mustache.render(
serviceParamsAssertTemplate,
const servicesParamsAssertFileContent = Mustache.render(
servicesParamsAssertTemplate,
{
callObj: Object.values(callObj),
},
);

await formatAndSave(
serviceParamsAssertFileContent,
path.join(outputDirFs, 'service.params.assert.ts'),
servicesParamsAssertFileContent,
path.join(outputDirFs, 'services.params.assert.ts'),
);
}

if (options.generateParamsSchema) {
const serviceParamsSchemaFileContent = Mustache.render(
serviceParamsSchemaTemplate,
const servicesParamsSchemaFileContent = Mustache.render(
servicesParamsSchemaTemplate,
{
callObj: Object.values(callObj),
},
);

await formatAndSave(
serviceParamsSchemaFileContent,
path.join(outputDirFs, 'service.params.schema.ts'),
servicesParamsSchemaFileContent,
path.join(outputDirFs, 'services.params.schema.ts'),
);
}
}

0 comments on commit 62f0107

Please sign in to comment.