further renaming

This commit is contained in:
Moriz Wahl 2022-06-15 19:02:47 +02:00
parent 3eddb226d8
commit 244cf20542
5 changed files with 14 additions and 14 deletions

View File

@ -29,7 +29,7 @@ export enum RIGHTS {
SEARCH_USERS = 'SEARCH_USERS', SEARCH_USERS = 'SEARCH_USERS',
ADMIN_CREATE_CONTRIBUTION = 'ADMIN_CREATE_CONTRIBUTION', ADMIN_CREATE_CONTRIBUTION = 'ADMIN_CREATE_CONTRIBUTION',
ADMIN_CREATE_CONTRIBUTIONS = 'ADMIN_CREATE_CONTRIBUTIONS', ADMIN_CREATE_CONTRIBUTIONS = 'ADMIN_CREATE_CONTRIBUTIONS',
ADMIN_UPDATE_UNCONFIRMED_CONTRIBUTION = 'ADMIN_UPDATE_UNCONFIRMED_CONTRIBUTION', ADMIN_UPDATE_CONTRIBUTION = 'ADMIN_UPDATE_CONTRIBUTION',
SEARCH_PENDING_CREATION = 'SEARCH_PENDING_CREATION', SEARCH_PENDING_CREATION = 'SEARCH_PENDING_CREATION',
DELETE_PENDING_CREATION = 'DELETE_PENDING_CREATION', DELETE_PENDING_CREATION = 'DELETE_PENDING_CREATION',
CONFIRM_PENDING_CREATION = 'CONFIRM_PENDING_CREATION', CONFIRM_PENDING_CREATION = 'CONFIRM_PENDING_CREATION',

View File

@ -2,7 +2,7 @@ import { ArgsType, Field, Int } from 'type-graphql'
import Decimal from 'decimal.js-light' import Decimal from 'decimal.js-light'
@ArgsType() @ArgsType()
export default class AdminUpdatePendingContributionArgs { export default class AdminUpdateContributionArgs {
@Field(() => Int) @Field(() => Int)
id: number id: number

View File

@ -1,7 +1,7 @@
import { ObjectType, Field } from 'type-graphql' import { ObjectType, Field } from 'type-graphql'
@ObjectType() @ObjectType()
export class AdminCreateContribution { export class AdminCreateContributions {
constructor() { constructor() {
this.success = false this.success = false
this.successfulContribution = [] this.successfulContribution = []

View File

@ -2,7 +2,7 @@ import { ObjectType, Field } from 'type-graphql'
import Decimal from 'decimal.js-light' import Decimal from 'decimal.js-light'
@ObjectType() @ObjectType()
export class AdminUpdateUnconfirmedContribution { export class AdminUpdateContribution {
@Field(() => Date) @Field(() => Date)
date: Date date: Date

View File

@ -13,14 +13,14 @@ import {
} from '@dbTools/typeorm' } from '@dbTools/typeorm'
import { UserAdmin, SearchUsersResult } from '@model/UserAdmin' import { UserAdmin, SearchUsersResult } from '@model/UserAdmin'
import { UnconfirmedContribution } from '@model/UnconfirmedContribution' import { UnconfirmedContribution } from '@model/UnconfirmedContribution'
import { AdminCreateContribution } from '@model/AdminCreateContribution' import { AdminCreateContributions } from '@model/AdminCreateContributions'
import { AdminUpdateUnconfirmedContribution } from '@model/AdminUpdateUnconfirmedContribution' import { AdminUpdateContribution } from '@model/AdminUpdateContribution'
import { ContributionLink } from '@model/ContributionLink' import { ContributionLink } from '@model/ContributionLink'
import { ContributionLinkList } from '@model/ContributionLinkList' import { ContributionLinkList } from '@model/ContributionLinkList'
import { RIGHTS } from '@/auth/RIGHTS' import { RIGHTS } from '@/auth/RIGHTS'
import { UserRepository } from '@repository/User' import { UserRepository } from '@repository/User'
import AdminCreateContributionArgs from '@arg/AdminCreateContributionArgs' import AdminCreateContributionArgs from '@arg/AdminCreateContributionArgs'
import AdminUpdateUnconfirmedContributionArgs from '@arg/AdminUpdateUnconfirmedContributionArgs' import AdminUpdateContributionArgs from '@arg/AdminUpdateContributionArgs'
import SearchUsersArgs from '@arg/SearchUsersArgs' import SearchUsersArgs from '@arg/SearchUsersArgs'
import ContributionLinkArgs from '@arg/ContributionLinkArgs' import ContributionLinkArgs from '@arg/ContributionLinkArgs'
import { Transaction as DbTransaction } from '@entity/Transaction' import { Transaction as DbTransaction } from '@entity/Transaction'
@ -207,12 +207,12 @@ export class AdminResolver {
} }
@Authorized([RIGHTS.ADMIN_CREATE_CONTRIBUTIONS]) @Authorized([RIGHTS.ADMIN_CREATE_CONTRIBUTIONS])
@Mutation(() => AdminCreateContribution) @Mutation(() => AdminCreateContributions)
async adminCreateContributions( async adminCreateContributions(
@Arg('pendingCreations', () => [AdminCreateContributionArgs]) @Arg('pendingCreations', () => [AdminCreateContributionArgs])
contributions: AdminCreateContributionArgs[], contributions: AdminCreateContributionArgs[],
@Ctx() context: Context, @Ctx() context: Context,
): Promise<AdminCreateContribution> { ): Promise<AdminCreateContributions> {
let success = false let success = false
const successfulContribution: string[] = [] const successfulContribution: string[] = []
const failedContribution: string[] = [] const failedContribution: string[] = []
@ -233,12 +233,12 @@ export class AdminResolver {
} }
} }
@Authorized([RIGHTS.ADMIN_UPDATE_UNCONFIRMED_CONTRIBUTION]) @Authorized([RIGHTS.ADMIN_UPDATE_CONTRIBUTION])
@Mutation(() => AdminUpdateUnconfirmedContribution) @Mutation(() => AdminUpdateContribution)
async updatePendingCreation( async updatePendingCreation(
@Args() { id, email, amount, memo, creationDate }: AdminUpdateUnconfirmedContributionArgs, @Args() { id, email, amount, memo, creationDate }: AdminUpdateContributionArgs,
@Ctx() context: Context, @Ctx() context: Context,
): Promise<AdminUpdateUnconfirmedContribution> { ): Promise<AdminUpdateContribution> {
const user = await dbUser.findOne({ email }, { withDeleted: true }) const user = await dbUser.findOne({ email }, { withDeleted: true })
if (!user) { if (!user) {
throw new Error(`Could not find user with email: ${email}`) throw new Error(`Could not find user with email: ${email}`)
@ -273,7 +273,7 @@ export class AdminResolver {
contributionToUpdate.moderatorId = moderator.id contributionToUpdate.moderatorId = moderator.id
await Contribution.save(contributionToUpdate) await Contribution.save(contributionToUpdate)
const result = new AdminUpdateUnconfirmedContribution() const result = new AdminUpdateContribution()
result.amount = amount result.amount = amount
result.memo = contributionToUpdate.memo result.memo = contributionToUpdate.memo
result.date = contributionToUpdate.contributionDate result.date = contributionToUpdate.contributionDate