Files
2026-04-21 22:34:39 +08:00

90 lines
3.5 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.UserLogModel = exports.UserLogType = 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");
var UserLogType;
(function (UserLogType) {
UserLogType[UserLogType["Login"] = 0] = "Login";
UserLogType[UserLogType["Register"] = 1] = "Register";
UserLogType[UserLogType["Started"] = 2] = "Started";
})(UserLogType || (exports.UserLogType = UserLogType = {}));
let UserLogModel = class UserLogModel extends _base_model_1.BaseModel {
userId;
device;
ip;
date;
type;
static _OPENAPI_METADATA_FACTORY() {
return { userId: { required: true, type: () => Number }, device: { required: true, type: () => String }, ip: { required: true, type: () => String }, date: { required: true, type: () => String }, type: { required: true, enum: require("./user_log.model").UserLogType } };
}
};
exports.UserLogModel = UserLogModel;
__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)
], UserLogModel.prototype, "userId", void 0);
__decorate([
(0, swagger_1.ApiProperty)({ description: '操作设备号' }),
(0, typeorm_1.Index)(),
(0, typeorm_1.Column)({
comment: '操作设备号',
type: 'varchar',
}),
__metadata("design:type", String)
], UserLogModel.prototype, "device", void 0);
__decorate([
(0, swagger_1.ApiPropertyOptional)({ description: '操作 IP' }),
(0, class_validator_1.IsString)(),
(0, typeorm_1.Column)({
comment: '操作 IP',
type: 'varchar',
default: '0.0.0.0',
}),
__metadata("design:type", String)
], UserLogModel.prototype, "ip", void 0);
__decorate([
(0, swagger_1.ApiProperty)({ description: '操作日期' }),
(0, typeorm_1.Index)(),
(0, typeorm_1.Column)({
type: 'date',
comment: '参操作日期',
}),
__metadata("design:type", String)
], UserLogModel.prototype, "date", void 0);
__decorate([
(0, swagger_1.ApiProperty)({
description: '',
enum: UserLogType,
}),
(0, typeorm_1.Column)({
type: 'int',
comment: '',
}),
__metadata("design:type", Number)
], UserLogModel.prototype, "type", void 0);
exports.UserLogModel = UserLogModel = __decorate([
(0, typeorm_1.Entity)({
comment: '用户操作日志',
})
], UserLogModel);
//# sourceMappingURL=user_log.model.js.map