mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Create entry in LoginPendingTaskAdmin table. Save creation in database.
This commit is contained in:
parent
ead93b98fd
commit
03cb7fa558
@ -13,4 +13,7 @@ export default class CreatePendingCreationArgs {
|
||||
|
||||
@Field(() => Date)
|
||||
creationDate: Date
|
||||
|
||||
@Field(() => Number)
|
||||
moderator: number
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ export class AdminResolver {
|
||||
|
||||
@Query(() => Boolean)
|
||||
async createPendingCreation(
|
||||
@Args() { email, amount, note, creationDate }: CreatePendingCreationArgs,
|
||||
@Args() { email, amount, note, creationDate, moderator }: CreatePendingCreationArgs,
|
||||
): Promise<boolean> {
|
||||
// TODO: Check user validity
|
||||
const userRepository = getCustomRepository(UserRepository)
|
||||
@ -40,7 +40,16 @@ export class AdminResolver {
|
||||
if (isCreationValid(creations, amount, creationDate)) {
|
||||
// UserAdmin.creations()
|
||||
// TODO: Write pending creation to DB
|
||||
} else {
|
||||
const pendingCreationRepository = getCustomRepository(PendingCreationRepository)
|
||||
const loginPendingTaskAdmin = pendingCreationRepository.create()
|
||||
loginPendingTaskAdmin.userId = user.id
|
||||
loginPendingTaskAdmin.amount = BigInt(amount * 10000)
|
||||
loginPendingTaskAdmin.created = new Date()
|
||||
loginPendingTaskAdmin.date = new Date(creationDate)
|
||||
loginPendingTaskAdmin.note = note
|
||||
loginPendingTaskAdmin.moderator = moderator
|
||||
|
||||
pendingCreationRepository.save(loginPendingTaskAdmin)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user