mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
solve problems reading user with emailcontact
This commit is contained in:
parent
1d1de2011a
commit
7269b4b67b
@ -14,7 +14,7 @@ export class User {
|
||||
this.emailId = user.emailId
|
||||
if (user.emailContact) {
|
||||
this.email = user.emailContact.email
|
||||
this.emailContact = user.emailContact
|
||||
this.emailContact = new UserContact(user.emailContact)
|
||||
this.emailChecked = user.emailContact.emailChecked
|
||||
}
|
||||
this.firstName = user.firstName
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import { ObjectType, Field } from 'type-graphql'
|
||||
import { UserContact as dbUserCOntact} from '@entity/UserContact'
|
||||
import { UserContact as dbUserContact} from '@entity/UserContact'
|
||||
|
||||
@ObjectType()
|
||||
export class UserContact {
|
||||
constructor(userContact: dbUserCOntact) {
|
||||
constructor(userContact: dbUserContact) {
|
||||
this.id = userContact.id
|
||||
this.type = userContact.type
|
||||
this.userId = userContact.userId
|
||||
|
||||
@ -850,11 +850,7 @@ export class UserResolver {
|
||||
@Query(() => Boolean)
|
||||
async hasElopage(@Ctx() context: Context): Promise<boolean> {
|
||||
logger.info(`hasElopage()...`)
|
||||
const userEntity = context.user
|
||||
if (!userEntity) {
|
||||
logger.info('missing context.user for EloPage-check')
|
||||
return false
|
||||
}
|
||||
const userEntity = getUser(context)
|
||||
const elopageBuys = hasElopageBuys(userEntity.emailContact.email)
|
||||
logger.debug(`has ElopageBuys = ${elopageBuys}`)
|
||||
return elopageBuys
|
||||
|
||||
@ -43,7 +43,7 @@ export class User extends BaseEntity {
|
||||
@Column({ length: 255, unique: true, nullable: false, collation: 'utf8mb4_unicode_ci' })
|
||||
email: string
|
||||
*/
|
||||
@OneToOne(() => UserContact, (emailContact) => emailContact.userId)
|
||||
@OneToOne(() => UserContact, (emailContact) => emailContact.user)
|
||||
@JoinColumn({ name: 'email_id' })
|
||||
emailContact: UserContact
|
||||
|
||||
@ -115,7 +115,7 @@ export class User extends BaseEntity {
|
||||
@JoinColumn({ name: 'user_id' })
|
||||
contributions?: Contribution[]
|
||||
|
||||
@OneToMany(() => UserContact, (usercontact) => usercontact.userId)
|
||||
@OneToMany(() => UserContact, (usercontact) => usercontact.user)
|
||||
@JoinColumn({ name: 'user_id' })
|
||||
usercontacts?: UserContact[]
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ export class UserContact extends BaseEntity {
|
||||
@Column({ name: 'created_at', default: () => 'CURRENT_TIMESTAMP', nullable: false })
|
||||
createdAt: Date
|
||||
|
||||
@DeleteDateColumn({ name: 'updated_at', nullable: true })
|
||||
@Column({ name: 'updated_at', nullable: true, default: null, type: 'datetime' })
|
||||
updatedAt: Date | null
|
||||
|
||||
@DeleteDateColumn({ name: 'deleted_at', nullable: true })
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user