This commit is contained in:
2026-01-14 00:05:13 +03:30
parent d046dc21ac
commit 1075dbc44f
12 changed files with 106 additions and 296 deletions
@@ -1,29 +1,19 @@
import { Entity, Enum, Index, Property } from '@mikro-orm/core';
import { BaseEntity } from '../../../common/entities/base.entity';
export enum RefreshTokenType {
USER = 'user',
ADMIN = 'admin',
}
import { RefreshTokenType } from '../interfaces/IToken-payload';
@Entity({ tableName: 'refreshtokens' })
@Index({ properties: ['ownerId', '', 'type'] })
@Index({ properties: ['hashedToken'] })
@Index({ properties: ['expiresAt'] })
export class RefreshToken extends BaseEntity {
export class RefreshToken {
@Property({ type: 'varchar', length: 255 })
hashedToken!: string;
@Property()
ownerId!: string;
@Property()
!: string;
@Enum(() => RefreshTokenType)
@Enum(() => RefreshTokenType)
type!: RefreshTokenType;
@Property({ type: 'timestamptz' })
expiresAt!: Date;
@Property({ type: 'timestamptz' })
expiresAt!: Date;
}