UNPKG

@dugongjs/nestjs-microservice-query

Version:

64 lines (63 loc) 3.03 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; import { AggregateQueryService } from "@dugongjs/nestjs"; import { Controller } from "@nestjs/common"; import { MessagePattern } from "@nestjs/microservices"; import { GET_AGGREGATE_IDS_TOKEN, GET_AGGREGATE_TOKEN, GET_AGGREGATE_TYPES_TOKEN, GET_DOMAIN_EVENTS_FOR_AGGREGATE_TOKEN } from "../tokens/aggregate-query.tokens.js"; let AggregateQueryController = class AggregateQueryController { constructor(aggregateQueryService) { this.aggregateQueryService = aggregateQueryService; } getAggregateTypes() { return this.aggregateQueryService.getAggregateTypes(); } getAggregateIds(args) { return this.aggregateQueryService.getAggregateIds(...args); } async getAggregate(args) { const aggregate = await this.aggregateQueryService.getAggregate(...args); if (aggregate === null) { return null; } return JSON.stringify(aggregate); } getDomainEventsForAggregate(args) { return this.aggregateQueryService.getDomainEventsForAggregate(...args); } }; __decorate([ MessagePattern(GET_AGGREGATE_TYPES_TOKEN), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise) ], AggregateQueryController.prototype, "getAggregateTypes", null); __decorate([ MessagePattern(GET_AGGREGATE_IDS_TOKEN), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", Promise) ], AggregateQueryController.prototype, "getAggregateIds", null); __decorate([ MessagePattern(GET_AGGREGATE_TOKEN), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", Promise) ], AggregateQueryController.prototype, "getAggregate", null); __decorate([ MessagePattern(GET_DOMAIN_EVENTS_FOR_AGGREGATE_TOKEN), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", Promise) ], AggregateQueryController.prototype, "getDomainEventsForAggregate", null); AggregateQueryController = __decorate([ Controller(), __metadata("design:paramtypes", [AggregateQueryService]) ], AggregateQueryController); export { AggregateQueryController };