mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
refactor adminCreateContribution to check for deleted users
This commit is contained in:
parent
3724295b6f
commit
225652ecc7
@ -1633,7 +1633,11 @@ describe('ContributionResolver', () => {
|
||||
it('logs the error thrown', () => {
|
||||
expect(logger.error).toBeCalledWith(
|
||||
'Cannot create contribution since the user was deleted',
|
||||
expect.objectContaining({ deletedAt: new Date('2018-03-14T09:17:52.000Z') }),
|
||||
expect.objectContaining({
|
||||
user: expect.objectContaining({
|
||||
deletedAt: new Date('2018-03-14T09:17:52.000Z'),
|
||||
}),
|
||||
}),
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
@ -307,14 +307,8 @@ export class ContributionResolver {
|
||||
if (!emailContact) {
|
||||
throw new LogError('Could not find user', email)
|
||||
}
|
||||
if (emailContact.deletedAt) {
|
||||
throw new LogError(
|
||||
'Cannot create contribution since the emailContact was deleted',
|
||||
emailContact,
|
||||
)
|
||||
}
|
||||
if (emailContact.user.deletedAt) {
|
||||
throw new LogError('Cannot create contribution since the user was deleted', emailContact.user)
|
||||
if (emailContact.deletedAt || emailContact.user.deletedAt) {
|
||||
throw new LogError('Cannot create contribution since the user was deleted', emailContact)
|
||||
}
|
||||
if (!emailContact.emailChecked) {
|
||||
throw new LogError(
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { UserInterface } from './UserInterface'
|
||||
|
||||
// TODO: the generated email_contact is not deleted
|
||||
export const stephenHawking: UserInterface = {
|
||||
email: 'stephen@hawking.uk',
|
||||
firstName: 'Stephen',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user