mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
add rss subscription entity class
This commit is contained in:
parent
9f7796e2f0
commit
a6192ed86b
2 changed files with 45 additions and 1 deletions
44
packages/api/src/entity/rss_subscription.ts
Normal file
44
packages/api/src/entity/rss_subscription.ts
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
import {
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
Entity,
|
||||
JoinColumn,
|
||||
ManyToOne,
|
||||
PrimaryGeneratedColumn,
|
||||
UpdateDateColumn,
|
||||
} from 'typeorm'
|
||||
import { User } from './user'
|
||||
|
||||
@Entity({ name: 'rss_subscription' })
|
||||
export class RssSubscription {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id!: string
|
||||
|
||||
@ManyToOne(() => User, { onDelete: 'CASCADE' })
|
||||
@JoinColumn({ name: 'user_id' })
|
||||
user!: User
|
||||
|
||||
@Column('varchar', { length: 255 })
|
||||
title!: string
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
description?: string | null
|
||||
|
||||
@Column('text')
|
||||
url!: string
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
imageUrl?: string | null
|
||||
|
||||
@Column('integer', { default: 0 })
|
||||
count!: number
|
||||
|
||||
@Column('timestamp', { nullable: true })
|
||||
lastFetchedAt?: Date | null
|
||||
|
||||
@CreateDateColumn({ default: () => 'CURRENT_TIMESTAMP' })
|
||||
createdAt!: Date
|
||||
|
||||
@UpdateDateColumn({ default: () => 'CURRENT_TIMESTAMP' })
|
||||
updatedAt!: Date
|
||||
}
|
||||
|
|
@ -12,7 +12,7 @@ CREATE TABLE omnivore.rss_subscription (
|
|||
url TEXT NOT NULL,
|
||||
image_url TEXT,
|
||||
count integer NOT NULL DEFAULT 0,
|
||||
last_updated timestamptz,
|
||||
last_fetched_at timestamptz,
|
||||
created_at timestamptz NOT NULL DEFAULT current_timestamp,
|
||||
updated_at timestamptz NOT NULL DEFAULT current_timestamp
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue