mirror of
https://github.com/IT4Change/gradido.git
synced 2026-04-26 07:47:37 +00:00
rename from pending creation to unconfirmed contribution
This commit is contained in:
parent
92b076e8b1
commit
5845f708f6
@ -3,7 +3,7 @@ import Decimal from 'decimal.js-light'
|
|||||||
|
|
||||||
@InputType()
|
@InputType()
|
||||||
@ArgsType()
|
@ArgsType()
|
||||||
export default class CreatePendingCreationArgs {
|
export default class AdminCreateContributionArgs {
|
||||||
@Field(() => String)
|
@Field(() => String)
|
||||||
email: string
|
email: string
|
||||||
|
|
||||||
@ -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 UpdatePendingCreationArgs {
|
export default class AdminUpdatePendingContributionArgs {
|
||||||
@Field(() => Int)
|
@Field(() => Int)
|
||||||
id: number
|
id: number
|
||||||
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
import { ObjectType, Field } from 'type-graphql'
|
import { ObjectType, Field } from 'type-graphql'
|
||||||
|
|
||||||
@ObjectType()
|
@ObjectType()
|
||||||
export class CreatePendingCreations {
|
export class AdminCreateContribution {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.success = false
|
this.success = false
|
||||||
this.successfulCreation = []
|
this.successfulCreation = []
|
||||||
@ -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 UpdatePendingCreation {
|
export class AdminUpdateUnconfirmedContribution {
|
||||||
@Field(() => Date)
|
@Field(() => Date)
|
||||||
date: Date
|
date: Date
|
||||||
|
|
||||||
@ -2,7 +2,7 @@ import { ObjectType, Field, Int } from 'type-graphql'
|
|||||||
import Decimal from 'decimal.js-light'
|
import Decimal from 'decimal.js-light'
|
||||||
|
|
||||||
@ObjectType()
|
@ObjectType()
|
||||||
export class PendingContribution {
|
export class UnconfirmedContribution {
|
||||||
@Field(() => String)
|
@Field(() => String)
|
||||||
firstName: string
|
firstName: string
|
||||||
|
|
||||||
@ -11,13 +11,13 @@ import {
|
|||||||
FindOperator,
|
FindOperator,
|
||||||
} from '@dbTools/typeorm'
|
} from '@dbTools/typeorm'
|
||||||
import { UserAdmin, SearchUsersResult } from '@model/UserAdmin'
|
import { UserAdmin, SearchUsersResult } from '@model/UserAdmin'
|
||||||
import { PendingContribution } from '@model/PendingContribution'
|
import { UnconfirmedContribution } from '@model/UnconfirmedContribution'
|
||||||
import { CreatePendingCreations } from '@model/CreatePendingCreations'
|
import { AdminCreateContribution } from '@model/AdminCreateContribution'
|
||||||
import { UpdatePendingCreation } from '@model/UpdatePendingCreation'
|
import { AdminUpdateUnconfirmedContribution } from '@model/AdminUpdateUnconfirmedContribution'
|
||||||
import { RIGHTS } from '@/auth/RIGHTS'
|
import { RIGHTS } from '@/auth/RIGHTS'
|
||||||
import { UserRepository } from '@repository/User'
|
import { UserRepository } from '@repository/User'
|
||||||
import CreatePendingCreationArgs from '@arg/CreatePendingCreationArgs'
|
import AdminCreateContributionArgs from '@arg/AdminCreateContributionArgs'
|
||||||
import UpdatePendingCreationArgs from '@arg/UpdatePendingCreationArgs'
|
import AdminUpdateUnconfirmedContributionArgs from '@arg/AdminUpdateUnconfirmedContributionArgs'
|
||||||
import SearchUsersArgs from '@arg/SearchUsersArgs'
|
import SearchUsersArgs from '@arg/SearchUsersArgs'
|
||||||
import { Transaction as DbTransaction } from '@entity/Transaction'
|
import { Transaction as DbTransaction } from '@entity/Transaction'
|
||||||
import { Transaction } from '@model/Transaction'
|
import { Transaction } from '@model/Transaction'
|
||||||
@ -167,7 +167,7 @@ export class AdminResolver {
|
|||||||
@Authorized([RIGHTS.CREATE_PENDING_CREATION])
|
@Authorized([RIGHTS.CREATE_PENDING_CREATION])
|
||||||
@Mutation(() => [Number])
|
@Mutation(() => [Number])
|
||||||
async createPendingCreation(
|
async createPendingCreation(
|
||||||
@Args() { email, amount, memo, creationDate }: CreatePendingCreationArgs,
|
@Args() { email, amount, memo, creationDate }: AdminCreateContributionArgs,
|
||||||
@Ctx() context: Context,
|
@Ctx() context: Context,
|
||||||
): Promise<Decimal[]> {
|
): Promise<Decimal[]> {
|
||||||
logger.trace('createPendingCreation...')
|
logger.trace('createPendingCreation...')
|
||||||
@ -202,12 +202,12 @@ export class AdminResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Authorized([RIGHTS.CREATE_PENDING_CREATION])
|
@Authorized([RIGHTS.CREATE_PENDING_CREATION])
|
||||||
@Mutation(() => CreatePendingCreations)
|
@Mutation(() => AdminCreateContribution)
|
||||||
async createPendingCreations(
|
async createPendingCreations(
|
||||||
@Arg('pendingCreations', () => [CreatePendingCreationArgs])
|
@Arg('pendingCreations', () => [AdminCreateContributionArgs])
|
||||||
contributions: CreatePendingCreationArgs[],
|
contributions: AdminCreateContributionArgs[],
|
||||||
@Ctx() context: Context,
|
@Ctx() context: Context,
|
||||||
): Promise<CreatePendingCreations> {
|
): Promise<AdminCreateContribution> {
|
||||||
let success = false
|
let success = false
|
||||||
const successfulCreation: string[] = []
|
const successfulCreation: string[] = []
|
||||||
const failedCreation: string[] = []
|
const failedCreation: string[] = []
|
||||||
@ -229,11 +229,11 @@ export class AdminResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Authorized([RIGHTS.UPDATE_PENDING_CREATION])
|
@Authorized([RIGHTS.UPDATE_PENDING_CREATION])
|
||||||
@Mutation(() => UpdatePendingCreation)
|
@Mutation(() => AdminUpdateUnconfirmedContribution)
|
||||||
async updatePendingCreation(
|
async updatePendingCreation(
|
||||||
@Args() { id, email, amount, memo, creationDate }: UpdatePendingCreationArgs,
|
@Args() { id, email, amount, memo, creationDate }: AdminUpdateUnconfirmedContributionArgs,
|
||||||
@Ctx() context: Context,
|
@Ctx() context: Context,
|
||||||
): Promise<UpdatePendingCreation> {
|
): Promise<AdminUpdateUnconfirmedContribution> {
|
||||||
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}`)
|
||||||
@ -268,7 +268,7 @@ export class AdminResolver {
|
|||||||
contributionToUpdate.moderatorId = moderator.id
|
contributionToUpdate.moderatorId = moderator.id
|
||||||
|
|
||||||
await Contribution.save(contributionToUpdate)
|
await Contribution.save(contributionToUpdate)
|
||||||
const result = new UpdatePendingCreation()
|
const result = new AdminUpdateUnconfirmedContribution()
|
||||||
result.amount = amount
|
result.amount = amount
|
||||||
result.memo = contributionToUpdate.memo
|
result.memo = contributionToUpdate.memo
|
||||||
result.date = contributionToUpdate.contributionDate
|
result.date = contributionToUpdate.contributionDate
|
||||||
@ -279,8 +279,8 @@ export class AdminResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Authorized([RIGHTS.SEARCH_PENDING_CREATION])
|
@Authorized([RIGHTS.SEARCH_PENDING_CREATION])
|
||||||
@Query(() => [PendingContribution])
|
@Query(() => [UnconfirmedContribution])
|
||||||
async getPendingCreations(): Promise<PendingContribution[]> {
|
async getPendingCreations(): Promise<UnconfirmedContribution[]> {
|
||||||
const contributions = await Contribution.find({ where: { confirmedAt: IsNull() } })
|
const contributions = await Contribution.find({ where: { confirmedAt: IsNull() } })
|
||||||
if (contributions.length === 0) {
|
if (contributions.length === 0) {
|
||||||
return []
|
return []
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user