Merge pull request #1416 from gradido/1401-Admin-interface-does-user-have-member-area

admin interface does user have member area
This commit is contained in:
Alexander Friedland 2022-02-08 16:08:06 +01:00 committed by GitHub
commit bd7aab1437
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 22 additions and 3 deletions

View File

@ -64,6 +64,13 @@
</b-button>
</template>
<template #cell(has_elopage)="row">
<b-icon
:variant="row.item.hasElopage ? 'success' : 'danger'"
:icon="row.item.hasElopage ? 'check-circle' : 'x-circle'"
></b-icon>
</template>
<template #cell(transactions_list)="row">
<b-button variant="warning" size="md" @click="rowToogleDetails(row, 2)" class="mr-2">
<b-icon icon="list"></b-icon>

View File

@ -16,6 +16,7 @@ export const searchUsers = gql`
email
creation
emailChecked
hasElopage
}
}
}

View File

@ -106,6 +106,7 @@ export default {
},
{ key: 'show_details', label: this.$t('details') },
{ key: 'confirm_mail', label: this.$t('confirmed') },
{ key: 'has_elopage', label: 'elopage' },
{ key: 'transactions_list', label: this.$t('transaction') },
]
},

View File

@ -19,6 +19,9 @@ export class UserAdmin {
@Field(() => Boolean)
emailChecked: boolean
@Field(() => Boolean)
hasElopage: boolean
}
@ObjectType()

View File

@ -21,6 +21,7 @@ import { UserTransactionRepository } from '../../typeorm/repository/UserTransact
import { BalanceRepository } from '../../typeorm/repository/Balance'
import { calculateDecay } from '../../util/decay'
import { AdminPendingCreation } from '@entity/AdminPendingCreation'
import { hasElopageBuys } from '../../util/hasElopageBuys'
import { User as dbUser } from '@entity/User'
@Resolver()
@ -41,6 +42,7 @@ export class AdminResolver {
adminUser.email = user.email
adminUser.creation = await getUserCreations(user.id)
adminUser.emailChecked = await hasActivatedEmail(user.email)
adminUser.hasElopage = await hasElopageBuys(user.email)
return adminUser
}),
)

View File

@ -21,7 +21,7 @@ import { sendAccountActivationEmail } from '../../mailer/sendAccountActivationEm
import { klicktippSignIn } from '../../apis/KlicktippController'
import { RIGHTS } from '../../auth/RIGHTS'
import { ROLE_ADMIN } from '../../auth/ROLES'
import { LoginElopageBuys } from '@entity/LoginElopageBuys'
import { hasElopageBuys } from '../../util/hasElopageBuys'
import { ServerUser } from '@entity/ServerUser'
const EMAIL_OPT_IN_RESET_PASSWORD = 2
@ -661,7 +661,6 @@ export class UserResolver {
return false
}
const elopageBuyCount = await LoginElopageBuys.count({ payerEmail: userEntity.email })
return elopageBuyCount > 0
return hasElopageBuys(userEntity.email)
}
}

View File

@ -0,0 +1,6 @@
import { LoginElopageBuys } from '@entity/LoginElopageBuys'
export async function hasElopageBuys(email: string): Promise<boolean> {
const elopageBuyCount = await LoginElopageBuys.count({ payerEmail: email })
return elopageBuyCount > 0
}