Files
evento/src/core/entities/token.entity.ts
2026-03-18 14:55:56 -03:00

55 lines
986 B
TypeScript

import { EntitySchema } from '@mikro-orm/core';
export class AuthToken {
id!: string;
tenantId!: string;
token!: string;
name?: string;
expiresAt?: Date;
metadata?: Record<string, any>;
createdAt!: Date;
updatedAt!: Date;
}
export const AuthTokenSchema = new EntitySchema<AuthToken>({
class: AuthToken,
tableName: 'auth_tokens',
properties: {
id: {
primary: true,
type: 'uuid',
default: 'uuid_generate_v4()',
},
tenantId: {
type: 'string',
nullable: false,
},
token: {
type: 'string',
nullable: false,
},
name: {
type: 'string',
nullable: true,
},
expiresAt: {
type: 'date',
nullable: true,
},
metadata: {
type: 'json',
nullable: true,
},
createdAt: {
type: 'date',
nullable: false,
defaultRaw: 'now()',
},
updatedAt: {
type: 'date',
nullable: false,
defaultRaw: 'now()',
},
},
});