mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
refactor: Move API keys into their own table (no-changelog) (#10629)
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
25
packages/cli/src/databases/entities/api-key.ts
Normal file
25
packages/cli/src/databases/entities/api-key.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { Column, Entity, Index, ManyToOne, Unique } from '@n8n/typeorm';
|
||||
|
||||
import { WithTimestampsAndStringId } from './abstract-entity';
|
||||
import { User } from './user';
|
||||
|
||||
@Entity('user_api_keys')
|
||||
@Unique(['userId', 'label'])
|
||||
export class ApiKey extends WithTimestampsAndStringId {
|
||||
@ManyToOne(
|
||||
() => User,
|
||||
(user) => user.id,
|
||||
{ onDelete: 'CASCADE' },
|
||||
)
|
||||
user: User;
|
||||
|
||||
@Column({ type: String })
|
||||
userId: string;
|
||||
|
||||
@Column({ type: String })
|
||||
label: string;
|
||||
|
||||
@Index({ unique: true })
|
||||
@Column({ type: String })
|
||||
apiKey: string;
|
||||
}
|
||||
Reference in New Issue
Block a user