Merge pull request #1833 from omnivore-app/feat/clubs-admin

Add Clubs to the admin portal
This commit is contained in:
Jackson Harper 2023-02-22 10:50:34 +08:00 committed by GitHub
commit b108efc3b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 0 deletions

View file

@ -8,6 +8,7 @@ import {
JoinColumn,
ManyToOne,
OneToMany,
OneToOne,
} from 'typeorm'
import AdminJs from 'adminjs'
import { Database, Resource } from '@adminjs/typeorm'
@ -46,6 +47,7 @@ export const registerDatabase = async (secrets: any): Promise<Connection> => {
UserArticle,
ReceivedEmail,
ContentDisplayReport,
Group,
],
})
@ -186,3 +188,34 @@ export class ReceivedEmail extends BaseEntity {
@Column({ type: 'timestamp', name: 'updated_at' })
updatedAt!: Date
}
@Entity()
export class Group extends BaseEntity {
@PrimaryGeneratedColumn('uuid')
id!: string
@Column('text')
name!: string
@OneToOne(() => User)
@JoinColumn({ name: 'created_at' })
createdBy!: User
@Column({ type: 'timestamp', name: 'created_at' })
createdAt!: Date
@Column({ type: 'timestamp', name: 'updated_at' })
updatedAt!: Date
@Column('text', { nullable: true })
description?: string | null
@Column('text', { nullable: true })
topics?: string | null
@Column('boolean', { default: false, name: 'only_admin_can_post' })
onlyAdminCanPost!: boolean
@Column('boolean', { default: false, name: 'only_admin_can_see_members' })
onlyAdminCanSeeMembers!: boolean
}

View file

@ -8,6 +8,7 @@ import {
UserArticle,
UserProfile,
ReceivedEmail,
Group,
ContentDisplayReport,
} from './db'
import { compare, hashSync } from 'bcryptjs'
@ -35,6 +36,7 @@ const ADMIN_USER_EMAIL =
{ resource: UserProfile, options: { parent: { name: 'Users' } } },
{ resource: UserArticle, options: { parent: { name: 'Users' } } },
{ resource: ReceivedEmail, options: { parent: { name: 'Users' } } },
{ resource: Group, options: { parent: { name: 'Users' } } },
{
resource: ContentDisplayReport,
},