How to use the typescript-rest.Preprocessor function in typescript-rest

To help you get started, we’ve selected a few typescript-rest examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vellengs / typerx / packages / server / src / modules / core / role.controller.ts View on Github external
LocalStrategyInfo,
  LoginResponse,
  ProfileResponse,
} from './dto/login.dto';
import { Appearance } from '../../types/appearance';
import { KeyValue } from '../../types/data.types';
import { CreateRoleDto, RoleResponse, EditRoleDto, PaginateRole } from './dto/role.dto';
import { RoleService } from './role.service';
import { interceptor } from '../../interceptor/interceptor';

/**
 * 角色管理.
 */
@Tags('core')
@Path('/api/role')
@Preprocessor(interceptor)
export class RoleController {
  @Context context: ServiceContext;
  constructor(private readonly service = new RoleService()) { }


  /**
   * 获取角色管理界面配置信息.
   */
  @Path('config')
  @GET
  async getConfig(): Promise {
    return this.service.getAppearance();
  }


  /**
github vellengs / typerx / packages / server / src / modules / core / log.controller.ts View on Github external
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();
  }

  /**
   * 搜索日志
   * @param keyword 关键词
github vellengs / typerx / packages / server / dist / modules / core / setting.controller.js View on Github external
__metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], SettingController.prototype, "get", null);
__decorate([
    typescript_rest_1.Path(':id'),
    typescript_rest_1.DELETE,
    __param(0, typescript_rest_1.PathParam('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], SettingController.prototype, "remove", null);
SettingController = __decorate([
    typescript_rest_swagger_1.Tags('core'),
    typescript_rest_1.Path('/api/setting'),
    typescript_rest_1.Preprocessor(interceptor_1.interceptor),
    __metadata("design:paramtypes", [Object])
], SettingController);
exports.SettingController = SettingController;
//# sourceMappingURL=setting.controller.js.map
github vellengs / typerx / packages / server / src / modules / core / menu.controller.ts View on Github external
ServiceContext,
  Preprocessor,
} from 'typescript-rest';
import { Tags } from 'typescript-rest-swagger';
import { MenuService } from './menu.service';
import { Appearance } from '../../types/appearance';
import { MenuResponse, CreateMenuDto, EditMenuDto, PaginateMenu } from './dto/menu.dto';
import { KeyValue, SelectorItem } from '../../types/data.types';
import { interceptor } from '../../interceptor/interceptor';

/**
 * 菜单接口.
 */
@Tags('core')
@Path('api/menu')
@Preprocessor(interceptor)
export class MenuController {
  @Context context: ServiceContext;
  constructor(private readonly service = new MenuService()) { }

  /**
   * 获取帐号管理界面配置信息.
   */
  @Path('config')
  @GET
  async getConfig(): Promise {
    return this.service.getAppearance();
  }

  @Path('permissions')
  @GET
  async getPermissionTags(): Promise> {
github vellengs / typerx / packages / server / src / modules / core / user.controller.ts View on Github external
LocalStrategyInfo,
  LoginResponse,
  ProfileResponse,
  UploadConfig,
} from './dto/login.dto';
import { LogService } from './log.service';
import { UserService } from './user.service';
import { EditProfileDto } from './dto/profile.dto';
import { interceptor } from '../../interceptor/interceptor';

/**
 * 系统接口.
 */
@Tags('core')
@Path('/user')
@Preprocessor(interceptor)
export class UserController {
  @Context context: ServiceContext;
  constructor(private readonly service = new UserService()) { }

  /**
   * 用户登陆
   * @param dto 用户登陆参数
   */
  @POST
  @Path('login')
  async login(dto: LoginDto): Promise {
    return this.service.login(this.context, dto);
  }

  /**
 * 更新帐号
github vellengs / typerx / packages / server / dist / modules / core / group.controller.js View on Github external
__metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], GroupController.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)
], GroupController.prototype, "get", null);
GroupController = __decorate([
    typescript_rest_swagger_1.Tags('core'),
    typescript_rest_1.Path('api/group'),
    typescript_rest_1.Preprocessor(interceptor_1.interceptor),
    __metadata("design:paramtypes", [Object])
], GroupController);
exports.GroupController = GroupController;
//# sourceMappingURL=group.controller.js.map
github vellengs / typerx / packages / server / src / modules / cms / custom.controller.ts View on Github external
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);
    }
github vellengs / typerx / packages / server / dist / modules / core / account.controller.js View on Github external
__decorate([
    typescript_rest_1.POST,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [account_dto_1.CreateAccountDto]),
    __metadata("design:returntype", Promise)
], AccountController.prototype, "create", null);
__decorate([
    typescript_rest_1.PUT,
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [account_dto_1.EditAccountDto]),
    __metadata("design:returntype", Promise)
], AccountController.prototype, "update", null);
__decorate([
    typescript_rest_1.Path('config'),
    typescript_rest_1.GET,
    typescript_rest_1.Preprocessor(interceptor_1.interceptor),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], AccountController.prototype, "getConfig", null);
__decorate([
    typescript_rest_1.Path('search'),
    typescript_rest_1.GET,
    __param(0, typescript_rest_1.QueryParam('keyword')),
    __param(1, typescript_rest_1.QueryParam('value')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, String]),
    __metadata("design:returntype", Promise)
], AccountController.prototype, "getAccountsByKeyword", null);
__decorate([
    typescript_rest_1.Path('role'),
    typescript_rest_1.POST,
github vellengs / typerx / packages / server / dist / modules / core / menu.controller.js View on Github external
__metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], MenuController.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)
], MenuController.prototype, "get", null);
MenuController = __decorate([
    typescript_rest_swagger_1.Tags('core'),
    typescript_rest_1.Path('api/menu'),
    typescript_rest_1.Preprocessor(interceptor_1.interceptor),
    __metadata("design:paramtypes", [Object])
], MenuController);
exports.MenuController = MenuController;
//# sourceMappingURL=menu.controller.js.map
github vellengs / typerx / packages / server / dist / modules / core / user.controller.js View on Github external
__metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, String]),
    __metadata("design:returntype", void 0)
], UserController.prototype, "umeditorUpload", null);
__decorate([
    typescript_rest_1.GET,
    typescript_rest_1.Path("upload"),
    __param(0, typescript_rest_1.QueryParam("action")),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], UserController.prototype, "uploadConfig", null);
UserController = __decorate([
    typescript_rest_swagger_1.Tags('core'),
    typescript_rest_1.Path('/user'),
    typescript_rest_1.Preprocessor(interceptor_1.interceptor),
    __metadata("design:paramtypes", [Object])
], UserController);
exports.UserController = UserController;
//# sourceMappingURL=user.controller.js.map