Add Clubs to the admin portal
This commit is contained in:
@ -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()
|
||||
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 })
|
||||
onlyAdminCanPost!: boolean
|
||||
|
||||
@Column('boolean', { default: false })
|
||||
onlyAdminCanSeeMembers!: boolean
|
||||
}
|
||||
|
||||
@ -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,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user