Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { GET, Path, PathParam, POST, PUT, DELETE, QueryParam, ServiceContext, Context } from 'typescript-rest';
import { Tags } from 'typescript-rest-swagger';
import { UISchema, PaginateResponse } from 'modex';
import { Db } from './../database';
import { Customer } from './../schemas';
import { Helper } from '../utils/helper';
/**
* * 获取客户信息
*
* @export
* @class CustomerController
*/
@Tags('crm')
@Path('/api/customer')
export class CustomerController {
@Context
context: ServiceContext;
/**
* 获取客户管理界面配置信息.
*/
@Path('config')
@GET
async getConfig(): Promise {
return Helper.getUISchema('Customer');
}
__param(2, typescript_rest_1.QueryParam('size')),
__param(3, typescript_rest_1.QueryParam('sort')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String, Number, Number, String]),
__metadata("design:returntype", Promise)
], LogController.prototype, "query", null);
__decorate([
typescript_rest_1.Path(':id'),
typescript_rest_1.GET,
__param(0, typescript_rest_1.PathParam('id')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", Promise)
], LogController.prototype, "get", null);
LogController = __decorate([
typescript_rest_swagger_1.Tags('core'),
typescript_rest_1.Path('/api/log'),
typescript_rest_1.Preprocessor(interceptor_1.interceptor),
__metadata("design:paramtypes", [Object])
], LogController);
exports.LogController = LogController;
//# sourceMappingURL=log.controller.js.map
typescript_rest_1.DELETE,
__param(0, typescript_rest_1.PathParam('id')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", Promise)
], AccountController.prototype, "remove", null);
__decorate([
typescript_rest_1.Path(':id'),
typescript_rest_1.GET,
__param(0, typescript_rest_1.PathParam('id')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", Promise)
], AccountController.prototype, "get", null);
AccountController = __decorate([
typescript_rest_swagger_1.Tags('core'),
typescript_rest_1.Path('/api/account'),
__metadata("design:paramtypes", [Object])
], AccountController);
exports.AccountController = AccountController;
//# sourceMappingURL=account.controller.js.map
QueryParam,
Context,
ServiceContext,
Preprocessor,
} from 'typescript-rest';
import { Tags } from 'typescript-rest-swagger';
import { WidgetService } from './widget.service';
import { Appearance } from '../../types/appearance';
import { WidgetResponse, CreateWidgetDto, EditWidgetDto, PaginateWidget } from './dto/widget.dto';
import { KeyValue } from '../../types/data.types';
import { interceptor } from '../../interceptor/interceptor';
/**
* 小部件接口.
*/
@Tags('cms')
@Path('api/widget')
@Preprocessor(interceptor)
export class WidgetController {
@Context context: ServiceContext;
constructor(private readonly service = new WidgetService()) { }
/**
* 获取小部件管理界面配置信息.
*/
@Path('config')
@GET
async getConfig(): Promise {
return this.service.getAppearance();
}
/**
import { GET, Path, PathParam, POST, PUT, DELETE, QueryParam, Context, ServiceContext, Preprocessor } from 'typescript-rest';
import { Tags } from 'typescript-rest-swagger';
import { Appearance } from './../../types/appearance';
import { CustomService } from './custom.service';
import { KeyValue } from '../../types/data.types';
import { CreateCustomDto, CustomResponse, EditCustomDto, PaginateCustom } from './dto/custom.dto';
import { interceptor } from '../../interceptor/interceptor';
@Tags('cms')
@Path('/api/custom')
@Preprocessor(interceptor)
export class CustomController {
@Context context: ServiceContext;
constructor(private readonly service = new CustomService()) { }
/**
*
* 获取自定义内容管理界面配置信息
* @param type 自定义内容集名
*/
@Path('config')
@GET
async getConfig(@QueryParam('type') type: string): Promise {
return this.service.getAppearance(type);
typescript_rest_1.DELETE,
__param(0, typescript_rest_1.PathParam('id')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", Promise)
], MediaController.prototype, "remove", null);
__decorate([
typescript_rest_1.Path(':id'),
typescript_rest_1.GET,
__param(0, typescript_rest_1.PathParam('id')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", Promise)
], MediaController.prototype, "get", null);
MediaController = __decorate([
typescript_rest_swagger_1.Tags('cms'),
typescript_rest_1.Path('api/media'),
typescript_rest_1.Preprocessor(interceptor_1.interceptor),
__metadata("design:paramtypes", [Object])
], MediaController);
exports.MediaController = MediaController;
//# sourceMappingURL=media.controller.js.map
'use strict';
import * as path from 'path';
import { Inject } from 'typescript-ioc';
import { DELETE, Errors, FileParam, FormParam, GET, Path, PathParam, POST, PUT, QueryParam, Return } from 'typescript-rest';
import * as swagger from 'typescript-rest-swagger';
import { MiddlewareService } from '../../service/middleware';
@Path('middleware')
@swagger.Tags('Middleware')
@swagger.Security('Bearer')
export class MiddlewareRest {
@Inject private service: MiddlewareService;
@GET
@Path('filters')
public filters(@QueryParam('name') name?: string): Promise> {
return this.service.list('filter', name);
}
@GET
@Path('interceptors/request')
public requestInterceptors(@QueryParam('name') name?: string): Promise> {
return this.service.list('interceptor/request', name);
}
typescript_rest_1.DELETE,
__param(0, typescript_rest_1.PathParam('id')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", Promise)
], DomainController.prototype, "remove", null);
__decorate([
typescript_rest_1.Path(':id'),
typescript_rest_1.GET,
__param(0, typescript_rest_1.PathParam('id')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", Promise)
], DomainController.prototype, "get", null);
DomainController = __decorate([
typescript_rest_swagger_1.Tags('base'),
typescript_rest_1.Path('/api/domain')
], DomainController);
exports.DomainController = DomainController;
//# sourceMappingURL=domain-controller.js.map
ServiceContext,
QueryParam,
PathParam,
Errors,
} from 'typescript-rest';
import { AutoWired, Inject } from 'typescript-ioc';
import { Tags } from 'typescript-rest-swagger';
import { PERMISSIONS } from '../security/permissions/consts';
import { Authorize } from '../security/authorize';
import { HooksRepositoryFactory, HooksRepository } from '../repositories/hooks-repository';
import { addOid } from '../utils/response-utils';
import Hook from '../utils/hook';
import logger from '../utils/logger';
@AutoWired
@Tags('hooks')
@Path('/hooks')
export class HooksController {
@Context
context: ServiceContext;
@Inject
hooksRepositoryFactory: HooksRepositoryFactory;
@Authorize({ permission: PERMISSIONS.HOOKS_READ })
@GET
async getHooks(@QueryParam('keyPathFilter') keyPath: string): Promise {
const hooksRepository = this.hooksRepositoryFactory.createRepository();
await this._setETagHeader(hooksRepository);
const allHooks = await hooksRepository.getHooks();
if (!keyPath) return allHooks;
import {
LoginDto,
LocalStrategyInfo,
LoginResponse,
ProfileResponse,
} from './dto/login.dto';
import { Appearance } from '../../types/appearance';
import { KeyValue } from '../../types/data.types';
import { LogService } from './log.service';
import { LogResponse, PaginateLog } from './dto/log.dto';
import { interceptor } from '../../interceptor/interceptor';
/**
* 系统日志.
*/
@Tags('core')
@Path('/api/log')
@Preprocessor(interceptor)
export class LogController {
@Context context: ServiceContext;
constructor(private readonly service = new LogService()) { }
/**
* 获取日志管理界面配置信息.
*/
@Path('config')
@GET
async getConfig(): Promise {
return this.service.getAppearance();
}
/**