forked from PinSpace-Org/GistPin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi-key.entity.ts
More file actions
33 lines (24 loc) 路 806 Bytes
/
Copy pathapi-key.entity.ts
File metadata and controls
33 lines (24 loc) 路 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, Index } from 'typeorm';
@Entity('api_keys')
@Index('idx_api_keys_owner_address')
@Index('idx_api_keys_key_hash', { unique: true })
export class ApiKey {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column({ type: 'varchar', length: 64 })
keyHash: string;
@Column({ type: 'varchar', length: 100 })
name: string;
@Column({ type: 'varchar', length: 80 })
ownerAddress: string;
@Column({ type: 'jsonb', default: [] })
scopes: string[];
@Column({ type: 'int', default: 60 })
rateLimitPerMin: number;
@CreateDateColumn({ type: 'timestamptz' })
createdAt: Date;
@Column({ type: 'timestamptz', nullable: true })
lastUsedAt: Date | null;
@Column({ type: 'boolean', default: true })
isActive: boolean;
}