Merge pull request #2773 from omnivore-app/feat/admin-rss
Add subscriptions to admin
This commit is contained in:
@ -49,6 +49,7 @@ export const registerDatabase = async (secrets: any): Promise<Connection> => {
|
||||
ContentDisplayReport,
|
||||
Group,
|
||||
Integration,
|
||||
Subscription,
|
||||
],
|
||||
})
|
||||
|
||||
@ -257,3 +258,59 @@ export class Integration extends BaseEntity {
|
||||
@Column({ name: 'synced_at', type: 'timestamp', nullable: true })
|
||||
syncedAt?: Date | null
|
||||
}
|
||||
|
||||
enum SubscriptionStatus {
|
||||
Active = 'ACTIVE',
|
||||
Deleted = 'DELETED',
|
||||
Unsubscribed = 'UNSUBSCRIBED',
|
||||
}
|
||||
|
||||
enum SubscriptionType {
|
||||
Newsletter = 'NEWSLETTER',
|
||||
Rss = 'RSS',
|
||||
}
|
||||
|
||||
@Entity({ name: 'subscriptions' })
|
||||
export class Subscription extends BaseEntity {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id!: string
|
||||
|
||||
@JoinColumn({ name: 'user_id' })
|
||||
@ManyToOne(() => User, (user) => user.articles, { eager: true })
|
||||
user!: User
|
||||
|
||||
@Column('text')
|
||||
name!: string
|
||||
|
||||
@Column('enum', {
|
||||
enum: SubscriptionStatus,
|
||||
default: SubscriptionStatus.Active,
|
||||
})
|
||||
status!: SubscriptionStatus
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
description?: string
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
url?: string
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
icon?: string
|
||||
|
||||
@Column('enum', {
|
||||
enum: SubscriptionType,
|
||||
})
|
||||
type!: SubscriptionType
|
||||
|
||||
@Column('integer', { default: 0 })
|
||||
count!: number
|
||||
|
||||
@Column({ type: 'timestamp', name: 'last_fetched_at', nullable: true })
|
||||
lastFetchedAt?: Date | null
|
||||
|
||||
@Column({ type: 'timestamp', name: 'created_at' })
|
||||
createdAt!: Date
|
||||
|
||||
@Column({ type: 'timestamp', name: 'updated_at' })
|
||||
updatedAt!: Date
|
||||
}
|
||||
|
||||
@ -10,6 +10,8 @@ import {
|
||||
ReceivedEmail,
|
||||
Group,
|
||||
ContentDisplayReport,
|
||||
Subscription,
|
||||
Integration,
|
||||
} from './db'
|
||||
import { compare, hashSync } from 'bcryptjs'
|
||||
const readYamlFile = require('read-yaml-file')
|
||||
@ -37,6 +39,8 @@ const ADMIN_USER_EMAIL =
|
||||
{ resource: UserArticle, options: { parent: { name: 'Users' } } },
|
||||
{ resource: ReceivedEmail, options: { parent: { name: 'Users' } } },
|
||||
{ resource: Group, options: { parent: { name: 'Users' } } },
|
||||
{ resource: Subscription, options: { parent: { name: 'Users' } } },
|
||||
{ resource: Integration, options: { parent: { name: 'Users' } } },
|
||||
{
|
||||
resource: ContentDisplayReport,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user