173 lines
7.2 KiB
JavaScript
173 lines
7.2 KiB
JavaScript
"use strict";
|
||
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);
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.UserFinancialProductModel = exports.HoldingStatus = exports.HoldingSource = void 0;
|
||
const openapi = require("@nestjs/swagger");
|
||
const typeorm_1 = require("typeorm");
|
||
const _base_model_1 = require("./_base_model");
|
||
const swagger_1 = require("@nestjs/swagger");
|
||
const class_validator_1 = require("class-validator");
|
||
const user_model_1 = require("./user.model");
|
||
const financial_product_model_1 = require("./financial_product.model");
|
||
var HoldingSource;
|
||
(function (HoldingSource) {
|
||
HoldingSource[HoldingSource["Purchase"] = 1] = "Purchase";
|
||
HoldingSource[HoldingSource["Gift"] = 2] = "Gift";
|
||
})(HoldingSource || (exports.HoldingSource = HoldingSource = {}));
|
||
var HoldingStatus;
|
||
(function (HoldingStatus) {
|
||
HoldingStatus[HoldingStatus["Unpaid"] = 0] = "Unpaid";
|
||
HoldingStatus[HoldingStatus["Earning"] = 1] = "Earning";
|
||
HoldingStatus[HoldingStatus["Matured"] = 2] = "Matured";
|
||
})(HoldingStatus || (exports.HoldingStatus = HoldingStatus = {}));
|
||
let UserFinancialProductModel = class UserFinancialProductModel extends _base_model_1.BaseModel {
|
||
userId;
|
||
financialProductId;
|
||
name;
|
||
period;
|
||
principal;
|
||
yieldRate;
|
||
source;
|
||
status;
|
||
expireTime;
|
||
user;
|
||
financialProduct;
|
||
static _OPENAPI_METADATA_FACTORY() {
|
||
return { userId: { required: true, type: () => Number }, financialProductId: { required: true, type: () => Number }, name: { required: true, type: () => String }, period: { required: true, type: () => Number }, principal: { required: true, type: () => String }, yieldRate: { required: true, type: () => String }, source: { required: true, enum: require("./user_financial_product.model").HoldingSource }, status: { required: true, enum: require("./user_financial_product.model").HoldingStatus }, expireTime: { required: true, type: () => Number }, user: { required: false, type: () => require("./user.model").UserModel }, financialProduct: { required: false, type: () => require("./financial_product.model").FinancialProductModel } };
|
||
}
|
||
};
|
||
exports.UserFinancialProductModel = UserFinancialProductModel;
|
||
__decorate([
|
||
(0, swagger_1.ApiProperty)({ description: '用户 ID' }),
|
||
(0, class_validator_1.IsInt)(),
|
||
(0, class_validator_1.IsNotEmpty)(),
|
||
(0, typeorm_1.Column)({
|
||
type: 'int',
|
||
unsigned: true,
|
||
comment: '用户 ID',
|
||
}),
|
||
__metadata("design:type", Number)
|
||
], UserFinancialProductModel.prototype, "userId", void 0);
|
||
__decorate([
|
||
(0, swagger_1.ApiProperty)({ description: '理财产品 ID' }),
|
||
(0, class_validator_1.IsInt)(),
|
||
(0, class_validator_1.IsNotEmpty)(),
|
||
(0, typeorm_1.Column)({
|
||
type: 'int',
|
||
comment: '理财产品 ID',
|
||
}),
|
||
__metadata("design:type", Number)
|
||
], UserFinancialProductModel.prototype, "financialProductId", void 0);
|
||
__decorate([
|
||
(0, swagger_1.ApiProperty)({ description: '名称' }),
|
||
(0, class_validator_1.IsString)(),
|
||
(0, class_validator_1.IsNotEmpty)(),
|
||
(0, typeorm_1.Column)({
|
||
type: 'varchar',
|
||
comment: '名称',
|
||
}),
|
||
__metadata("design:type", String)
|
||
], UserFinancialProductModel.prototype, "name", void 0);
|
||
__decorate([
|
||
(0, swagger_1.ApiProperty)({ description: '周期(单位:天)' }),
|
||
(0, class_validator_1.IsInt)(),
|
||
(0, class_validator_1.IsNotEmpty)(),
|
||
(0, typeorm_1.Column)({
|
||
type: 'int',
|
||
comment: '周期(单位:天)',
|
||
}),
|
||
__metadata("design:type", Number)
|
||
], UserFinancialProductModel.prototype, "period", void 0);
|
||
__decorate([
|
||
(0, swagger_1.ApiProperty)({ description: '本金' }),
|
||
(0, class_validator_1.IsDecimal)(),
|
||
(0, class_validator_1.IsNotEmpty)(),
|
||
(0, typeorm_1.Column)({
|
||
type: 'decimal',
|
||
precision: 20,
|
||
scale: 6,
|
||
comment: '本金',
|
||
}),
|
||
__metadata("design:type", String)
|
||
], UserFinancialProductModel.prototype, "principal", void 0);
|
||
__decorate([
|
||
(0, swagger_1.ApiProperty)({ description: '收益率(%)' }),
|
||
(0, class_validator_1.IsDecimal)(),
|
||
(0, typeorm_1.Column)({
|
||
type: 'decimal',
|
||
precision: 10,
|
||
scale: 4,
|
||
comment: '收益率(%)',
|
||
}),
|
||
__metadata("design:type", String)
|
||
], UserFinancialProductModel.prototype, "yieldRate", void 0);
|
||
__decorate([
|
||
(0, swagger_1.ApiProperty)({
|
||
description: '来源:1=购买,2=获赠',
|
||
enum: HoldingSource,
|
||
}),
|
||
(0, typeorm_1.Column)({
|
||
type: 'int',
|
||
comment: '来源:1=购买,2=获赠',
|
||
}),
|
||
__metadata("design:type", Number)
|
||
], UserFinancialProductModel.prototype, "source", void 0);
|
||
__decorate([
|
||
(0, swagger_1.ApiProperty)({
|
||
description: '状态:0=未付款,1=收益中(已付款),2=已到期',
|
||
enum: HoldingStatus,
|
||
}),
|
||
(0, typeorm_1.Column)({
|
||
type: 'int',
|
||
default: HoldingStatus.Unpaid,
|
||
comment: '状态:0=未付款,1=收益中(已付款),2=已到期',
|
||
}),
|
||
__metadata("design:type", Number)
|
||
], UserFinancialProductModel.prototype, "status", void 0);
|
||
__decorate([
|
||
(0, swagger_1.ApiProperty)({ description: '到期时间(时间戳)' }),
|
||
(0, class_validator_1.IsInt)(),
|
||
(0, typeorm_1.Column)({
|
||
type: 'int',
|
||
comment: '到期时间(时间戳)',
|
||
}),
|
||
__metadata("design:type", Number)
|
||
], UserFinancialProductModel.prototype, "expireTime", void 0);
|
||
__decorate([
|
||
(0, swagger_1.ApiPropertyOptional)({
|
||
description: '用户',
|
||
type: user_model_1.UserModel,
|
||
nullable: true,
|
||
}),
|
||
(0, typeorm_1.OneToOne)(() => user_model_1.UserModel, {
|
||
createForeignKeyConstraints: false,
|
||
}),
|
||
(0, typeorm_1.JoinColumn)(),
|
||
__metadata("design:type", user_model_1.UserModel)
|
||
], UserFinancialProductModel.prototype, "user", void 0);
|
||
__decorate([
|
||
(0, swagger_1.ApiPropertyOptional)({
|
||
description: '理财产品',
|
||
type: financial_product_model_1.FinancialProductModel,
|
||
nullable: true,
|
||
}),
|
||
(0, typeorm_1.OneToOne)(() => financial_product_model_1.FinancialProductModel, {
|
||
createForeignKeyConstraints: false,
|
||
}),
|
||
(0, typeorm_1.JoinColumn)(),
|
||
__metadata("design:type", financial_product_model_1.FinancialProductModel)
|
||
], UserFinancialProductModel.prototype, "financialProduct", void 0);
|
||
exports.UserFinancialProductModel = UserFinancialProductModel = __decorate([
|
||
(0, typeorm_1.Entity)({
|
||
comment: '用户持有理财产品',
|
||
})
|
||
], UserFinancialProductModel);
|
||
//# sourceMappingURL=user_financial_product.model.js.map
|