@lomray/microservice-payment-stripe
Version:
Stripe payment microservice based on NodeJS & inverted json.
73 lines (69 loc) • 2.54 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');
let Customer = class Customer {
};
tslib.__decorate([
classValidatorJsonschema.JSONSchema({
example: 'cus_NZYV9mFrODGqkf',
}),
typeorm.PrimaryColumn({ type: 'varchar', length: 18 }),
classValidator.Length(1, 18),
tslib.__metadata("design:type", String)
], Customer.prototype, "customerId", void 0);
tslib.__decorate([
typeorm.Column({ type: 'varchar', length: 36 }),
typeorm.Unique(['userId']),
classValidator.Length(1, 36),
tslib.__metadata("design:type", String)
], Customer.prototype, "userId", void 0);
tslib.__decorate([
classValidatorJsonschema.JSONSchema({
description: 'Store data about stripe connected account and etc.',
example: {
accountId: 'acct_1LO435FpQjUWTpHe',
isVerified: true,
},
}),
typeorm.Column({ type: 'json', default: {} }),
classValidator.IsObject(),
microserviceHelpers.IsUndefinable(),
tslib.__metadata("design:type", Object)
], Customer.prototype, "params", void 0);
tslib.__decorate([
microserviceHelpers.IsTypeormDate(),
typeorm.CreateDateColumn(),
tslib.__metadata("design:type", Date)
], Customer.prototype, "createdAt", void 0);
tslib.__decorate([
microserviceHelpers.IsTypeormDate(),
typeorm.UpdateDateColumn(),
tslib.__metadata("design:type", Date)
], Customer.prototype, "updatedAt", void 0);
tslib.__decorate([
typeorm.OneToMany('Transaction', 'customer'),
tslib.__metadata("design:type", Array)
], Customer.prototype, "transactions", void 0);
tslib.__decorate([
typeorm.OneToMany('Card', 'customer'),
tslib.__metadata("design:type", Array)
], Customer.prototype, "cards", void 0);
tslib.__decorate([
typeorm.OneToMany('BankAccount', 'customer'),
tslib.__metadata("design:type", Array)
], Customer.prototype, "bankAccounts", void 0);
Customer = tslib.__decorate([
classValidatorJsonschema.JSONSchema({
properties: {
transactions: { $ref: '#/definitions/Transaction', type: 'array' },
cards: { $ref: '#/definitions/Card', type: 'array' },
bankAccounts: { $ref: '#/definitions/BankAccount', type: 'array' },
},
}),
typeorm.Entity()
], Customer);
var CustomerEntity = Customer;
module.exports = CustomerEntity;