@lomray/microservice-payment-stripe
Version:
Stripe payment microservice based on NodeJS & inverted json.
71 lines (67 loc) • 2.55 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 coupon = require('./coupon.js');
let PromoCode = class PromoCode {
};
tslib.__decorate([
classValidatorJsonschema.JSONSchema({
description: 'Field for storing id of according promo code entity created on payment service side',
}),
typeorm.PrimaryColumn({ type: 'varchar', length: 30 }),
tslib.__metadata("design:type", String)
], PromoCode.prototype, "promoCodeId", void 0);
tslib.__decorate([
typeorm.Column({ type: 'varchar', length: 8 }),
classValidator.Length(1, 8),
tslib.__metadata("design:type", String)
], PromoCode.prototype, "couponId", void 0);
tslib.__decorate([
classValidatorJsonschema.JSONSchema({
description: 'Maximum number of times this promo-code can be redeemed, in total, ' +
'across all customers, before it is no longer valid.',
}),
typeorm.Column({ type: 'int', default: null }),
microserviceHelpers.IsNullable(),
microserviceHelpers.IsUndefinable(),
classValidator.IsNumber(),
tslib.__metadata("design:type", Object)
], PromoCode.prototype, "maxRedemptions", void 0);
tslib.__decorate([
classValidatorJsonschema.JSONSchema({
description: 'The customer-facing code.',
}),
typeorm.Column({ type: 'varchar', length: 15 }),
classValidator.Length(1, 15),
microserviceHelpers.IsUndefinable(),
tslib.__metadata("design:type", String)
], PromoCode.prototype, "code", void 0);
tslib.__decorate([
microserviceHelpers.IsTypeormDate(),
typeorm.CreateDateColumn(),
tslib.__metadata("design:type", Date)
], PromoCode.prototype, "createdAt", void 0);
tslib.__decorate([
microserviceHelpers.IsTypeormDate(),
typeorm.UpdateDateColumn(),
tslib.__metadata("design:type", Date)
], PromoCode.prototype, "updatedAt", void 0);
tslib.__decorate([
typeorm.ManyToOne('Coupon', 'promoCodes'),
typeorm.JoinColumn({ name: 'couponId' }),
classValidator.ValidateNested(),
tslib.__metadata("design:type", coupon)
], PromoCode.prototype, "coupon", void 0);
PromoCode = tslib.__decorate([
classValidatorJsonschema.JSONSchema({
properties: {
coupon: { $ref: '#/definitions/Coupon' },
},
}),
typeorm.Entity()
], PromoCode);
var PromoCodeEntity = PromoCode;
module.exports = PromoCodeEntity;