mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
fix linting
This commit is contained in:
parent
f61d61c861
commit
50ecb94f2c
@ -11,8 +11,6 @@ import { logger, i18n as localization } from '@test/testSetup'
|
||||
|
||||
import { CONFIG } from '@/config'
|
||||
|
||||
CONFIG.EMAIL_SENDER = 'info@gradido.net'
|
||||
|
||||
import { sendEmailTranslated } from './sendEmailTranslated'
|
||||
import {
|
||||
sendAddedContributionMessageEmail,
|
||||
@ -27,6 +25,8 @@ import {
|
||||
sendContributionChangedByModeratorEmail,
|
||||
} from './sendEmailVariants'
|
||||
|
||||
CONFIG.EMAIL_SENDER = 'info@gradido.net'
|
||||
|
||||
let con: Connection
|
||||
let testEnv: {
|
||||
mutate: ApolloServerTestClient['mutate']
|
||||
@ -299,7 +299,7 @@ describe('sendEmailVariants', () => {
|
||||
senderFirstName: 'Bibi',
|
||||
senderLastName: 'Bloxberg',
|
||||
contributionMemo: 'My contribution.',
|
||||
contributionMemoUpdated: 'This is a better contribution memo.'
|
||||
contributionMemoUpdated: 'This is a better contribution memo.',
|
||||
})
|
||||
})
|
||||
|
||||
@ -328,7 +328,6 @@ describe('sendEmailVariants', () => {
|
||||
|
||||
describe('result', () => {
|
||||
it('is the expected object', () => {
|
||||
console.log(result.originalMessage.text)
|
||||
expect(result).toMatchObject({
|
||||
envelope: {
|
||||
from: 'info@gradido.net',
|
||||
|
||||
@ -22,6 +22,12 @@ import { OpenCreation } from '@model/OpenCreation'
|
||||
import { UnconfirmedContribution } from '@model/UnconfirmedContribution'
|
||||
|
||||
import { RIGHTS } from '@/auth/RIGHTS'
|
||||
import {
|
||||
sendContributionChangedByModeratorEmail,
|
||||
sendContributionConfirmedEmail,
|
||||
sendContributionDeletedEmail,
|
||||
sendContributionDeniedEmail,
|
||||
} from '@/emails/sendEmailVariants'
|
||||
import {
|
||||
EVENT_CONTRIBUTION_CREATE,
|
||||
EVENT_CONTRIBUTION_DELETE,
|
||||
@ -45,7 +51,6 @@ import { getUserCreation, validateContribution, getOpenCreations } from './util/
|
||||
import { findContributions } from './util/findContributions'
|
||||
import { getLastTransaction } from './util/getLastTransaction'
|
||||
import { sendTransactionsToDltConnector } from './util/sendTransactionsToDltConnector'
|
||||
import { sendContributionChangedByModeratorEmail, sendContributionConfirmedEmail, sendContributionDeletedEmail, sendContributionDeniedEmail } from '@/emails/sendEmailVariants'
|
||||
|
||||
@Resolver()
|
||||
export class ContributionResolver {
|
||||
@ -255,7 +260,8 @@ export class ContributionResolver {
|
||||
adminUpdateContributionArgs,
|
||||
context,
|
||||
)
|
||||
const { contribution, contributionMessage, createdByUserChangedByModerator } = await updateUnconfirmedContributionContext.run()
|
||||
const { contribution, contributionMessage, createdByUserChangedByModerator } =
|
||||
await updateUnconfirmedContributionContext.run()
|
||||
await getConnection().transaction(async (transactionalEntityManager: EntityManager) => {
|
||||
await Promise.all([
|
||||
transactionalEntityManager.save(contribution),
|
||||
@ -288,7 +294,7 @@ export class ContributionResolver {
|
||||
senderFirstName: moderator.firstName,
|
||||
senderLastName: moderator.lastName,
|
||||
contributionMemo: updateUnconfirmedContributionContext.getOldMemo(),
|
||||
contributionMemoUpdated: contribution.memo
|
||||
contributionMemoUpdated: contribution.memo,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -41,13 +41,16 @@ export class UnconfirmedContributionAdminRole extends UnconfirmedContributionRol
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
protected async validate(clientTimezoneOffset: number): Promise<void> {
|
||||
await super.validate(clientTimezoneOffset)
|
||||
// creation date is currently not changeable
|
||||
if (this.self.memo === this.updateData.memo &&
|
||||
this.self.amount === this.updatedAmount &&
|
||||
this.self.contributionDate.getTime() === (new Date(this.updatedCreationDate).getTime())) {
|
||||
throw new LogError("the contribution wasn't changed at all")
|
||||
if (
|
||||
this.self.memo === this.updateData.memo &&
|
||||
this.self.amount === this.updatedAmount &&
|
||||
this.self.contributionDate.getTime() === new Date(this.updatedCreationDate).getTime()
|
||||
) {
|
||||
throw new LogError("the contribution wasn't changed at all")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,10 +47,12 @@ export class UnconfirmedContributionUserRole extends UnconfirmedContributionRole
|
||||
protected async validate(clientTimezoneOffset: number): Promise<void> {
|
||||
await super.validate(clientTimezoneOffset)
|
||||
// creation date is currently not changeable
|
||||
if (this.self.memo === this.updateData.memo &&
|
||||
this.self.amount === this.updatedAmount &&
|
||||
this.self.contributionDate.getTime() === (new Date(this.updatedCreationDate).getTime())) {
|
||||
throw new LogError("the contribution wasn't changed at all")
|
||||
if (
|
||||
this.self.memo === this.updateData.memo &&
|
||||
this.self.amount === this.updatedAmount &&
|
||||
this.self.contributionDate.getTime() === new Date(this.updatedCreationDate).getTime()
|
||||
) {
|
||||
throw new LogError("the contribution wasn't changed at all")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ export class UpdateUnconfirmedContributionContext {
|
||||
public async run(): Promise<{
|
||||
contribution: Contribution
|
||||
contributionMessage: ContributionMessage
|
||||
availableCreationSums: Decimal[],
|
||||
availableCreationSums: Decimal[]
|
||||
createdByUserChangedByModerator: boolean
|
||||
}> {
|
||||
let createdByUserChangedByModerator = false
|
||||
@ -84,7 +84,7 @@ export class UpdateUnconfirmedContributionContext {
|
||||
contribution: contributionToUpdate,
|
||||
contributionMessage: contributionMessageBuilder.build(),
|
||||
availableCreationSums: unconfirmedContributionRole.getAvailableCreationSums(),
|
||||
createdByUserChangedByModerator
|
||||
createdByUserChangedByModerator,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
export const getTimeDurationObject = (time: number): {
|
||||
export const getTimeDurationObject = (
|
||||
time: number,
|
||||
): {
|
||||
hours?: number
|
||||
minutes: number
|
||||
} => {
|
||||
|
||||
@ -187,7 +187,10 @@ export default {
|
||||
const originalContributionDate = new Date(this.originalContributionDate)
|
||||
if (this.openCreations && this.openCreations.length)
|
||||
return this.openCreations.slice(1).map((creation) => {
|
||||
if (creation.year === originalContributionDate.getFullYear() && creation.month === originalContributionDate.getMonth())
|
||||
if (
|
||||
creation.year === originalContributionDate.getFullYear() &&
|
||||
creation.month === originalContributionDate.getMonth()
|
||||
)
|
||||
return parseInt(creation.amount) + this.amountToAdd
|
||||
return parseInt(creation.amount)
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user