mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Add integration entity
This commit is contained in:
parent
1e1b573c52
commit
db27ac7d59
2 changed files with 35 additions and 2 deletions
35
packages/api/src/entity/integration.ts
Normal file
35
packages/api/src/entity/integration.ts
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import {
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
Entity,
|
||||
JoinColumn,
|
||||
ManyToOne,
|
||||
PrimaryGeneratedColumn,
|
||||
UpdateDateColumn,
|
||||
} from 'typeorm'
|
||||
import { User } from './user'
|
||||
|
||||
@Entity({ name: 'integrations' })
|
||||
export class Integration {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id!: string
|
||||
|
||||
@ManyToOne(() => User, { onDelete: 'CASCADE' })
|
||||
@JoinColumn({ name: 'user_id' })
|
||||
user!: User
|
||||
|
||||
@Column('varchar')
|
||||
name!: string
|
||||
|
||||
@Column('varchar')
|
||||
token!: string
|
||||
|
||||
@Column('boolean', { default: true })
|
||||
enabled!: boolean
|
||||
|
||||
@CreateDateColumn({ default: () => 'CURRENT_TIMESTAMP' })
|
||||
createdAt!: Date
|
||||
|
||||
@UpdateDateColumn({ default: () => 'CURRENT_TIMESTAMP' })
|
||||
updatedAt!: Date
|
||||
}
|
||||
|
|
@ -10,8 +10,6 @@ CREATE TABLE omnivore.integrations (
|
|||
name varchar(50) NOT NULL,
|
||||
token varchar(255) NOT NULL,
|
||||
enabled boolean NOT NULL DEFAULT true,
|
||||
description varchar(255),
|
||||
url varchar(255),
|
||||
created_at timestamptz NOT NULL DEFAULT current_timestamp,
|
||||
updated_at timestamptz NOT NULL DEFAULT current_timestamp,
|
||||
UNIQUE (user_id, name)
|
||||
|
|
|
|||
Loading…
Reference in a new issue