Add Clubs to the admin portal

This commit is contained in:
Jackson Harper
2023-02-22 08:24:32 +08:00
parent b54733e92e
commit f14c0c0e22
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()
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
}

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,
},