mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
rename deletePendingCreation
This commit is contained in:
parent
d95b1893cd
commit
dd04f69ecc
7
admin/src/graphql/adminDeleteContribution.js
Normal file
7
admin/src/graphql/adminDeleteContribution.js
Normal file
@ -0,0 +1,7 @@
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
export const adminDeleteContribution = gql`
|
||||
mutation ($id: Int!) {
|
||||
adminDeleteContribution(id: $id)
|
||||
}
|
||||
`
|
||||
@ -1,7 +0,0 @@
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
export const deletePendingCreation = gql`
|
||||
mutation ($id: Int!) {
|
||||
deletePendingCreation(id: $id)
|
||||
}
|
||||
`
|
||||
@ -1,6 +1,6 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import CreationConfirm from './CreationConfirm.vue'
|
||||
import { deletePendingCreation } from '../graphql/deletePendingCreation'
|
||||
import { adminDeleteContribution } from '../graphql/adminDeleteContribution'
|
||||
import { confirmPendingCreation } from '../graphql/confirmPendingCreation'
|
||||
import { toastErrorSpy, toastSuccessSpy } from '../../test/testSetup'
|
||||
|
||||
@ -84,9 +84,9 @@ describe('CreationConfirm', () => {
|
||||
await wrapper.findAll('tr').at(1).findAll('button').at(0).trigger('click')
|
||||
})
|
||||
|
||||
it('calls the deletePendingCreation mutation', () => {
|
||||
it('calls the adminDeleteContribution mutation', () => {
|
||||
expect(apolloMutateMock).toBeCalledWith({
|
||||
mutation: deletePendingCreation,
|
||||
mutation: adminDeleteContribution,
|
||||
variables: { id: 1 },
|
||||
})
|
||||
})
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
import Overlay from '../components/Overlay.vue'
|
||||
import OpenCreationsTable from '../components/Tables/OpenCreationsTable.vue'
|
||||
import { listUnconfirmedContributions } from '../graphql/listUnconfirmedContributions'
|
||||
import { deletePendingCreation } from '../graphql/deletePendingCreation'
|
||||
import { adminDeleteContribution } from '../graphql/adminDeleteContribution'
|
||||
import { confirmPendingCreation } from '../graphql/confirmPendingCreation'
|
||||
|
||||
export default {
|
||||
@ -36,7 +36,7 @@ export default {
|
||||
removeCreation(item) {
|
||||
this.$apollo
|
||||
.mutate({
|
||||
mutation: deletePendingCreation,
|
||||
mutation: adminDeleteContribution,
|
||||
variables: {
|
||||
id: item.id,
|
||||
},
|
||||
|
||||
@ -30,8 +30,8 @@ export enum RIGHTS {
|
||||
ADMIN_CREATE_CONTRIBUTION = 'ADMIN_CREATE_CONTRIBUTION',
|
||||
ADMIN_CREATE_CONTRIBUTIONS = 'ADMIN_CREATE_CONTRIBUTIONS',
|
||||
ADMIN_UPDATE_CONTRIBUTION = 'ADMIN_UPDATE_CONTRIBUTION',
|
||||
ADMIN_DELETE_CONTRIBUTION = 'ADMIN_DELETE_CONTRIBUTION',
|
||||
LIST_UNCONFIRMED_CONTRIBUTIONS = 'LIST_UNCONFIRMED_CONTRIBUTIONS',
|
||||
DELETE_PENDING_CREATION = 'DELETE_PENDING_CREATION',
|
||||
CONFIRM_PENDING_CREATION = 'CONFIRM_PENDING_CREATION',
|
||||
SEND_ACTIVATION_EMAIL = 'SEND_ACTIVATION_EMAIL',
|
||||
DELETE_USER = 'DELETE_USER',
|
||||
|
||||
@ -18,7 +18,7 @@ import {
|
||||
adminCreateContribution,
|
||||
adminCreateContributions,
|
||||
updatePendingCreation,
|
||||
deletePendingCreation,
|
||||
adminDeleteContribution,
|
||||
confirmPendingCreation,
|
||||
createContributionLink,
|
||||
deleteContributionLink,
|
||||
@ -562,11 +562,11 @@ describe('AdminResolver', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('deletePendingCreation', () => {
|
||||
describe('adminDeleteContribution', () => {
|
||||
it('returns an error', async () => {
|
||||
await expect(
|
||||
mutate({
|
||||
mutation: deletePendingCreation,
|
||||
mutation: adminDeleteContribution,
|
||||
variables: {
|
||||
id: 1,
|
||||
},
|
||||
@ -672,11 +672,11 @@ describe('AdminResolver', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('deletePendingCreation', () => {
|
||||
describe('adminDeleteContribution', () => {
|
||||
it('returns an error', async () => {
|
||||
await expect(
|
||||
mutate({
|
||||
mutation: deletePendingCreation,
|
||||
mutation: adminDeleteContribution,
|
||||
variables: {
|
||||
id: 1,
|
||||
},
|
||||
@ -1177,19 +1177,19 @@ describe('AdminResolver', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('deletePendingCreation', () => {
|
||||
describe('adminDeleteContribution', () => {
|
||||
describe('creation id does not exist', () => {
|
||||
it('throws an error', async () => {
|
||||
await expect(
|
||||
mutate({
|
||||
mutation: deletePendingCreation,
|
||||
mutation: adminDeleteContribution,
|
||||
variables: {
|
||||
id: -1,
|
||||
},
|
||||
}),
|
||||
).resolves.toEqual(
|
||||
expect.objectContaining({
|
||||
errors: [new GraphQLError('Creation not found for given id.')],
|
||||
errors: [new GraphQLError('Contribution not found for given id.')],
|
||||
}),
|
||||
)
|
||||
})
|
||||
@ -1199,14 +1199,14 @@ describe('AdminResolver', () => {
|
||||
it('returns true', async () => {
|
||||
await expect(
|
||||
mutate({
|
||||
mutation: deletePendingCreation,
|
||||
mutation: adminDeleteContribution,
|
||||
variables: {
|
||||
id: creation ? creation.id : -1,
|
||||
},
|
||||
}),
|
||||
).resolves.toEqual(
|
||||
expect.objectContaining({
|
||||
data: { deletePendingCreation: true },
|
||||
data: { adminDeleteContribution: true },
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
@ -314,12 +314,12 @@ export class AdminResolver {
|
||||
})
|
||||
}
|
||||
|
||||
@Authorized([RIGHTS.DELETE_PENDING_CREATION])
|
||||
@Authorized([RIGHTS.ADMIN_DELETE_CONTRIBUTION])
|
||||
@Mutation(() => Boolean)
|
||||
async deletePendingCreation(@Arg('id', () => Int) id: number): Promise<boolean> {
|
||||
async adminDeleteContribution(@Arg('id', () => Int) id: number): Promise<boolean> {
|
||||
const contribution = await Contribution.findOne(id)
|
||||
if (!contribution) {
|
||||
throw new Error('Creation not found for given id.')
|
||||
throw new Error('Contribution not found for given id.')
|
||||
}
|
||||
const res = await contribution.softRemove()
|
||||
return !!res
|
||||
|
||||
@ -137,9 +137,9 @@ export const updatePendingCreation = gql`
|
||||
}
|
||||
`
|
||||
|
||||
export const deletePendingCreation = gql`
|
||||
export const adminDeleteContribution = gql`
|
||||
mutation ($id: Int!) {
|
||||
deletePendingCreation(id: $id)
|
||||
adminDeleteContribution(id: $id)
|
||||
}
|
||||
`
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user