template-saas/apps/backend/dist/modules/audit/entities/activity-log.entity.js
rckrdmrd 26f0e52ca7 feat: Initial commit - template-saas
Template base para proyectos SaaS multi-tenant.

Estructura inicial:
- apps/backend (NestJS API)
- apps/frontend (React/Vite)
- apps/database (PostgreSQL DDL)
- docs/ (Documentación)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 04:41:24 -06:00

86 lines
3.7 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.ActivityLog = exports.ActivityType = void 0;
const typeorm_1 = require("typeorm");
var ActivityType;
(function (ActivityType) {
ActivityType["PAGE_VIEW"] = "page_view";
ActivityType["FEATURE_USE"] = "feature_use";
ActivityType["SEARCH"] = "search";
ActivityType["DOWNLOAD"] = "download";
ActivityType["UPLOAD"] = "upload";
ActivityType["SHARE"] = "share";
ActivityType["INVITE"] = "invite";
ActivityType["SETTINGS_CHANGE"] = "settings_change";
ActivityType["SUBSCRIPTION_CHANGE"] = "subscription_change";
ActivityType["PAYMENT"] = "payment";
})(ActivityType || (exports.ActivityType = ActivityType = {}));
let ActivityLog = class ActivityLog {
};
exports.ActivityLog = ActivityLog;
__decorate([
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
__metadata("design:type", String)
], ActivityLog.prototype, "id", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'uuid' }),
__metadata("design:type", String)
], ActivityLog.prototype, "tenant_id", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'uuid' }),
__metadata("design:type", String)
], ActivityLog.prototype, "user_id", void 0);
__decorate([
(0, typeorm_1.Column)({
type: 'enum',
enum: ActivityType,
}),
__metadata("design:type", String)
], ActivityLog.prototype, "activity_type", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
__metadata("design:type", String)
], ActivityLog.prototype, "resource_type", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'uuid', nullable: true }),
__metadata("design:type", String)
], ActivityLog.prototype, "resource_id", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
__metadata("design:type", String)
], ActivityLog.prototype, "description", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'jsonb', nullable: true }),
__metadata("design:type", Object)
], ActivityLog.prototype, "metadata", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', length: 45, nullable: true }),
__metadata("design:type", String)
], ActivityLog.prototype, "ip_address", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', length: 500, nullable: true }),
__metadata("design:type", String)
], ActivityLog.prototype, "user_agent", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', length: 100, nullable: true }),
__metadata("design:type", String)
], ActivityLog.prototype, "session_id", void 0);
__decorate([
(0, typeorm_1.CreateDateColumn)({ type: 'timestamp with time zone' }),
__metadata("design:type", Date)
], ActivityLog.prototype, "created_at", void 0);
exports.ActivityLog = ActivityLog = __decorate([
(0, typeorm_1.Entity)({ name: 'activity_logs', schema: 'audit' }),
(0, typeorm_1.Index)(['tenant_id', 'created_at']),
(0, typeorm_1.Index)(['user_id', 'activity_type'])
], ActivityLog);
//# sourceMappingURL=activity-log.entity.js.map