mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Add method to log every user that is not registered at KlickTipp.
This commit is contained in:
parent
32b5bf3d6b
commit
49de7366f4
28
backend/src/klicktipp.ts
Normal file
28
backend/src/klicktipp.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import connection from '@/typeorm/connection'
|
||||
import { getKlickTippUser } from './apis/KlicktippController'
|
||||
import { User } from '../../database/entity/User'
|
||||
import { getConnection } from '@dbTools/typeorm'
|
||||
|
||||
export async function retrieveNotRegisteredEmails(): Promise<string[]> {
|
||||
const con = await connection()
|
||||
if (!con) {
|
||||
throw new Error('No connection to database')
|
||||
}
|
||||
const users = await User.find()
|
||||
const notRegisteredUser = []
|
||||
for (let i = 0; i < users.length; i++) {
|
||||
const user = users[i]
|
||||
try {
|
||||
await getKlickTippUser(user.email)
|
||||
} catch (err) {
|
||||
notRegisteredUser.push(user.email)
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`${user.email}`)
|
||||
}
|
||||
}
|
||||
await con.close()
|
||||
console.log('User die nicht bei KlickTipp vorhanden sind: ', notRegisteredUser)
|
||||
return notRegisteredUser
|
||||
}
|
||||
|
||||
retrieveNotRegisteredEmails()
|
||||
Loading…
x
Reference in New Issue
Block a user