mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
remove moderator from update pending creation mutation args
This commit is contained in:
parent
d14d4c5640
commit
a0e29e2524
@ -17,7 +17,4 @@ export default class UpdatePendingCreationArgs {
|
|||||||
|
|
||||||
@Field(() => String)
|
@Field(() => String)
|
||||||
creationDate: string
|
creationDate: string
|
||||||
|
|
||||||
@Field(() => Int)
|
|
||||||
moderator: number
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,9 +12,6 @@ export class UpdatePendingCreation {
|
|||||||
@Field(() => Decimal)
|
@Field(() => Decimal)
|
||||||
amount: Decimal
|
amount: Decimal
|
||||||
|
|
||||||
@Field(() => Number)
|
|
||||||
moderator: number
|
|
||||||
|
|
||||||
@Field(() => [Decimal])
|
@Field(() => [Decimal])
|
||||||
creation: Decimal[]
|
creation: Decimal[]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -230,7 +230,8 @@ export class AdminResolver {
|
|||||||
@Authorized([RIGHTS.UPDATE_PENDING_CREATION])
|
@Authorized([RIGHTS.UPDATE_PENDING_CREATION])
|
||||||
@Mutation(() => UpdatePendingCreation)
|
@Mutation(() => UpdatePendingCreation)
|
||||||
async updatePendingCreation(
|
async updatePendingCreation(
|
||||||
@Args() { id, email, amount, memo, creationDate, moderator }: UpdatePendingCreationArgs,
|
@Args() { id, email, amount, memo, creationDate }: UpdatePendingCreationArgs,
|
||||||
|
@Ctx() context: Context,
|
||||||
): Promise<UpdatePendingCreation> {
|
): Promise<UpdatePendingCreation> {
|
||||||
const user = await dbUser.findOne({ email }, { withDeleted: true })
|
const user = await dbUser.findOne({ email }, { withDeleted: true })
|
||||||
if (!user) {
|
if (!user) {
|
||||||
@ -240,6 +241,8 @@ export class AdminResolver {
|
|||||||
throw new Error(`User was deleted (${email})`)
|
throw new Error(`User was deleted (${email})`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const moderator = getUser(context)
|
||||||
|
|
||||||
const pendingCreationToUpdate = await AdminPendingCreation.findOneOrFail({ id })
|
const pendingCreationToUpdate = await AdminPendingCreation.findOneOrFail({ id })
|
||||||
|
|
||||||
if (pendingCreationToUpdate.userId !== user.id) {
|
if (pendingCreationToUpdate.userId !== user.id) {
|
||||||
@ -258,14 +261,13 @@ export class AdminResolver {
|
|||||||
pendingCreationToUpdate.amount = amount
|
pendingCreationToUpdate.amount = amount
|
||||||
pendingCreationToUpdate.memo = memo
|
pendingCreationToUpdate.memo = memo
|
||||||
pendingCreationToUpdate.date = new Date(creationDate)
|
pendingCreationToUpdate.date = new Date(creationDate)
|
||||||
pendingCreationToUpdate.moderator = moderator
|
pendingCreationToUpdate.moderator = moderator.id
|
||||||
|
|
||||||
await AdminPendingCreation.save(pendingCreationToUpdate)
|
await AdminPendingCreation.save(pendingCreationToUpdate)
|
||||||
const result = new UpdatePendingCreation()
|
const result = new UpdatePendingCreation()
|
||||||
result.amount = amount
|
result.amount = amount
|
||||||
result.memo = pendingCreationToUpdate.memo
|
result.memo = pendingCreationToUpdate.memo
|
||||||
result.date = pendingCreationToUpdate.date
|
result.date = pendingCreationToUpdate.date
|
||||||
result.moderator = pendingCreationToUpdate.moderator
|
|
||||||
|
|
||||||
result.creation = await getUserCreation(user.id)
|
result.creation = await getUserCreation(user.id)
|
||||||
|
|
||||||
|
|||||||
@ -116,3 +116,20 @@ export const createPendingCreations = gql`
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
export const updatePendingCreation = gql`
|
||||||
|
mutation ($id: Int!, $email: String!, $amount: Decimal!, $memo: String!, $creationDate: String!) {
|
||||||
|
updatePendingCreation(
|
||||||
|
id: $id
|
||||||
|
email: $email
|
||||||
|
amount: $amount
|
||||||
|
memo: $memo
|
||||||
|
creationDate: $creationDate
|
||||||
|
) {
|
||||||
|
amount
|
||||||
|
date
|
||||||
|
memo
|
||||||
|
creation
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user