Add Clubs to the admin portal
This commit is contained in:
@ -8,6 +8,7 @@ import {
|
|||||||
JoinColumn,
|
JoinColumn,
|
||||||
ManyToOne,
|
ManyToOne,
|
||||||
OneToMany,
|
OneToMany,
|
||||||
|
OneToOne,
|
||||||
} from 'typeorm'
|
} from 'typeorm'
|
||||||
import AdminJs from 'adminjs'
|
import AdminJs from 'adminjs'
|
||||||
import { Database, Resource } from '@adminjs/typeorm'
|
import { Database, Resource } from '@adminjs/typeorm'
|
||||||
@ -46,6 +47,7 @@ export const registerDatabase = async (secrets: any): Promise<Connection> => {
|
|||||||
UserArticle,
|
UserArticle,
|
||||||
ReceivedEmail,
|
ReceivedEmail,
|
||||||
ContentDisplayReport,
|
ContentDisplayReport,
|
||||||
|
Group,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -186,3 +188,34 @@ export class ReceivedEmail extends BaseEntity {
|
|||||||
@Column({ type: 'timestamp', name: 'updated_at' })
|
@Column({ type: 'timestamp', name: 'updated_at' })
|
||||||
updatedAt!: Date
|
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,
|
UserArticle,
|
||||||
UserProfile,
|
UserProfile,
|
||||||
ReceivedEmail,
|
ReceivedEmail,
|
||||||
|
Group,
|
||||||
ContentDisplayReport,
|
ContentDisplayReport,
|
||||||
} from './db'
|
} from './db'
|
||||||
import { compare, hashSync } from 'bcryptjs'
|
import { compare, hashSync } from 'bcryptjs'
|
||||||
@ -35,6 +36,7 @@ const ADMIN_USER_EMAIL =
|
|||||||
{ resource: UserProfile, options: { parent: { name: 'Users' } } },
|
{ resource: UserProfile, options: { parent: { name: 'Users' } } },
|
||||||
{ resource: UserArticle, options: { parent: { name: 'Users' } } },
|
{ resource: UserArticle, options: { parent: { name: 'Users' } } },
|
||||||
{ resource: ReceivedEmail, options: { parent: { name: 'Users' } } },
|
{ resource: ReceivedEmail, options: { parent: { name: 'Users' } } },
|
||||||
|
{ resource: Group, options: { parent: { name: 'Users' } } },
|
||||||
{
|
{
|
||||||
resource: ContentDisplayReport,
|
resource: ContentDisplayReport,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user