Skip to content

Commit

Permalink
fix: rename
Browse files Browse the repository at this point in the history
  • Loading branch information
richenlin committed Nov 10, 2023
1 parent 45f747b commit 738185d
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 12 deletions.
7 changes: 3 additions & 4 deletions src/component/BaseController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import { Koatty, KoattyContext } from 'koatty_core';
import { formatApiData } from '../util/Helper';
import { ApiInput, ApiOutput, IController } from './Component';
import { ApiInput, ApiOutput, IController } from './Components';

/**
* Base controller
Expand All @@ -33,10 +33,9 @@ export class BaseController implements IController {
/**
* init
*
* @protected
* @memberof BaseController
*/
protected init(...arg: any[]): void {
init(...arg: any[]): void {

}

Expand All @@ -52,7 +51,7 @@ export class BaseController implements IController {
*/
public ok(msg: string | ApiInput, data?: any, code = 0) {
const obj: ApiOutput = formatApiData(msg, data, code);
return Promise.resolve(obj);
return obj;
}

/**
Expand Down
13 changes: 10 additions & 3 deletions src/component/BaseService.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
/*
* @Description:
* @Usage:
* @Author: richen
* @Date: 2023-11-08 15:25:22
* @LastEditTime: 2023-11-10 09:16:35
*/
/**
* @ author: richen
* @ copyright: Copyright (c) - <richenlin(at)gmail.com>
* @ license: BSD (3-Clause)
* @ version: 2020-05-18 11:24:49
*/
import { Koatty } from 'koatty_core';
import { IService } from './Component';
import { IService } from './Components';

/**
* Base class
* Base service
*
* @export
* @class Base
Expand All @@ -32,7 +39,7 @@ export class BaseService implements IService {
* @protected
* @memberof BaseController
*/
protected init(...arg: any[]): void {
init(...arg: any[]): void {

}

Expand Down
7 changes: 7 additions & 0 deletions src/component/Component.ts → src/component/Components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ export function Controller(path = ""): ClassDecorator {
export interface IController {
readonly app: Koatty;
readonly ctx: KoattyContext;

init(...arg: any[]): void;

ok(msg: string | ApiInput, data?: any, code?: number): ApiOutput;
fail(msg: Error | string | ApiInput, data?: any, code?: number): void;
}

/**
Expand Down Expand Up @@ -111,6 +116,8 @@ export function Service(identifier?: string): ClassDecorator {
*/
export interface IService {
readonly app: Koatty;

init(...arg: any[]): void;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/core/Loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { AppEvent, AppEventArr, EventHookFunc, Koatty } from 'koatty_core';
import { LoadConfigs as loadConf } from "koatty_config";
import { Logger, LogLevelType, SetLogger } from "../util/Logger";
import { prevent } from "koatty_exception";
import { IMiddleware, IPlugin } from '../component/Component';
import { IMiddleware, IPlugin } from '../component/Components';
import { checkClass, Helper } from "../util/Helper";
import { IOCContainer, TAGGED_CLS } from "koatty_container";
import { COMPONENT_SCAN, CONFIGURATION_SCAN } from './Constants';
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @ version: 2020-05-18 10:43:05
*/
export * from "./core/Bootstrap";
export * from "./component/Component";
export * from "./component/Components";
export * from "./component/BaseService";
export * from "./component/BaseController";
export * from "koatty_core";
Expand Down
2 changes: 1 addition & 1 deletion src/middleware/PayloadMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @ license: BSD (3-Clause)
* @ version: 2020-05-18 11:16:22
*/
import { IMiddleware } from "../component/Component";
import { IMiddleware } from "../component/Components";
import { Koatty } from 'koatty_core';
import { Payload } from "koatty_payload";

Expand Down
2 changes: 1 addition & 1 deletion src/middleware/TraceMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @ license: BSD (3-Clause)
* @ version: 2020-05-18 11:16:22
*/
import { IMiddleware } from "../component/Component";
import { IMiddleware } from "../component/Components";
import { Koatty } from 'koatty_core';
import { Trace } from "koatty_trace";

Expand Down
2 changes: 1 addition & 1 deletion src/util/Helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @ version: 2020-05-10 11:49:15
*/
import { Helper } from "koatty_lib";
import { ApiOutput } from "../component/Component";
import { ApiOutput } from "../component/Components";
const STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
const ARGUMENT_NAMES = /([^\s,]+)/g;
// export Helper
Expand Down

0 comments on commit 738185d

Please sign in to comment.