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)
|
@Field(() => Date)
|
||||||
creationDate: Date
|
creationDate: Date
|
||||||
|
|
||||||
|
@Field(() => Number)
|
||||||
|
moderator: number
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,7 +29,7 @@ export class AdminResolver {
|
|||||||
|
|
||||||
@Query(() => Boolean)
|
@Query(() => Boolean)
|
||||||
async createPendingCreation(
|
async createPendingCreation(
|
||||||
@Args() { email, amount, note, creationDate }: CreatePendingCreationArgs,
|
@Args() { email, amount, note, creationDate, moderator }: CreatePendingCreationArgs,
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
// TODO: Check user validity
|
// TODO: Check user validity
|
||||||
const userRepository = getCustomRepository(UserRepository)
|
const userRepository = getCustomRepository(UserRepository)
|
||||||
@ -40,7 +40,16 @@ export class AdminResolver {
|
|||||||
if (isCreationValid(creations, amount, creationDate)) {
|
if (isCreationValid(creations, amount, creationDate)) {
|
||||||
// UserAdmin.creations()
|
// UserAdmin.creations()
|
||||||
// TODO: Write pending creation to DB
|
// 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
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user