@lomray/microservice-payment-stripe
Version:
Stripe payment microservice based on NodeJS & inverted json.
76 lines (72 loc) • 2.8 kB
JavaScript
;
var tslib = require('tslib');
var microserviceHelpers = require('@lomray/microservice-helpers');
var classValidator = require('class-validator');
var classValidatorJsonschema = require('class-validator-jsonschema');
var typeorm = require('typeorm');
var price = require('./price.js');
let Product = class Product {
};
tslib.__decorate([
classValidatorJsonschema.JSONSchema({
description: 'Field for storing id of according product entity created on payment service side',
}),
typeorm.PrimaryColumn({ type: 'varchar', length: 19 }),
classValidator.Length(1, 19),
tslib.__metadata("design:type", String)
], Product.prototype, "productId", void 0);
tslib.__decorate([
classValidatorJsonschema.JSONSchema({
description: 'Field for storing id of selling entity from application',
}),
typeorm.Column({ type: 'varchar', length: 36 }),
classValidator.Length(1, 36),
tslib.__metadata("design:type", String)
], Product.prototype, "entityId", void 0);
tslib.__decorate([
typeorm.Index('IDX_product_userId', ['userId']),
typeorm.Column({ type: 'varchar', length: 36, default: null }),
classValidator.Length(1, 36),
microserviceHelpers.IsNullable(),
microserviceHelpers.IsUndefinable(),
tslib.__metadata("design:type", Object)
], Product.prototype, "userId", void 0);
tslib.__decorate([
microserviceHelpers.IsTypeormDate(),
typeorm.CreateDateColumn(),
tslib.__metadata("design:type", Date)
], Product.prototype, "createdAt", void 0);
tslib.__decorate([
microserviceHelpers.IsTypeormDate(),
typeorm.UpdateDateColumn(),
tslib.__metadata("design:type", Date)
], Product.prototype, "updatedAt", void 0);
tslib.__decorate([
typeorm.OneToMany('Price', 'product'),
tslib.__metadata("design:type", price)
], Product.prototype, "price", void 0);
tslib.__decorate([
typeorm.OneToMany('Transaction', 'product'),
tslib.__metadata("design:type", Array)
], Product.prototype, "transactions", void 0);
tslib.__decorate([
classValidatorJsonschema.JSONSchema({
example: [{ couponId: 'id' }],
}),
classValidator.IsObject({ each: true }),
typeorm.ManyToMany('Coupon', 'products'),
tslib.__metadata("design:type", Array)
], Product.prototype, "coupons", void 0);
Product = tslib.__decorate([
classValidatorJsonschema.JSONSchema({
description: 'Entity for binding application entity with the according payment service entity',
properties: {
price: { $ref: '#/definitions/Price' },
transactions: { $ref: '#/definitions/Transaction', type: 'array' },
coupons: { $ref: '#/definitions/Coupon', type: 'array' },
},
}),
typeorm.Entity()
], Product);
var Product$1 = Product;
module.exports = Product$1;