503 lines
22 KiB
JavaScript
503 lines
22 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);
|
|
};
|
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.GeneratedRechargeController = void 0;
|
|
const openapi = require("@nestjs/swagger");
|
|
const common_1 = require("@nestjs/common");
|
|
const swagger_1 = require("@nestjs/swagger");
|
|
const api_1 = require("../../app/common/api");
|
|
const typeorm_1 = require("@nestjs/typeorm");
|
|
const typeorm_2 = require("typeorm");
|
|
const api_optional_decorator_1 = require("../../app/common/decorator/api_optional.decorator");
|
|
const class_validator_1 = require("class-validator");
|
|
const user_id_context_1 = require("../../app/common/context/user_id.context");
|
|
const order_by_enum_1 = require("../../app/common/enum/order_by.enum");
|
|
const expression_enum_1 = require("../../app/common/enum/expression.enum");
|
|
const class_transformer_1 = require("class-transformer");
|
|
const recharge_model_1 = require("../../model/recharge.model");
|
|
const ExtraExp = {
|
|
eq: (k, v) => {
|
|
return (0, typeorm_2.Equal)(v);
|
|
},
|
|
neq: (k, v) => {
|
|
return (0, typeorm_2.Not)(v);
|
|
},
|
|
gt: (k, v) => {
|
|
return (0, typeorm_2.MoreThan)(v);
|
|
},
|
|
egt: (k, v) => {
|
|
return (0, typeorm_2.MoreThanOrEqual)(v);
|
|
},
|
|
lt: (k, v) => {
|
|
return (0, typeorm_2.LessThan)(v);
|
|
},
|
|
elt: (k, v) => {
|
|
return (0, typeorm_2.LessThanOrEqual)(v);
|
|
},
|
|
between: (k, v) => {
|
|
const p = Array.isArray(v) ? v : `${v}`.split(',');
|
|
if (p.length < 2) {
|
|
return undefined;
|
|
}
|
|
if (typeof p[1] == 'undefined') {
|
|
throw new common_1.BadRequestException({
|
|
message: k + '字段,between查询参数错误需要用逗号分割',
|
|
});
|
|
}
|
|
return (0, typeorm_2.Between)(p[0], p[1]);
|
|
},
|
|
'not between': (k, v) => {
|
|
const p = Array.isArray(v) ? v : `${v}`.split(',');
|
|
if (p.length < 2) {
|
|
return undefined;
|
|
}
|
|
if (typeof p[1] == 'undefined') {
|
|
throw new common_1.BadRequestException({
|
|
message: k + '字段,between查询参数错误需要用逗号分割',
|
|
});
|
|
}
|
|
return (0, typeorm_2.Not)((0, typeorm_2.Between)(p[0], p[1]));
|
|
},
|
|
in: (k, v) => {
|
|
if (!Array.isArray(v)) {
|
|
v = `${v}`.split(',');
|
|
}
|
|
return (0, typeorm_2.In)(v);
|
|
},
|
|
'not in': (k, v) => {
|
|
if (!Array.isArray(v)) {
|
|
v = `${v}`.split(',');
|
|
}
|
|
return (0, typeorm_2.Not)((0, typeorm_2.In)(v));
|
|
},
|
|
like: (k, v) => {
|
|
return (0, typeorm_2.Like)(`%${v}%`);
|
|
},
|
|
slike: (k, v) => {
|
|
return (0, typeorm_2.Like)(`${v}%`);
|
|
},
|
|
elike: (k, v) => {
|
|
return (0, typeorm_2.Like)(`${v}%`);
|
|
},
|
|
};
|
|
class GeneratedRechargeFindOrderDto {
|
|
id;
|
|
createTime;
|
|
updateTime;
|
|
deleteTime;
|
|
channel;
|
|
amount;
|
|
innerOrderNo;
|
|
actualAmount;
|
|
status;
|
|
thirdPartyOrderNo;
|
|
remark;
|
|
}
|
|
__decorate([
|
|
(0, api_optional_decorator_1.ApiOptional)({ description: 'ID', enum: order_by_enum_1.OrderBy }),
|
|
(0, class_validator_1.IsEnum)(order_by_enum_1.OrderBy),
|
|
__metadata("design:type", String)
|
|
], GeneratedRechargeFindOrderDto.prototype, "id", void 0);
|
|
__decorate([
|
|
(0, api_optional_decorator_1.ApiOptional)({ description: '创建时间', enum: order_by_enum_1.OrderBy }),
|
|
(0, class_validator_1.IsEnum)(order_by_enum_1.OrderBy),
|
|
__metadata("design:type", String)
|
|
], GeneratedRechargeFindOrderDto.prototype, "createTime", void 0);
|
|
__decorate([
|
|
(0, api_optional_decorator_1.ApiOptional)({ description: '更新时间', enum: order_by_enum_1.OrderBy }),
|
|
(0, class_validator_1.IsEnum)(order_by_enum_1.OrderBy),
|
|
__metadata("design:type", String)
|
|
], GeneratedRechargeFindOrderDto.prototype, "updateTime", void 0);
|
|
__decorate([
|
|
(0, api_optional_decorator_1.ApiOptional)({ description: '删除时间', enum: order_by_enum_1.OrderBy }),
|
|
(0, class_validator_1.IsEnum)(order_by_enum_1.OrderBy),
|
|
__metadata("design:type", String)
|
|
], GeneratedRechargeFindOrderDto.prototype, "deleteTime", void 0);
|
|
__decorate([
|
|
(0, api_optional_decorator_1.ApiOptional)({ description: '充值渠道:1=微信,2=支付宝,3=云闪付,4=分享生活', enum: order_by_enum_1.OrderBy }),
|
|
(0, class_validator_1.IsEnum)(order_by_enum_1.OrderBy),
|
|
__metadata("design:type", String)
|
|
], GeneratedRechargeFindOrderDto.prototype, "channel", void 0);
|
|
__decorate([
|
|
(0, api_optional_decorator_1.ApiOptional)({ description: '充值金额', enum: order_by_enum_1.OrderBy }),
|
|
(0, class_validator_1.IsEnum)(order_by_enum_1.OrderBy),
|
|
__metadata("design:type", String)
|
|
], GeneratedRechargeFindOrderDto.prototype, "amount", void 0);
|
|
__decorate([
|
|
(0, api_optional_decorator_1.ApiOptional)({ description: '内部单号', enum: order_by_enum_1.OrderBy }),
|
|
(0, class_validator_1.IsEnum)(order_by_enum_1.OrderBy),
|
|
__metadata("design:type", String)
|
|
], GeneratedRechargeFindOrderDto.prototype, "innerOrderNo", void 0);
|
|
__decorate([
|
|
(0, api_optional_decorator_1.ApiOptional)({ description: '实际到账金额', enum: order_by_enum_1.OrderBy }),
|
|
(0, class_validator_1.IsEnum)(order_by_enum_1.OrderBy),
|
|
__metadata("design:type", String)
|
|
], GeneratedRechargeFindOrderDto.prototype, "actualAmount", void 0);
|
|
__decorate([
|
|
(0, api_optional_decorator_1.ApiOptional)({ description: '充值状态:0=待支付,1=支付成功,3=已关闭', enum: order_by_enum_1.OrderBy }),
|
|
(0, class_validator_1.IsEnum)(order_by_enum_1.OrderBy),
|
|
__metadata("design:type", String)
|
|
], GeneratedRechargeFindOrderDto.prototype, "status", void 0);
|
|
__decorate([
|
|
(0, api_optional_decorator_1.ApiOptional)({ description: '第三方订单号', enum: order_by_enum_1.OrderBy }),
|
|
(0, class_validator_1.IsEnum)(order_by_enum_1.OrderBy),
|
|
__metadata("design:type", String)
|
|
], GeneratedRechargeFindOrderDto.prototype, "thirdPartyOrderNo", void 0);
|
|
__decorate([
|
|
(0, api_optional_decorator_1.ApiOptional)({ description: '备注', enum: order_by_enum_1.OrderBy }),
|
|
(0, class_validator_1.IsEnum)(order_by_enum_1.OrderBy),
|
|
__metadata("design:type", String)
|
|
], GeneratedRechargeFindOrderDto.prototype, "remark", void 0);
|
|
class GeneratedRechargeFindRelationDto {
|
|
user;
|
|
}
|
|
__decorate([
|
|
(0, api_optional_decorator_1.ApiOptional)({ description: '' }),
|
|
(0, class_validator_1.IsBoolean)(),
|
|
__metadata("design:type", Boolean)
|
|
], GeneratedRechargeFindRelationDto.prototype, "user", void 0);
|
|
class GeneratedRechargeFindExpressionDto {
|
|
id;
|
|
createTime;
|
|
updateTime;
|
|
deleteTime;
|
|
channel;
|
|
amount;
|
|
innerOrderNo;
|
|
actualAmount;
|
|
status;
|
|
thirdPartyOrderNo;
|
|
remark;
|
|
}
|
|
__decorate([
|
|
(0, api_optional_decorator_1.ApiOptional)({ description: 'ID', enum: expression_enum_1.Expression }),
|
|
(0, class_validator_1.IsEnum)(expression_enum_1.Expression),
|
|
__metadata("design:type", String)
|
|
], GeneratedRechargeFindExpressionDto.prototype, "id", void 0);
|
|
__decorate([
|
|
(0, api_optional_decorator_1.ApiOptional)({ description: '创建时间', enum: expression_enum_1.Expression }),
|
|
(0, class_validator_1.IsEnum)(expression_enum_1.Expression),
|
|
__metadata("design:type", String)
|
|
], GeneratedRechargeFindExpressionDto.prototype, "createTime", void 0);
|
|
__decorate([
|
|
(0, api_optional_decorator_1.ApiOptional)({ description: '更新时间', enum: expression_enum_1.Expression }),
|
|
(0, class_validator_1.IsEnum)(expression_enum_1.Expression),
|
|
__metadata("design:type", String)
|
|
], GeneratedRechargeFindExpressionDto.prototype, "updateTime", void 0);
|
|
__decorate([
|
|
(0, api_optional_decorator_1.ApiOptional)({ description: '删除时间', enum: expression_enum_1.Expression }),
|
|
(0, class_validator_1.IsEnum)(expression_enum_1.Expression),
|
|
__metadata("design:type", String)
|
|
], GeneratedRechargeFindExpressionDto.prototype, "deleteTime", void 0);
|
|
__decorate([
|
|
(0, api_optional_decorator_1.ApiOptional)({ description: '充值渠道:1=微信,2=支付宝,3=云闪付,4=分享生活', enum: expression_enum_1.Expression }),
|
|
(0, class_validator_1.IsEnum)(expression_enum_1.Expression),
|
|
__metadata("design:type", String)
|
|
], GeneratedRechargeFindExpressionDto.prototype, "channel", void 0);
|
|
__decorate([
|
|
(0, api_optional_decorator_1.ApiOptional)({ description: '充值金额', enum: expression_enum_1.Expression }),
|
|
(0, class_validator_1.IsEnum)(expression_enum_1.Expression),
|
|
__metadata("design:type", String)
|
|
], GeneratedRechargeFindExpressionDto.prototype, "amount", void 0);
|
|
__decorate([
|
|
(0, api_optional_decorator_1.ApiOptional)({ description: '内部单号', enum: expression_enum_1.Expression }),
|
|
(0, class_validator_1.IsEnum)(expression_enum_1.Expression),
|
|
__metadata("design:type", String)
|
|
], GeneratedRechargeFindExpressionDto.prototype, "innerOrderNo", void 0);
|
|
__decorate([
|
|
(0, api_optional_decorator_1.ApiOptional)({ description: '实际到账金额', enum: expression_enum_1.Expression }),
|
|
(0, class_validator_1.IsEnum)(expression_enum_1.Expression),
|
|
__metadata("design:type", String)
|
|
], GeneratedRechargeFindExpressionDto.prototype, "actualAmount", void 0);
|
|
__decorate([
|
|
(0, api_optional_decorator_1.ApiOptional)({ description: '充值状态:0=待支付,1=支付成功,3=已关闭', enum: expression_enum_1.Expression }),
|
|
(0, class_validator_1.IsEnum)(expression_enum_1.Expression),
|
|
__metadata("design:type", String)
|
|
], GeneratedRechargeFindExpressionDto.prototype, "status", void 0);
|
|
__decorate([
|
|
(0, api_optional_decorator_1.ApiOptional)({ description: '第三方订单号', enum: expression_enum_1.Expression }),
|
|
(0, class_validator_1.IsEnum)(expression_enum_1.Expression),
|
|
__metadata("design:type", String)
|
|
], GeneratedRechargeFindExpressionDto.prototype, "thirdPartyOrderNo", void 0);
|
|
__decorate([
|
|
(0, api_optional_decorator_1.ApiOptional)({ description: '备注', enum: expression_enum_1.Expression }),
|
|
(0, class_validator_1.IsEnum)(expression_enum_1.Expression),
|
|
__metadata("design:type", String)
|
|
], GeneratedRechargeFindExpressionDto.prototype, "remark", void 0);
|
|
class GeneratedRechargeFindExtraDto {
|
|
expression;
|
|
order;
|
|
relations;
|
|
}
|
|
__decorate([
|
|
(0, api_optional_decorator_1.ApiOptional)({
|
|
description: '查询表达式',
|
|
example: { "id": "gt" },
|
|
type: GeneratedRechargeFindExpressionDto
|
|
}),
|
|
(0, class_transformer_1.Type)(() => GeneratedRechargeFindExpressionDto),
|
|
(0, class_validator_1.ValidateNested)(),
|
|
__metadata("design:type", GeneratedRechargeFindExpressionDto)
|
|
], GeneratedRechargeFindExtraDto.prototype, "expression", void 0);
|
|
__decorate([
|
|
(0, api_optional_decorator_1.ApiOptional)({
|
|
description: '指定字段排序',
|
|
example: { "id": "desc" },
|
|
type: [GeneratedRechargeFindOrderDto],
|
|
}),
|
|
(0, class_validator_1.IsArray)(),
|
|
(0, class_transformer_1.Type)(() => GeneratedRechargeFindOrderDto),
|
|
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
__metadata("design:type", Array)
|
|
], GeneratedRechargeFindExtraDto.prototype, "order", void 0);
|
|
__decorate([
|
|
(0, api_optional_decorator_1.ApiOptional)({
|
|
description: '查询关联数据',
|
|
type: GeneratedRechargeFindRelationDto,
|
|
}),
|
|
(0, class_transformer_1.Type)(() => GeneratedRechargeFindRelationDto),
|
|
(0, class_validator_1.ValidateNested)(),
|
|
__metadata("design:type", GeneratedRechargeFindRelationDto)
|
|
], GeneratedRechargeFindExtraDto.prototype, "relations", void 0);
|
|
class GeneratedRechargeFindWhereDto {
|
|
id;
|
|
createTime;
|
|
updateTime;
|
|
deleteTime;
|
|
channel;
|
|
amount;
|
|
innerOrderNo;
|
|
actualAmount;
|
|
status;
|
|
thirdPartyOrderNo;
|
|
remark;
|
|
}
|
|
__decorate([
|
|
(0, swagger_1.ApiPropertyOptional)({ description: 'ID' }),
|
|
(0, class_validator_1.Allow)(),
|
|
__metadata("design:type", Number)
|
|
], GeneratedRechargeFindWhereDto.prototype, "id", void 0);
|
|
__decorate([
|
|
(0, swagger_1.ApiPropertyOptional)({ description: '创建时间' }),
|
|
(0, class_validator_1.Allow)(),
|
|
__metadata("design:type", String)
|
|
], GeneratedRechargeFindWhereDto.prototype, "createTime", void 0);
|
|
__decorate([
|
|
(0, swagger_1.ApiPropertyOptional)({ description: '更新时间' }),
|
|
(0, class_validator_1.Allow)(),
|
|
__metadata("design:type", String)
|
|
], GeneratedRechargeFindWhereDto.prototype, "updateTime", void 0);
|
|
__decorate([
|
|
(0, swagger_1.ApiPropertyOptional)({ description: '删除时间' }),
|
|
(0, class_validator_1.Allow)(),
|
|
__metadata("design:type", String)
|
|
], GeneratedRechargeFindWhereDto.prototype, "deleteTime", void 0);
|
|
__decorate([
|
|
(0, swagger_1.ApiPropertyOptional)({ description: '充值渠道:1=微信,2=支付宝,3=云闪付,4=分享生活' }),
|
|
(0, class_validator_1.Allow)(),
|
|
__metadata("design:type", Number)
|
|
], GeneratedRechargeFindWhereDto.prototype, "channel", void 0);
|
|
__decorate([
|
|
(0, swagger_1.ApiPropertyOptional)({ description: '充值金额' }),
|
|
(0, class_validator_1.Allow)(),
|
|
__metadata("design:type", String)
|
|
], GeneratedRechargeFindWhereDto.prototype, "amount", void 0);
|
|
__decorate([
|
|
(0, swagger_1.ApiPropertyOptional)({ description: '内部单号' }),
|
|
(0, class_validator_1.Allow)(),
|
|
__metadata("design:type", String)
|
|
], GeneratedRechargeFindWhereDto.prototype, "innerOrderNo", void 0);
|
|
__decorate([
|
|
(0, swagger_1.ApiPropertyOptional)({ description: '实际到账金额' }),
|
|
(0, class_validator_1.Allow)(),
|
|
__metadata("design:type", String)
|
|
], GeneratedRechargeFindWhereDto.prototype, "actualAmount", void 0);
|
|
__decorate([
|
|
(0, swagger_1.ApiPropertyOptional)({ description: '充值状态:0=待支付,1=支付成功,3=已关闭' }),
|
|
(0, class_validator_1.Allow)(),
|
|
__metadata("design:type", Number)
|
|
], GeneratedRechargeFindWhereDto.prototype, "status", void 0);
|
|
__decorate([
|
|
(0, swagger_1.ApiPropertyOptional)({ description: '第三方订单号' }),
|
|
(0, class_validator_1.Allow)(),
|
|
__metadata("design:type", String)
|
|
], GeneratedRechargeFindWhereDto.prototype, "thirdPartyOrderNo", void 0);
|
|
__decorate([
|
|
(0, swagger_1.ApiPropertyOptional)({ description: '备注' }),
|
|
(0, class_validator_1.Allow)(),
|
|
__metadata("design:type", String)
|
|
], GeneratedRechargeFindWhereDto.prototype, "remark", void 0);
|
|
class GeneratedRechargeFindDto {
|
|
paginated;
|
|
where;
|
|
extra;
|
|
}
|
|
__decorate([
|
|
(0, swagger_1.ApiPropertyOptional)({ description: '分页', type: api_1.PaginatedDto }),
|
|
(0, class_transformer_1.Type)(() => api_1.PaginatedDto),
|
|
(0, class_validator_1.ValidateNested)(),
|
|
__metadata("design:type", api_1.PaginatedDto)
|
|
], GeneratedRechargeFindDto.prototype, "paginated", void 0);
|
|
__decorate([
|
|
(0, swagger_1.ApiPropertyOptional)({ description: '查询条件', type: GeneratedRechargeFindWhereDto }),
|
|
(0, class_transformer_1.Type)(() => GeneratedRechargeFindWhereDto),
|
|
(0, class_validator_1.ValidateNested)(),
|
|
__metadata("design:type", GeneratedRechargeFindWhereDto)
|
|
], GeneratedRechargeFindDto.prototype, "where", void 0);
|
|
__decorate([
|
|
(0, swagger_1.ApiPropertyOptional)({ description: '额外', type: GeneratedRechargeFindExtraDto }),
|
|
(0, class_transformer_1.Type)(() => GeneratedRechargeFindExtraDto),
|
|
(0, class_validator_1.ValidateNested)(),
|
|
__metadata("design:type", GeneratedRechargeFindExtraDto)
|
|
], GeneratedRechargeFindDto.prototype, "extra", void 0);
|
|
class GeneratedRechargeCreateDto extends (0, swagger_1.OmitType)(recharge_model_1.RechargeModel, [
|
|
'id',
|
|
'createTime',
|
|
'updateTime',
|
|
'deleteTime',
|
|
'user',
|
|
'userId',
|
|
]) {
|
|
}
|
|
class GeneratedRechargeUpdateDto extends (0, swagger_1.PartialType)(GeneratedRechargeCreateDto) {
|
|
}
|
|
class GeneratedRechargeDetailWhereDto extends (0, swagger_1.PartialType)((0, swagger_1.OmitType)(GeneratedRechargeFindWhereDto, ['id'])) {
|
|
}
|
|
class GeneratedRechargeDetailDto {
|
|
where;
|
|
extra;
|
|
}
|
|
__decorate([
|
|
(0, swagger_1.ApiPropertyOptional)({ description: '查询条件', type: GeneratedRechargeDetailWhereDto }),
|
|
(0, class_validator_1.Allow)(),
|
|
__metadata("design:type", GeneratedRechargeDetailWhereDto)
|
|
], GeneratedRechargeDetailDto.prototype, "where", void 0);
|
|
__decorate([
|
|
(0, swagger_1.ApiPropertyOptional)({ description: '额外', type: GeneratedRechargeFindExtraDto }),
|
|
(0, class_validator_1.Allow)(),
|
|
__metadata("design:type", GeneratedRechargeFindExtraDto)
|
|
], GeneratedRechargeDetailDto.prototype, "extra", void 0);
|
|
const identity = 'userId';
|
|
const identityExist = true;
|
|
let GeneratedRechargeController = class GeneratedRechargeController {
|
|
repos;
|
|
constructor(repos) {
|
|
this.repos = repos;
|
|
}
|
|
async list(dto) {
|
|
const page = dto.paginated?.page || 1;
|
|
const size = dto.paginated?.size || 15;
|
|
const skip = (page - 1) * size;
|
|
let where;
|
|
if (dto.extra?.expression && dto.where) {
|
|
where = Object.fromEntries(Object.entries(dto.where).map(([key, value]) => {
|
|
const expression = dto.extra?.expression[key];
|
|
if (typeof value != 'undefined' && value != '' && value != null) {
|
|
if (expression && ExtraExp[expression]) {
|
|
value = ExtraExp[expression](key, value);
|
|
}
|
|
}
|
|
if (expression == expression_enum_1.Expression.between &&
|
|
(!value || (Array.isArray(value) && value.length < 2))) {
|
|
value = undefined;
|
|
}
|
|
return [key, value];
|
|
}));
|
|
}
|
|
else {
|
|
where = (dto.where || {});
|
|
}
|
|
where = Object.fromEntries(Object.entries(where).filter(([_, v]) => {
|
|
if (typeof v == 'undefined') {
|
|
return false;
|
|
}
|
|
if (typeof v == 'string' && !v) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}));
|
|
if (identityExist && identity && (0, user_id_context_1.getUserIdContext)()) {
|
|
where[identity] = (0, user_id_context_1.getUserIdContext)();
|
|
}
|
|
const o = dto.extra?.order && dto.extra?.order.length
|
|
? dto.extra?.order
|
|
: [{ id: 'desc' }];
|
|
const order = Object.fromEntries(o.map((it) => Object.keys(it).map((key) => [key, it[key]]))[0]);
|
|
const list = await this.repos.find({
|
|
where,
|
|
order,
|
|
skip: skip,
|
|
take: size,
|
|
relations: typeof dto.extra?.relations == 'object'
|
|
? Object.keys(dto.extra?.relations).filter((it) => dto.extra?.relations[it])
|
|
: [],
|
|
});
|
|
const count = await this.repos.count({
|
|
where: where,
|
|
});
|
|
return api_1.Api.pagination(list, count);
|
|
}
|
|
async detail(id, dto) {
|
|
const where = {
|
|
id,
|
|
...dto.where,
|
|
};
|
|
if (identityExist && identity && (0, user_id_context_1.getUserIdContext)()) {
|
|
where[identity] = (0, user_id_context_1.getUserIdContext)();
|
|
}
|
|
const item = await this.repos.findOne({
|
|
where,
|
|
relations: typeof dto.extra?.relations == 'object'
|
|
? Object.keys(dto.extra?.relations).filter((it) => dto.extra?.relations[it])
|
|
: [],
|
|
});
|
|
return api_1.Api.success(item);
|
|
}
|
|
};
|
|
exports.GeneratedRechargeController = GeneratedRechargeController;
|
|
__decorate([
|
|
(0, common_1.Post)('list'),
|
|
(0, swagger_1.ApiOperation)({ summary: '充值记录列表' }),
|
|
api_1.Api.ApiPaginatedResponse({
|
|
model: recharge_model_1.RechargeModel,
|
|
codeDescription: '200成功',
|
|
}),
|
|
openapi.ApiResponse({ status: 201 }),
|
|
__param(0, (0, common_1.Body)()),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [GeneratedRechargeFindDto]),
|
|
__metadata("design:returntype", Promise)
|
|
], GeneratedRechargeController.prototype, "list", null);
|
|
__decorate([
|
|
(0, common_1.Post)('detail/:id'),
|
|
(0, swagger_1.ApiParam)({ name: 'id', description: '充值记录ID' }),
|
|
(0, swagger_1.ApiOperation)({ summary: '充值记录详情' }),
|
|
api_1.Api.ApiResponse({
|
|
model: recharge_model_1.RechargeModel,
|
|
codeDescription: '200成功',
|
|
}),
|
|
openapi.ApiResponse({ status: 201 }),
|
|
__param(0, (0, common_1.Param)('id', common_1.ParseIntPipe)),
|
|
__param(1, (0, common_1.Body)()),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Number, GeneratedRechargeDetailDto]),
|
|
__metadata("design:returntype", Promise)
|
|
], GeneratedRechargeController.prototype, "detail", null);
|
|
exports.GeneratedRechargeController = GeneratedRechargeController = __decorate([
|
|
(0, common_1.Controller)('generated/recharge'),
|
|
(0, swagger_1.ApiTags)('G充值记录'),
|
|
__param(0, (0, typeorm_1.InjectRepository)(recharge_model_1.RechargeModel)),
|
|
__metadata("design:paramtypes", [typeorm_2.Repository])
|
|
], GeneratedRechargeController);
|
|
//# sourceMappingURL=generated_recharge.controller.js.map
|