Initial commit - Event Planner application
This commit is contained in:
54
src/core/entities/token.entity.ts
Normal file
54
src/core/entities/token.entity.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
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()',
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user