UNPKG

@chevre/domain

Version:

Chevre Domain Library for Node.js

42 lines (41 loc) 2.12 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.call = call; const factory = require("../../factory"); const action_1 = require("../../repo/action"); const assetTransaction_1 = require("../../repo/assetTransaction"); const product_1 = require("../../repo/product"); const project_1 = require("../../repo/project"); const transactionNumber_1 = require("../../repo/transactionNumber"); const DeliveryService = require("../delivery"); /** * タスク実行関数 */ function call(data) { return (_a) => __awaiter(this, [_a], void 0, function* ({ redisClient, connection }) { if (redisClient === undefined) { throw new factory.errors.Argument('settings', 'redisClient required'); } const actionRepo = new action_1.ActionRepo(connection); const assetTransactionRepo = new assetTransaction_1.AssetTransactionRepo(connection); const productRepo = new product_1.ProductRepo(connection); const projectRepo = new project_1.ProjectRepo(connection); const transactionNumberRepo = new transactionNumber_1.TransactionNumberRepo({ redisClient, connection }); yield DeliveryService.givePointAward(data)({ action: actionRepo, assetTransaction: assetTransactionRepo, product: productRepo, project: projectRepo, transactionNumber: transactionNumberRepo }); }); }