mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
merge
This commit is contained in:
parent
b34208b81a
commit
3391b3a9ee
@ -1,16 +1,19 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import axios from 'axios'
|
||||
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
import LogError from '@/server/LogError'
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export const apiPost = async (url: string, payload: unknown): Promise<any> => {
|
||||
logger.trace('POST: url=' + url + ' payload=' + payload)
|
||||
logger.trace('POST', url, payload)
|
||||
return axios
|
||||
.post(url, payload)
|
||||
.then((result) => {
|
||||
logger.trace('POST-Response: result=' + result)
|
||||
logger.trace('POST-Response', result)
|
||||
if (result.status !== 200) {
|
||||
throw new Error('HTTP Status Error ' + result.status)
|
||||
throw new LogError('HTTP Status Error', result.status)
|
||||
}
|
||||
if (result.data.state !== 'success') {
|
||||
throw new Error(result.data.msg)
|
||||
@ -28,9 +31,9 @@ export const apiGet = async (url: string): Promise<any> => {
|
||||
return axios
|
||||
.get(url)
|
||||
.then((result) => {
|
||||
logger.trace('GET-Response: result=' + result)
|
||||
logger.trace('GET-Response', result)
|
||||
if (result.status !== 200) {
|
||||
throw new Error('HTTP Status Error ' + result.status)
|
||||
throw new LogError('HTTP Status Error', result.status)
|
||||
}
|
||||
if (!['success', 'warning'].includes(result.data.state)) {
|
||||
throw new Error(result.data.msg)
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
import { KlicktippConnector } from './klicktippConnector'
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
import axios, { AxiosRequestConfig, Method } from 'axios'
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
import { createTransport } from 'nodemailer'
|
||||
import { logger, i18n } from '@test/testSetup'
|
||||
import CONFIG from '@/config'
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import CONFIG from '@/config'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
import path from 'path'
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { testEnvironment } from '@test/helpers'
|
||||
import { logger, i18n as localization } from '@test/testSetup'
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import { gql } from 'graphql-request'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
import { Community as DbCommunity } from '@entity/Community'
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import { gql } from 'graphql-request'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
import { Community as DbCommunity } from '@entity/Community'
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
|
||||
@ -8,14 +8,14 @@ import { backendLogger as logger } from '@/server/logger'
|
||||
import { ApiVersionType } from './enum/apiVersionType'
|
||||
import LogError from '@/server/LogError'
|
||||
|
||||
export async function startValidateCommunities(timerInterval: number): Promise<void> {
|
||||
export function startValidateCommunities(timerInterval: number): void {
|
||||
logger.info(
|
||||
`Federation: startValidateCommunities loop with an interval of ${timerInterval} ms...`,
|
||||
)
|
||||
// TODO: replace the timer-loop by an event-based communication to verify announced foreign communities
|
||||
// better to use setTimeout twice than setInterval once -> see https://javascript.info/settimeout-setinterval
|
||||
setTimeout(function run() {
|
||||
validateCommunities()
|
||||
void validateCommunities()
|
||||
setTimeout(run, timerInterval)
|
||||
}, timerInterval)
|
||||
}
|
||||
@ -27,8 +27,8 @@ export async function validateCommunities(): Promise<void> {
|
||||
.getMany()
|
||||
|
||||
logger.debug(`Federation: found ${dbCommunities.length} dbCommunities`)
|
||||
dbCommunities.forEach(async function (dbCom) {
|
||||
logger.debug(`Federation: dbCom: ${JSON.stringify(dbCom)}`)
|
||||
for (const dbCom of dbCommunities) {
|
||||
logger.debug('Federation: dbCom', dbCom)
|
||||
const apiValueStrings: string[] = Object.values(ApiVersionType)
|
||||
logger.debug(`suppported ApiVersions=`, apiValueStrings)
|
||||
if (apiValueStrings.includes(dbCom.apiVersion)) {
|
||||
@ -38,11 +38,13 @@ export async function validateCommunities(): Promise<void> {
|
||||
try {
|
||||
const pubKey = await invokeVersionedRequestGetPublicKey(dbCom)
|
||||
logger.info(
|
||||
`Federation: received publicKey=${pubKey} from endpoint=${dbCom.endPoint}/${dbCom.apiVersion}`,
|
||||
'Federation: received publicKey from endpoint',
|
||||
pubKey,
|
||||
`${dbCom.endPoint}/${dbCom.apiVersion}`,
|
||||
)
|
||||
if (pubKey && pubKey === dbCom.publicKey.toString('hex')) {
|
||||
logger.info(`Federation: matching publicKey: ${pubKey}`)
|
||||
DbCommunity.update({ id: dbCom.id }, { verifiedAt: new Date() })
|
||||
await DbCommunity.update({ id: dbCom.id }, { verifiedAt: new Date() })
|
||||
logger.debug(`Federation: updated dbCom: ${JSON.stringify(dbCom)}`)
|
||||
}
|
||||
/*
|
||||
@ -58,10 +60,11 @@ export async function validateCommunities(): Promise<void> {
|
||||
}
|
||||
} else {
|
||||
logger.warn(
|
||||
`Federation: dbCom: ${dbCom.id} with unsupported apiVersion=${dbCom.apiVersion}; supported versions=${apiValueStrings}`,
|
||||
`Federation: dbCom: ${dbCom.id} with unsupported apiVersion=${dbCom.apiVersion}; supported versions`,
|
||||
apiValueStrings,
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function isLogError(err: unknown) {
|
||||
|
||||
@ -22,7 +22,7 @@ export default class ContributionLinkArgs {
|
||||
validTo?: string | null
|
||||
|
||||
@Field(() => Decimal, { nullable: true })
|
||||
maxAmountPerMonth: Decimal | null
|
||||
maxAmountPerMonth?: Decimal | null
|
||||
|
||||
@Field(() => Int)
|
||||
maxPerCycle: number
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import { ArgsType, Field, InputType } from 'type-graphql'
|
||||
import { ArgsType, Field, ID, InputType } from 'type-graphql'
|
||||
|
||||
@InputType()
|
||||
@ArgsType()
|
||||
export default class ContributionMessageArgs {
|
||||
@Field(() => Number)
|
||||
@Field(() => ID)
|
||||
contributionId: number
|
||||
|
||||
@Field(() => String)
|
||||
|
||||
@ -11,11 +11,11 @@ export default class CreateUserArgs {
|
||||
@Field(() => String)
|
||||
lastName: string
|
||||
|
||||
@Field(() => String)
|
||||
language?: string // Will default to DEFAULT_LANGUAGE
|
||||
@Field(() => String, { nullable: true })
|
||||
language?: string | null
|
||||
|
||||
@Field(() => Int, { nullable: true })
|
||||
publisherId: number
|
||||
publisherId?: number | null
|
||||
|
||||
@Field(() => String, { nullable: true })
|
||||
redeemCode?: string | null
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable type-graphql/invalid-nullable-input-type */
|
||||
import { ArgsType, Field, Int } from 'type-graphql'
|
||||
import { Order } from '@enum/Order'
|
||||
|
||||
|
||||
@ -7,11 +7,14 @@ export default class SearchUsersArgs {
|
||||
searchText: string
|
||||
|
||||
@Field(() => Int, { nullable: true })
|
||||
// eslint-disable-next-line type-graphql/invalid-nullable-input-type
|
||||
currentPage?: number
|
||||
|
||||
@Field(() => Int, { nullable: true })
|
||||
// eslint-disable-next-line type-graphql/invalid-nullable-input-type
|
||||
pageSize?: number
|
||||
|
||||
// eslint-disable-next-line type-graphql/wrong-decorator-signature
|
||||
@Field(() => SearchUsersFilters, { nullable: true, defaultValue: null })
|
||||
filters: SearchUsersFilters
|
||||
filters?: SearchUsersFilters | null
|
||||
}
|
||||
|
||||
@ -3,8 +3,8 @@ import { Field, InputType } from 'type-graphql'
|
||||
@InputType()
|
||||
export default class SearchUsersFilters {
|
||||
@Field(() => Boolean, { nullable: true, defaultValue: null })
|
||||
byActivated: boolean
|
||||
byActivated?: boolean | null
|
||||
|
||||
@Field(() => Boolean, { nullable: true, defaultValue: null })
|
||||
byDeleted: boolean
|
||||
byDeleted?: boolean | null
|
||||
}
|
||||
|
||||
@ -1,13 +1,14 @@
|
||||
/* eslint-disable type-graphql/invalid-nullable-input-type */
|
||||
import { Field, InputType } from 'type-graphql'
|
||||
|
||||
@InputType()
|
||||
export default class TransactionLinkFilters {
|
||||
@Field(() => Boolean, { nullable: true })
|
||||
withDeleted: boolean
|
||||
withDeleted?: boolean
|
||||
|
||||
@Field(() => Boolean, { nullable: true })
|
||||
withExpired: boolean
|
||||
withExpired?: boolean
|
||||
|
||||
@Field(() => Boolean, { nullable: true })
|
||||
withRedeemed: boolean
|
||||
withRedeemed?: boolean
|
||||
}
|
||||
|
||||
@ -9,5 +9,5 @@ export default class UnsecureLoginArgs {
|
||||
password: string
|
||||
|
||||
@Field(() => Int, { nullable: true })
|
||||
publisherId: number
|
||||
publisherId?: number | null
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ArgsType, Field } from 'type-graphql'
|
||||
import { ArgsType, Field, Int } from 'type-graphql'
|
||||
|
||||
@ArgsType()
|
||||
export default class UpdateUserInfosArgs {
|
||||
@ -11,8 +11,8 @@ export default class UpdateUserInfosArgs {
|
||||
@Field({ nullable: true })
|
||||
language?: string
|
||||
|
||||
@Field({ nullable: true })
|
||||
publisherId?: number
|
||||
@Field(() => Int, { nullable: true })
|
||||
publisherId?: number | null
|
||||
|
||||
@Field({ nullable: true })
|
||||
password?: string
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
import { AuthChecker } from 'type-graphql'
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ObjectType, Field } from 'type-graphql'
|
||||
import { ObjectType, Field, Int } from 'type-graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
|
||||
@ObjectType()
|
||||
@ -19,14 +19,14 @@ export class Balance {
|
||||
@Field(() => Decimal)
|
||||
balance: Decimal
|
||||
|
||||
@Field(() => Number, { nullable: true })
|
||||
@Field(() => Int, { nullable: true })
|
||||
balanceGDT: number | null
|
||||
|
||||
// the count of all transactions
|
||||
@Field(() => Number)
|
||||
@Field(() => Int)
|
||||
count: number
|
||||
|
||||
// the count of transaction links
|
||||
@Field(() => Number)
|
||||
@Field(() => Int)
|
||||
linkCount: number
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
import { ObjectType, Field } from 'type-graphql'
|
||||
import { ObjectType, Field, ID } from 'type-graphql'
|
||||
|
||||
@ObjectType()
|
||||
export class Community {
|
||||
@ -14,7 +16,7 @@ export class Community {
|
||||
}
|
||||
}
|
||||
|
||||
@Field(() => Number)
|
||||
@Field(() => ID)
|
||||
id: number
|
||||
|
||||
@Field(() => String)
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import { ObjectType, Field } from 'type-graphql'
|
||||
import { ObjectType, Field, Int } from 'type-graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
|
||||
@ObjectType()
|
||||
export class DynamicStatisticsFields {
|
||||
@Field(() => Number)
|
||||
@Field(() => Int)
|
||||
activeUsers: number
|
||||
|
||||
@Field(() => Decimal)
|
||||
@ -15,13 +15,13 @@ export class DynamicStatisticsFields {
|
||||
|
||||
@ObjectType()
|
||||
export class CommunityStatistics {
|
||||
@Field(() => Number)
|
||||
@Field(() => Int)
|
||||
allUsers: number
|
||||
|
||||
@Field(() => Number)
|
||||
@Field(() => Int)
|
||||
totalUsers: number
|
||||
|
||||
@Field(() => Number)
|
||||
@Field(() => Int)
|
||||
deletedUsers: number
|
||||
|
||||
@Field(() => Decimal)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ObjectType, Field, Int } from 'type-graphql'
|
||||
import { ObjectType, Field, Int, ID } from 'type-graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Contribution as dbContribution } from '@entity/Contribution'
|
||||
import { User } from '@entity/User'
|
||||
@ -23,7 +23,7 @@ export class Contribution {
|
||||
this.deletedBy = contribution.deletedBy
|
||||
}
|
||||
|
||||
@Field(() => Number)
|
||||
@Field(() => ID)
|
||||
id: number
|
||||
|
||||
@Field(() => String, { nullable: true })
|
||||
@ -44,13 +44,13 @@ export class Contribution {
|
||||
@Field(() => Date, { nullable: true })
|
||||
confirmedAt: Date | null
|
||||
|
||||
@Field(() => Number, { nullable: true })
|
||||
@Field(() => ID, { nullable: true })
|
||||
confirmedBy: number | null
|
||||
|
||||
@Field(() => Date, { nullable: true })
|
||||
deniedAt: Date | null
|
||||
|
||||
@Field(() => Number, { nullable: true })
|
||||
@Field(() => ID, { nullable: true })
|
||||
deniedBy: number | null
|
||||
|
||||
@Field(() => Date, { nullable: true })
|
||||
@ -62,7 +62,7 @@ export class Contribution {
|
||||
@Field(() => Date)
|
||||
contributionDate: Date
|
||||
|
||||
@Field(() => Number)
|
||||
@Field(() => Int)
|
||||
messagesCount: number
|
||||
|
||||
@Field(() => String)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ObjectType, Field, Int } from 'type-graphql'
|
||||
import { ObjectType, Field, Int, ID } from 'type-graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { ContributionLink as dbContributionLink } from '@entity/ContributionLink'
|
||||
import CONFIG from '@/config'
|
||||
@ -21,7 +21,7 @@ export class ContributionLink {
|
||||
this.link = CONFIG.COMMUNITY_REDEEM_CONTRIBUTION_URL.replace(/{code}/g, this.code)
|
||||
}
|
||||
|
||||
@Field(() => Number)
|
||||
@Field(() => ID)
|
||||
id: number
|
||||
|
||||
@Field(() => Decimal)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ObjectType, Field } from 'type-graphql'
|
||||
import { ObjectType, Field, Int } from 'type-graphql'
|
||||
import { ContributionLink } from '@model/ContributionLink'
|
||||
|
||||
@ObjectType()
|
||||
@ -6,6 +6,6 @@ export class ContributionLinkList {
|
||||
@Field(() => [ContributionLink])
|
||||
links: ContributionLink[]
|
||||
|
||||
@Field(() => Number)
|
||||
@Field(() => Int)
|
||||
count: number
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Field, ObjectType } from 'type-graphql'
|
||||
import { Field, ID, Int, ObjectType } from 'type-graphql'
|
||||
import { ContributionMessage as DbContributionMessage } from '@entity/ContributionMessage'
|
||||
import { User } from '@entity/User'
|
||||
|
||||
@ -16,7 +16,7 @@ export class ContributionMessage {
|
||||
this.isModerator = contributionMessage.isModerator
|
||||
}
|
||||
|
||||
@Field(() => Number)
|
||||
@Field(() => ID)
|
||||
id: number
|
||||
|
||||
@Field(() => String)
|
||||
@ -26,7 +26,7 @@ export class ContributionMessage {
|
||||
createdAt: Date
|
||||
|
||||
@Field(() => Date, { nullable: true })
|
||||
updatedAt?: Date | null
|
||||
updatedAt: Date | null
|
||||
|
||||
@Field(() => String)
|
||||
type: string
|
||||
@ -37,7 +37,7 @@ export class ContributionMessage {
|
||||
@Field(() => String, { nullable: true })
|
||||
userLastName: string | null
|
||||
|
||||
@Field(() => Number, { nullable: true })
|
||||
@Field(() => ID, { nullable: true })
|
||||
userId: number | null
|
||||
|
||||
@Field(() => Boolean)
|
||||
@ -45,7 +45,7 @@ export class ContributionMessage {
|
||||
}
|
||||
@ObjectType()
|
||||
export class ContributionMessageListResult {
|
||||
@Field(() => Number)
|
||||
@Field(() => Int)
|
||||
count: number
|
||||
|
||||
@Field(() => [ContributionMessage])
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
import { ObjectType, Field } from 'type-graphql'
|
||||
import { ObjectType, Field, Float, ID } from 'type-graphql'
|
||||
import { GdtEntryType } from '@enum/GdtEntryType'
|
||||
|
||||
@ObjectType()
|
||||
@ -19,10 +21,10 @@ export class GdtEntry {
|
||||
this.gdt = json.gdt
|
||||
}
|
||||
|
||||
@Field(() => Number)
|
||||
@Field(() => ID)
|
||||
id: number
|
||||
|
||||
@Field(() => Number)
|
||||
@Field(() => Float)
|
||||
amount: number
|
||||
|
||||
@Field(() => String)
|
||||
@ -40,15 +42,15 @@ export class GdtEntry {
|
||||
@Field(() => GdtEntryType)
|
||||
gdtEntryType: GdtEntryType
|
||||
|
||||
@Field(() => Number)
|
||||
@Field(() => Float)
|
||||
factor: number
|
||||
|
||||
@Field(() => Number)
|
||||
@Field(() => Float)
|
||||
amount2: number
|
||||
|
||||
@Field(() => Number)
|
||||
@Field(() => Float)
|
||||
factor2: number
|
||||
|
||||
@Field(() => Number)
|
||||
@Field(() => Float)
|
||||
gdt: number
|
||||
}
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
import { GdtEntry } from './GdtEntry'
|
||||
import { ObjectType, Field } from 'type-graphql'
|
||||
import { ObjectType, Field, Int } from 'type-graphql'
|
||||
|
||||
@ObjectType()
|
||||
export class GdtEntryList {
|
||||
@ -16,15 +19,15 @@ export class GdtEntryList {
|
||||
@Field(() => String)
|
||||
state: string
|
||||
|
||||
@Field(() => Number)
|
||||
@Field(() => Int)
|
||||
count: number
|
||||
|
||||
@Field(() => [GdtEntry], { nullable: true })
|
||||
gdtEntries?: GdtEntry[]
|
||||
gdtEntries: GdtEntry[] | null
|
||||
|
||||
@Field(() => Number)
|
||||
@Field(() => Int)
|
||||
gdtSum: number
|
||||
|
||||
@Field(() => Number)
|
||||
@Field(() => Int)
|
||||
timeUsed: number
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
import { ObjectType, Field } from 'type-graphql'
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ObjectType, Field } from 'type-graphql'
|
||||
import { ObjectType, Field, ID } from 'type-graphql'
|
||||
import { Decay } from './Decay'
|
||||
import { Transaction as dbTransaction } from '@entity/Transaction'
|
||||
import Decimal from 'decimal.js-light'
|
||||
@ -41,19 +41,19 @@ export class Transaction {
|
||||
this.memo = transaction.memo
|
||||
this.creationDate = transaction.creationDate
|
||||
this.linkedUser = linkedUser
|
||||
this.linkedTransactionId = transaction.linkedTransactionId
|
||||
this.linkedTransactionId = transaction.linkedTransactionId || null
|
||||
this.linkId = transaction.contribution
|
||||
? transaction.contribution.contributionLinkId
|
||||
: transaction.transactionLinkId
|
||||
: transaction.transactionLinkId || null
|
||||
}
|
||||
|
||||
@Field(() => Number)
|
||||
@Field(() => ID)
|
||||
id: number
|
||||
|
||||
@Field(() => User)
|
||||
user: User
|
||||
|
||||
@Field(() => Number, { nullable: true })
|
||||
@Field(() => ID, { nullable: true })
|
||||
previous: number | null
|
||||
|
||||
@Field(() => TransactionTypeId)
|
||||
@ -80,10 +80,10 @@ export class Transaction {
|
||||
@Field(() => User, { nullable: true })
|
||||
linkedUser: User | null
|
||||
|
||||
@Field(() => Number, { nullable: true })
|
||||
linkedTransactionId?: number | null
|
||||
@Field(() => ID, { nullable: true })
|
||||
linkedTransactionId: number | null
|
||||
|
||||
// Links to the TransactionLink/ContributionLink when transaction was created by a link
|
||||
@Field(() => Number, { nullable: true })
|
||||
linkId?: number | null
|
||||
@Field(() => ID, { nullable: true })
|
||||
linkId: number | null
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ObjectType, Field, Int } from 'type-graphql'
|
||||
import { ObjectType, Field, Int, ID } from 'type-graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { TransactionLink as dbTransactionLink } from '@entity/TransactionLink'
|
||||
import { User } from './User'
|
||||
@ -21,7 +21,7 @@ export class TransactionLink {
|
||||
this.link = CONFIG.COMMUNITY_REDEEM_URL.replace(/{code}/g, this.code)
|
||||
}
|
||||
|
||||
@Field(() => Number)
|
||||
@Field(() => ID)
|
||||
id: number
|
||||
|
||||
@Field(() => User)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ObjectType, Field, Int } from 'type-graphql'
|
||||
import { ObjectType, Field, Int, ID } from 'type-graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Contribution } from '@entity/Contribution'
|
||||
import { User } from '@entity/User'
|
||||
@ -24,12 +24,12 @@ export class UnconfirmedContribution {
|
||||
firstName: string
|
||||
|
||||
@Field(() => Int)
|
||||
id?: number
|
||||
id: number
|
||||
|
||||
@Field(() => String)
|
||||
lastName: string
|
||||
|
||||
@Field(() => Number)
|
||||
@Field(() => ID)
|
||||
userId: number
|
||||
|
||||
@Field(() => String)
|
||||
@ -44,7 +44,7 @@ export class UnconfirmedContribution {
|
||||
@Field(() => Decimal)
|
||||
amount: Decimal
|
||||
|
||||
@Field(() => Number, { nullable: true })
|
||||
@Field(() => ID, { nullable: true })
|
||||
moderator: number | null
|
||||
|
||||
@Field(() => [Decimal])
|
||||
@ -53,6 +53,6 @@ export class UnconfirmedContribution {
|
||||
@Field(() => String)
|
||||
state: string
|
||||
|
||||
@Field(() => Number)
|
||||
@Field(() => Int)
|
||||
messageCount: number
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ObjectType, Field } from 'type-graphql'
|
||||
import { ObjectType, Field, ID, Int } from 'type-graphql'
|
||||
import { KlickTipp } from './KlickTipp'
|
||||
import { User as dbUser } from '@entity/User'
|
||||
import { UserContact } from './UserContact'
|
||||
@ -28,21 +28,21 @@ export class User {
|
||||
this.hideAmountGDT = user.hideAmountGDT
|
||||
}
|
||||
|
||||
@Field(() => Number)
|
||||
@Field(() => ID)
|
||||
id: number
|
||||
|
||||
@Field(() => String)
|
||||
gradidoID: string
|
||||
|
||||
@Field(() => String, { nullable: true })
|
||||
alias?: string
|
||||
alias: string | null
|
||||
|
||||
@Field(() => Number, { nullable: true })
|
||||
@Field(() => ID, { nullable: true })
|
||||
emailId: number | null
|
||||
|
||||
// TODO privacy issue here
|
||||
@Field(() => String, { nullable: true })
|
||||
email: string
|
||||
email: string | null
|
||||
|
||||
@Field(() => UserContact)
|
||||
emailContact: UserContact
|
||||
@ -72,7 +72,7 @@ export class User {
|
||||
hideAmountGDT: boolean
|
||||
|
||||
// This is not the users publisherId, but the one of the users who recommend him
|
||||
@Field(() => Number, { nullable: true })
|
||||
@Field(() => Int, { nullable: true })
|
||||
publisherId: number | null
|
||||
|
||||
@Field(() => Date, { nullable: true })
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ObjectType, Field, Int } from 'type-graphql'
|
||||
import { ObjectType, Field, Int, ID } from 'type-graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { User } from '@entity/User'
|
||||
|
||||
@ -17,7 +17,7 @@ export class UserAdmin {
|
||||
this.isAdmin = user.isAdmin
|
||||
}
|
||||
|
||||
@Field(() => Number)
|
||||
@Field(() => ID)
|
||||
userId: number
|
||||
|
||||
@Field(() => String)
|
||||
@ -39,10 +39,10 @@ export class UserAdmin {
|
||||
hasElopage: boolean
|
||||
|
||||
@Field(() => Date, { nullable: true })
|
||||
deletedAt?: Date | null
|
||||
deletedAt: Date | null
|
||||
|
||||
@Field(() => String, { nullable: true })
|
||||
emailConfirmationSend?: string
|
||||
emailConfirmationSend: string | null
|
||||
|
||||
@Field(() => Date, { nullable: true })
|
||||
isAdmin: Date | null
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ObjectType, Field } from 'type-graphql'
|
||||
import { ObjectType, Field, ID, Int } from 'type-graphql'
|
||||
import { UserContact as dbUserContact } from '@entity/UserContact'
|
||||
|
||||
@ObjectType()
|
||||
@ -18,13 +18,13 @@ export class UserContact {
|
||||
this.deletedAt = userContact.deletedAt
|
||||
}
|
||||
|
||||
@Field(() => Number)
|
||||
@Field(() => ID)
|
||||
id: number
|
||||
|
||||
@Field(() => String)
|
||||
type: string
|
||||
|
||||
@Field(() => Number)
|
||||
@Field(() => ID)
|
||||
userId: number
|
||||
|
||||
@Field(() => String)
|
||||
@ -33,10 +33,10 @@ export class UserContact {
|
||||
// @Field(() => BigInt, { nullable: true })
|
||||
// emailVerificationCode: BigInt | null
|
||||
|
||||
@Field(() => Number, { nullable: true })
|
||||
@Field(() => Int, { nullable: true })
|
||||
emailOptInTypeId: number | null
|
||||
|
||||
@Field(() => Number, { nullable: true })
|
||||
@Field(() => Int, { nullable: true })
|
||||
emailResendCount: number | null
|
||||
|
||||
@Field(() => Boolean)
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Resolver, Query, Ctx, Authorized } from 'type-graphql'
|
||||
import { getCustomRepository } from '@dbTools/typeorm'
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ import CONFIG from '@/config'
|
||||
export class CommunityResolver {
|
||||
@Authorized([RIGHTS.GET_COMMUNITY_INFO])
|
||||
@Query(() => Community)
|
||||
async getCommunityInfo(): Promise<Community> {
|
||||
getCommunityInfo(): Community {
|
||||
return new Community({
|
||||
name: CONFIG.COMMUNITY_NAME,
|
||||
description: CONFIG.COMMUNITY_DESCRIPTION,
|
||||
@ -20,7 +20,7 @@ export class CommunityResolver {
|
||||
|
||||
@Authorized([RIGHTS.COMMUNITIES])
|
||||
@Query(() => [Community])
|
||||
async communities(): Promise<Community[]> {
|
||||
communities(): Community[] {
|
||||
if (CONFIG.PRODUCTION)
|
||||
return [
|
||||
new Community({
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
import Decimal from 'decimal.js-light'
|
||||
|
||||
@ -35,7 +35,7 @@ export class ContributionLinkResolver {
|
||||
cycle,
|
||||
validFrom,
|
||||
validTo,
|
||||
maxAmountPerMonth,
|
||||
maxAmountPerMonth = null,
|
||||
maxPerCycle,
|
||||
}: ContributionLinkArgs,
|
||||
): Promise<ContributionLink> {
|
||||
@ -114,7 +114,7 @@ export class ContributionLinkResolver {
|
||||
cycle,
|
||||
validFrom,
|
||||
validTo,
|
||||
maxAmountPerMonth,
|
||||
maxAmountPerMonth = null,
|
||||
maxPerCycle,
|
||||
}: ContributionLinkArgs,
|
||||
@Arg('id', () => Int) id: number,
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
@ -181,7 +186,7 @@ describe('ContributionMessageResolver', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('calls sendAddedContributionMessageEmail', async () => {
|
||||
it('calls sendAddedContributionMessageEmail', () => {
|
||||
expect(sendAddedContributionMessageEmail).toBeCalledWith({
|
||||
firstName: 'Bibi',
|
||||
lastName: 'Bloxberg',
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { Arg, Args, Authorized, Ctx, Mutation, Query, Resolver } from 'type-graphql'
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import { Arg, Args, Authorized, Ctx, ID, Mutation, Query, Resolver } from 'type-graphql'
|
||||
import { getConnection } from '@dbTools/typeorm'
|
||||
|
||||
import { ContributionMessage as DbContributionMessage } from '@entity/ContributionMessage'
|
||||
@ -68,7 +69,7 @@ export class ContributionMessageResolver {
|
||||
@Authorized([RIGHTS.LIST_ALL_CONTRIBUTION_MESSAGES])
|
||||
@Query(() => ContributionMessageListResult)
|
||||
async listContributionMessages(
|
||||
@Arg('contributionId') contributionId: number,
|
||||
@Arg('contributionId', () => ID) contributionId: number,
|
||||
@Args()
|
||||
{ currentPage = 1, pageSize = 5, order = Order.DESC }: Paginated,
|
||||
): Promise<ContributionMessageListResult> {
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
@ -176,7 +181,7 @@ describe('ContributionResolver', () => {
|
||||
})
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
afterAll(() => {
|
||||
resetToken()
|
||||
})
|
||||
|
||||
@ -265,7 +270,7 @@ describe('ContributionResolver', () => {
|
||||
})
|
||||
|
||||
describe('valid input', () => {
|
||||
it('creates contribution', async () => {
|
||||
it('creates contribution', () => {
|
||||
expect(pendingContribution.data.createContribution).toMatchObject({
|
||||
id: expect.any(Number),
|
||||
amount: '100',
|
||||
@ -311,7 +316,7 @@ describe('ContributionResolver', () => {
|
||||
})
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
afterAll(() => {
|
||||
resetToken()
|
||||
})
|
||||
|
||||
@ -452,7 +457,7 @@ describe('ContributionResolver', () => {
|
||||
id: pendingContribution.data.createContribution.id,
|
||||
})
|
||||
contribution.contributionStatus = ContributionStatus.DELETED
|
||||
contribution.save()
|
||||
await contribution.save()
|
||||
await mutate({
|
||||
mutation: login,
|
||||
variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' },
|
||||
@ -464,7 +469,7 @@ describe('ContributionResolver', () => {
|
||||
id: pendingContribution.data.createContribution.id,
|
||||
})
|
||||
contribution.contributionStatus = ContributionStatus.PENDING
|
||||
contribution.save()
|
||||
await contribution.save()
|
||||
})
|
||||
|
||||
it('throws an error', async () => {
|
||||
@ -636,7 +641,7 @@ describe('ContributionResolver', () => {
|
||||
})
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
afterAll(() => {
|
||||
resetToken()
|
||||
})
|
||||
|
||||
@ -856,7 +861,7 @@ describe('ContributionResolver', () => {
|
||||
})
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
afterAll(() => {
|
||||
resetToken()
|
||||
})
|
||||
|
||||
@ -1009,7 +1014,7 @@ describe('ContributionResolver', () => {
|
||||
})
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
afterAll(() => {
|
||||
resetToken()
|
||||
})
|
||||
|
||||
@ -1140,7 +1145,7 @@ describe('ContributionResolver', () => {
|
||||
})
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
afterAll(() => {
|
||||
resetToken()
|
||||
})
|
||||
|
||||
@ -1720,7 +1725,7 @@ describe('ContributionResolver', () => {
|
||||
})
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
afterAll(() => {
|
||||
resetToken()
|
||||
})
|
||||
|
||||
@ -1798,7 +1803,7 @@ describe('ContributionResolver', () => {
|
||||
})
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
afterAll(() => {
|
||||
resetToken()
|
||||
})
|
||||
|
||||
@ -1913,7 +1918,7 @@ describe('ContributionResolver', () => {
|
||||
})
|
||||
|
||||
describe('valid user to create for', () => {
|
||||
beforeAll(async () => {
|
||||
beforeAll(() => {
|
||||
variables.email = 'bibi@bloxberg.de'
|
||||
variables.creationDate = 'invalid-date'
|
||||
})
|
||||
@ -2551,7 +2556,7 @@ describe('ContributionResolver', () => {
|
||||
expect(transaction[0].typeId).toEqual(1)
|
||||
})
|
||||
|
||||
it('calls sendContributionConfirmedEmail', async () => {
|
||||
it('calls sendContributionConfirmedEmail', () => {
|
||||
expect(sendContributionConfirmedEmail).toBeCalledWith({
|
||||
firstName: 'Bibi',
|
||||
lastName: 'Bloxberg',
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Arg, Args, Authorized, Ctx, Int, Mutation, Query, Resolver } from 'type-graphql'
|
||||
import { IsNull, getConnection } from '@dbTools/typeorm'
|
||||
@ -156,7 +157,7 @@ export class ContributionResolver {
|
||||
@Args()
|
||||
{ currentPage = 1, pageSize = 5, order = Order.DESC }: Paginated,
|
||||
@Arg('statusFilter', () => [ContributionStatus], { nullable: true })
|
||||
statusFilter?: ContributionStatus[],
|
||||
statusFilter?: ContributionStatus[] | null,
|
||||
): Promise<ContributionListResult> {
|
||||
const [dbContributions, count] = await findContributions(
|
||||
order,
|
||||
@ -239,14 +240,14 @@ export class ContributionResolver {
|
||||
contributionMessage.isModerator = false
|
||||
contributionMessage.userId = user.id
|
||||
contributionMessage.type = ContributionMessageType.HISTORY
|
||||
ContributionMessage.save(contributionMessage)
|
||||
await ContributionMessage.save(contributionMessage)
|
||||
|
||||
contributionToUpdate.amount = amount
|
||||
contributionToUpdate.memo = memo
|
||||
contributionToUpdate.contributionDate = new Date(creationDate)
|
||||
contributionToUpdate.contributionStatus = ContributionStatus.PENDING
|
||||
contributionToUpdate.updatedAt = new Date()
|
||||
DbContribution.save(contributionToUpdate)
|
||||
await DbContribution.save(contributionToUpdate)
|
||||
|
||||
await EVENT_CONTRIBUTION_UPDATE(user.id, contributionId, amount)
|
||||
|
||||
@ -254,7 +255,7 @@ export class ContributionResolver {
|
||||
}
|
||||
|
||||
@Authorized([RIGHTS.ADMIN_CREATE_CONTRIBUTION])
|
||||
@Mutation(() => [Number])
|
||||
@Mutation(() => [Decimal])
|
||||
async adminCreateContribution(
|
||||
@Args() { email, amount, memo, creationDate }: AdminCreateContributionArgs,
|
||||
@Ctx() context: Context,
|
||||
@ -384,7 +385,7 @@ export class ContributionResolver {
|
||||
@Args()
|
||||
{ currentPage = 1, pageSize = 3, order = Order.DESC }: Paginated,
|
||||
@Arg('statusFilter', () => [ContributionStatus], { nullable: true })
|
||||
statusFilter?: ContributionStatus[],
|
||||
statusFilter?: ContributionStatus[] | null,
|
||||
): Promise<ContributionListResult> {
|
||||
const [dbContributions, count] = await findContributions(
|
||||
order,
|
||||
@ -433,7 +434,7 @@ export class ContributionResolver {
|
||||
|
||||
await EVENT_ADMIN_CONTRIBUTION_DELETE(contribution.userId, contribution.id, contribution.amount)
|
||||
|
||||
sendContributionDeletedEmail({
|
||||
void sendContributionDeletedEmail({
|
||||
firstName: user.firstName,
|
||||
lastName: user.lastName,
|
||||
email: user.emailContact.email,
|
||||
@ -527,7 +528,7 @@ export class ContributionResolver {
|
||||
|
||||
await queryRunner.commitTransaction()
|
||||
logger.info('creation commited successfuly.')
|
||||
sendContributionConfirmedEmail({
|
||||
void sendContributionConfirmedEmail({
|
||||
firstName: user.firstName,
|
||||
lastName: user.lastName,
|
||||
email: user.emailContact.email,
|
||||
@ -581,8 +582,8 @@ export class ContributionResolver {
|
||||
@Authorized([RIGHTS.OPEN_CREATIONS])
|
||||
@Query(() => [OpenCreation])
|
||||
async openCreations(
|
||||
@Arg('userId', () => Int, { nullable: true }) userId: number | null,
|
||||
@Ctx() context: Context,
|
||||
@Arg('userId', () => Int, { nullable: true }) userId?: number | null,
|
||||
): Promise<OpenCreation[]> {
|
||||
const id = userId || getUser(context).id
|
||||
const clientTimezoneOffset = getClientTimezoneOffset(context)
|
||||
@ -641,7 +642,7 @@ export class ContributionResolver {
|
||||
contributionToUpdate.amount,
|
||||
)
|
||||
|
||||
sendContributionDeniedEmail({
|
||||
void sendContributionDeniedEmail({
|
||||
firstName: user.firstName,
|
||||
lastName: user.lastName,
|
||||
email: user.emailContact.email,
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
|
||||
@ -1,4 +1,7 @@
|
||||
import { Resolver, Query, Args, Ctx, Authorized, Arg } from 'type-graphql'
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
import { Resolver, Query, Args, Ctx, Authorized, Arg, Int } from 'type-graphql'
|
||||
|
||||
import { GdtEntryList } from '@model/GdtEntryList'
|
||||
import { Order } from '@enum/Order'
|
||||
@ -23,6 +26,7 @@ export class GdtResolver {
|
||||
|
||||
try {
|
||||
const resultGDT = await apiGet(
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
`${CONFIG.GDT_API_URL}/GdtEntries/listPerEmailApi/${userEntity.emailContact.email}/${currentPage}/${pageSize}/${order}`,
|
||||
)
|
||||
if (!resultGDT.success) {
|
||||
@ -35,7 +39,7 @@ export class GdtResolver {
|
||||
}
|
||||
|
||||
@Authorized([RIGHTS.GDT_BALANCE])
|
||||
@Query(() => Number)
|
||||
@Query(() => Int, { nullable: true })
|
||||
async gdtBalance(@Ctx() context: Context): Promise<number | null> {
|
||||
const user = getUser(context)
|
||||
try {
|
||||
@ -54,9 +58,9 @@ export class GdtResolver {
|
||||
}
|
||||
|
||||
@Authorized([RIGHTS.EXIST_PID])
|
||||
@Query(() => Number)
|
||||
@Query(() => Int)
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
async existPid(@Arg('pid') pid: number): Promise<number> {
|
||||
async existPid(@Arg('pid', () => Int) pid: number): Promise<number> {
|
||||
// load user
|
||||
const resultPID = await apiGet(`${CONFIG.GDT_API_URL}/publishers/checkPidApi/${pid}`)
|
||||
if (!resultPID.success) {
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
import { Resolver, Query, Authorized, Arg, Mutation, Args } from 'type-graphql'
|
||||
|
||||
import SubscribeNewsletterArgs from '@arg/SubscribeNewsletterArgs'
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Resolver, Query, Authorized, FieldResolver } from 'type-graphql'
|
||||
import { getConnection } from '@dbTools/typeorm'
|
||||
@ -15,7 +17,7 @@ import { calculateDecay } from '@/util/decay'
|
||||
export class StatisticsResolver {
|
||||
@Authorized([RIGHTS.COMMUNITY_STATISTICS])
|
||||
@Query(() => CommunityStatistics)
|
||||
async communityStatistics(): Promise<CommunityStatistics> {
|
||||
communityStatistics(): CommunityStatistics {
|
||||
return new CommunityStatistics()
|
||||
}
|
||||
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
@ -210,7 +215,7 @@ describe('TransactionLinkResolver', () => {
|
||||
mutate({
|
||||
mutation: redeemTransactionLink,
|
||||
variables: {
|
||||
code: 'CL-' + contributionLink.code,
|
||||
code: `CL-${contributionLink.code}`,
|
||||
},
|
||||
}),
|
||||
).resolves.toMatchObject({
|
||||
@ -249,7 +254,7 @@ describe('TransactionLinkResolver', () => {
|
||||
mutate({
|
||||
mutation: redeemTransactionLink,
|
||||
variables: {
|
||||
code: 'CL-' + contributionLink.code,
|
||||
code: `CL-${contributionLink.code}`,
|
||||
},
|
||||
}),
|
||||
).resolves.toMatchObject({
|
||||
@ -288,7 +293,7 @@ describe('TransactionLinkResolver', () => {
|
||||
mutate({
|
||||
mutation: redeemTransactionLink,
|
||||
variables: {
|
||||
code: 'CL-' + contributionLink.code,
|
||||
code: `CL-${contributionLink.code}`,
|
||||
},
|
||||
}),
|
||||
).resolves.toMatchObject({
|
||||
|
||||
@ -128,7 +128,7 @@ export class TransactionLinkResolver {
|
||||
@Authorized([RIGHTS.QUERY_TRANSACTION_LINK])
|
||||
@Query(() => QueryLinkResult)
|
||||
async queryTransactionLink(@Arg('code') code: string): Promise<typeof QueryLinkResult> {
|
||||
if (code.match(/^CL-/)) {
|
||||
if (/^CL-/.exec(code)) {
|
||||
const contributionLink = await DbContributionLink.findOneOrFail(
|
||||
{ code: code.replace('CL-', '') },
|
||||
{ withDeleted: true },
|
||||
@ -154,7 +154,7 @@ export class TransactionLinkResolver {
|
||||
const clientTimezoneOffset = getClientTimezoneOffset(context)
|
||||
const user = getUser(context)
|
||||
|
||||
if (code.match(/^CL-/)) {
|
||||
if (/^CL-/.exec(code)) {
|
||||
// acquire lock
|
||||
const releaseLock = await TRANSACTIONS_LOCK.acquire()
|
||||
try {
|
||||
@ -341,8 +341,9 @@ export class TransactionLinkResolver {
|
||||
async listTransactionLinksAdmin(
|
||||
@Args()
|
||||
paginated: Paginated,
|
||||
// eslint-disable-next-line type-graphql/wrong-decorator-signature
|
||||
@Arg('filters', () => TransactionLinkFilters, { nullable: true })
|
||||
filters: TransactionLinkFilters | null,
|
||||
filters: TransactionLinkFilters | null, // eslint-disable-line type-graphql/invalid-nullable-input-type
|
||||
@Arg('userId', () => Int)
|
||||
userId: number,
|
||||
): Promise<TransactionLinkResult> {
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
@ -337,7 +341,7 @@ describe('send coins', () => {
|
||||
memo: 'unrepeatable memo',
|
||||
})
|
||||
|
||||
expect(EventProtocol.find()).resolves.toContainEqual(
|
||||
await expect(EventProtocol.find()).resolves.toContainEqual(
|
||||
expect.objectContaining({
|
||||
type: EventProtocolType.TRANSACTION_SEND,
|
||||
userId: user[1].id,
|
||||
@ -354,7 +358,7 @@ describe('send coins', () => {
|
||||
memo: 'unrepeatable memo',
|
||||
})
|
||||
|
||||
expect(EventProtocol.find()).resolves.toContainEqual(
|
||||
await expect(EventProtocol.find()).resolves.toContainEqual(
|
||||
expect.objectContaining({
|
||||
type: EventProtocolType.TRANSACTION_RECEIVE,
|
||||
userId: user[0].id,
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable new-cap */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
@ -304,7 +305,7 @@ export class TransactionResolver {
|
||||
}
|
||||
|
||||
@Authorized([RIGHTS.SEND_COINS])
|
||||
@Mutation(() => String)
|
||||
@Mutation(() => Boolean)
|
||||
async sendCoins(
|
||||
@Args() { email, amount, memo }: TransactionSendArgs,
|
||||
@Ctx() context: Context,
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
@ -182,7 +187,7 @@ describe('UserResolver', () => {
|
||||
{ email: 'peter@lustig.de' },
|
||||
{ relations: ['user'] },
|
||||
)
|
||||
expect(EventProtocol.find()).resolves.toContainEqual(
|
||||
await expect(EventProtocol.find()).resolves.toContainEqual(
|
||||
expect.objectContaining({
|
||||
type: EventProtocolType.REGISTER,
|
||||
userId: userConatct.user.id,
|
||||
@ -210,8 +215,8 @@ describe('UserResolver', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('stores the SEND_CONFIRMATION_EMAIL event in the database', () => {
|
||||
expect(EventProtocol.find()).resolves.toContainEqual(
|
||||
it('stores the SEND_CONFIRMATION_EMAIL event in the database', async () => {
|
||||
await expect(EventProtocol.find()).resolves.toContainEqual(
|
||||
expect.objectContaining({
|
||||
type: EventProtocolType.SEND_CONFIRMATION_EMAIL,
|
||||
userId: user[0].id,
|
||||
@ -226,7 +231,7 @@ describe('UserResolver', () => {
|
||||
mutation = await mutate({ mutation: createUser, variables })
|
||||
})
|
||||
|
||||
it('logs an info', async () => {
|
||||
it('logs an info', () => {
|
||||
expect(logger.info).toBeCalledWith('User already exists with this email=peter@lustig.de')
|
||||
})
|
||||
|
||||
@ -239,7 +244,7 @@ describe('UserResolver', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('results with partly faked user with random "id"', async () => {
|
||||
it('results with partly faked user with random "id"', () => {
|
||||
expect(mutation).toEqual(
|
||||
expect.objectContaining({
|
||||
data: {
|
||||
@ -256,7 +261,7 @@ describe('UserResolver', () => {
|
||||
{ email: 'peter@lustig.de' },
|
||||
{ relations: ['user'] },
|
||||
)
|
||||
expect(EventProtocol.find()).resolves.toContainEqual(
|
||||
await expect(EventProtocol.find()).resolves.toContainEqual(
|
||||
expect.objectContaining({
|
||||
type: EventProtocolType.SEND_ACCOUNT_MULTIREGISTRATION_EMAIL,
|
||||
userId: userConatct.user.id,
|
||||
@ -355,8 +360,8 @@ describe('UserResolver', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('stores the ACTIVATE_ACCOUNT event in the database', () => {
|
||||
expect(EventProtocol.find()).resolves.toContainEqual(
|
||||
it('stores the ACTIVATE_ACCOUNT event in the database', async () => {
|
||||
await expect(EventProtocol.find()).resolves.toContainEqual(
|
||||
expect.objectContaining({
|
||||
type: EventProtocolType.ACTIVATE_ACCOUNT,
|
||||
userId: user[0].id,
|
||||
@ -364,8 +369,8 @@ describe('UserResolver', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('stores the REDEEM_REGISTER event in the database', () => {
|
||||
expect(EventProtocol.find()).resolves.toContainEqual(
|
||||
it('stores the REDEEM_REGISTER event in the database', async () => {
|
||||
await expect(EventProtocol.find()).resolves.toContainEqual(
|
||||
expect.objectContaining({
|
||||
type: EventProtocolType.REDEEM_REGISTER,
|
||||
userId: result.data.createUser.id,
|
||||
@ -680,7 +685,7 @@ describe('UserResolver', () => {
|
||||
{ email: 'bibi@bloxberg.de' },
|
||||
{ relations: ['user'] },
|
||||
)
|
||||
expect(EventProtocol.find()).resolves.toContainEqual(
|
||||
await expect(EventProtocol.find()).resolves.toContainEqual(
|
||||
expect.objectContaining({
|
||||
type: EventProtocolType.LOGIN,
|
||||
userId: userConatct.user.id,
|
||||
@ -927,8 +932,8 @@ describe('UserResolver', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('stores the LOGIN event in the database', () => {
|
||||
expect(EventProtocol.find()).resolves.toContainEqual(
|
||||
it('stores the LOGIN event in the database', async () => {
|
||||
await expect(EventProtocol.find()).resolves.toContainEqual(
|
||||
expect.objectContaining({
|
||||
type: EventProtocolType.LOGIN,
|
||||
userId: user[0].id,
|
||||
@ -1847,7 +1852,7 @@ describe('UserResolver', () => {
|
||||
{ email: 'bibi@bloxberg.de' },
|
||||
{ relations: ['user'] },
|
||||
)
|
||||
expect(EventProtocol.find()).resolves.toContainEqual(
|
||||
await expect(EventProtocol.find()).resolves.toContainEqual(
|
||||
expect.objectContaining({
|
||||
type: EventProtocolType.ADMIN_SEND_CONFIRMATION_EMAIL,
|
||||
userId: userConatct.user.id,
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import i18n from 'i18n'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import {
|
||||
@ -166,11 +170,11 @@ export class UserResolver {
|
||||
|
||||
// Elopage Status & Stored PublisherId
|
||||
user.hasElopage = await this.hasElopage({ ...context, user: dbUser })
|
||||
logger.info('user.hasElopage=' + user.hasElopage)
|
||||
logger.info('user.hasElopage', user.hasElopage)
|
||||
if (!user.hasElopage && publisherId) {
|
||||
user.publisherId = publisherId
|
||||
dbUser.publisherId = publisherId
|
||||
DbUser.save(dbUser)
|
||||
await DbUser.save(dbUser)
|
||||
}
|
||||
|
||||
context.setHeaders.push({
|
||||
@ -184,8 +188,8 @@ export class UserResolver {
|
||||
}
|
||||
|
||||
@Authorized([RIGHTS.LOGOUT])
|
||||
@Mutation(() => String)
|
||||
async logout(): Promise<boolean> {
|
||||
@Mutation(() => Boolean)
|
||||
logout(): boolean {
|
||||
// TODO: Event still missing here!!
|
||||
// TODO: We dont need this anymore, but might need this in the future in oder to invalidate a valid JWT-Token.
|
||||
// Furthermore this hook can be useful for tracking user behaviour (did he logout or not? Warn him if he didn't on next login)
|
||||
@ -202,7 +206,7 @@ export class UserResolver {
|
||||
@Mutation(() => User)
|
||||
async createUser(
|
||||
@Args()
|
||||
{ email, firstName, lastName, language, publisherId, redeemCode = null }: CreateUserArgs,
|
||||
{ email, firstName, lastName, language, publisherId = null, redeemCode = null }: CreateUserArgs,
|
||||
): Promise<User> {
|
||||
logger.addContext('user', 'unknown')
|
||||
logger.info(
|
||||
@ -239,7 +243,7 @@ export class UserResolver {
|
||||
user.lastName = lastName
|
||||
user.language = language
|
||||
user.publisherId = publisherId
|
||||
logger.debug('partly faked user=' + user)
|
||||
logger.debug('partly faked user', user)
|
||||
|
||||
const emailSent = await sendAccountMultiRegistrationEmail({
|
||||
firstName: foundUser.firstName, // this is the real name of the email owner, but just "firstName" would be the name of the new registrant which shall not be passed to the outside
|
||||
@ -272,22 +276,22 @@ export class UserResolver {
|
||||
dbUser.firstName = firstName
|
||||
dbUser.lastName = lastName
|
||||
dbUser.language = language
|
||||
dbUser.publisherId = publisherId
|
||||
dbUser.publisherId = publisherId || 0
|
||||
dbUser.passwordEncryptionType = PasswordEncryptionType.NO_PASSWORD
|
||||
logger.debug('new dbUser=' + dbUser)
|
||||
logger.debug('new dbUser', dbUser)
|
||||
if (redeemCode) {
|
||||
if (redeemCode.match(/^CL-/)) {
|
||||
if (/^CL-/.exec(redeemCode)) {
|
||||
const contributionLink = await DbContributionLink.findOne({
|
||||
code: redeemCode.replace('CL-', ''),
|
||||
})
|
||||
logger.info('redeemCode found contributionLink=' + contributionLink)
|
||||
logger.info('redeemCode found contributionLink', contributionLink)
|
||||
if (contributionLink) {
|
||||
dbUser.contributionLinkId = contributionLink.id
|
||||
eventRegisterRedeem.contributionId = contributionLink.id
|
||||
}
|
||||
} else {
|
||||
const transactionLink = await DbTransactionLink.findOne({ code: redeemCode })
|
||||
logger.info('redeemCode found transactionLink=' + transactionLink)
|
||||
logger.info('redeemCode found transactionLink', transactionLink)
|
||||
if (transactionLink) {
|
||||
dbUser.referrerId = transactionLink.userId
|
||||
eventRegisterRedeem.transactionId = transactionLink.id
|
||||
@ -654,7 +658,7 @@ export class UserResolver {
|
||||
return 'user.' + fieldName
|
||||
}),
|
||||
searchText,
|
||||
filters,
|
||||
filters || null,
|
||||
currentPage,
|
||||
pageSize,
|
||||
)
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
import Decimal from 'decimal.js-light'
|
||||
@ -79,7 +83,7 @@ describe('semaphore', () => {
|
||||
maxPerCycle: 1,
|
||||
},
|
||||
})
|
||||
contributionLinkCode = 'CL-' + contributionLink.code
|
||||
contributionLinkCode = `CL-${contributionLink.code}`
|
||||
await mutate({
|
||||
mutation: login,
|
||||
variables: { email: 'bob@baumeister.de', password: 'Aa12345_' },
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import LogError from '@/server/LogError'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
import { getConnection } from '@dbTools/typeorm'
|
||||
|
||||
@ -17,7 +17,7 @@ async function main() {
|
||||
console.log(`GraphIQL available at http://localhost:${CONFIG.PORT}`)
|
||||
}
|
||||
})
|
||||
startValidateCommunities(Number(CONFIG.FEDERATION_VALIDATE_COMMUNITY_TIMER))
|
||||
void startValidateCommunities(Number(CONFIG.FEDERATION_VALIDATE_COMMUNITY_TIMER))
|
||||
}
|
||||
|
||||
main().catch((e) => {
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import { MiddlewareFn } from 'type-graphql'
|
||||
import { /* klicktippSignIn, */ getKlickTippUser } from '@/apis/KlicktippController'
|
||||
import { KlickTipp } from '@model/KlickTipp'
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import CONFIG from '@/config'
|
||||
import LogError from '@/server/LogError'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
@ -9,7 +12,7 @@ const sodium = require('sodium-native')
|
||||
|
||||
// We will reuse this for changePassword
|
||||
export const isValidPassword = (password: string): boolean => {
|
||||
return !!password.match(/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[^a-zA-Z0-9 \\t\\n\\r]).{8,}$/)
|
||||
return !!/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[^a-zA-Z0-9 \\t\\n\\r]).{8,}$/.exec(password)
|
||||
}
|
||||
|
||||
export const SecretKeyCryptographyCreateKey = (salt: string, password: string): Buffer[] => {
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
import { ApolloServerTestClient } from 'apollo-server-testing'
|
||||
import { login, createContributionLink } from '@/seeds/graphql/mutations'
|
||||
import { ContributionLink } from '@model/ContributionLink'
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
import { ApolloServerTestClient } from 'apollo-server-testing'
|
||||
import { login, createTransactionLink } from '@/seeds/graphql/mutations'
|
||||
import { TransactionLinkInterface } from '@/seeds/transactionLink/TransactionLinkInterface'
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
import { createUser, setPassword } from '@/seeds/graphql/mutations'
|
||||
import { User } from '@entity/User'
|
||||
import { UserInterface } from '@/seeds/users/UserInterface'
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
@ -94,4 +98,4 @@ const run = async () => {
|
||||
await con.close()
|
||||
}
|
||||
|
||||
run()
|
||||
void run()
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
import { logger } from '@test/testSetup'
|
||||
|
||||
import LogError from './LogError'
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
import 'reflect-metadata'
|
||||
|
||||
import { ApolloServer } from 'apollo-server-express'
|
||||
@ -71,6 +74,7 @@ const createServer = async (
|
||||
app.use(localization.init)
|
||||
|
||||
// Elopage Webhook
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
app.post('/hook/elopage/' + CONFIG.WEBHOOK_ELOPAGE_SECRET, elopageWebhook)
|
||||
|
||||
// Apollo Server
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import log4js from 'log4js'
|
||||
import CONFIG from '@/config'
|
||||
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import { Repository, EntityRepository } from '@dbTools/typeorm'
|
||||
import { TransactionLink as dbTransactionLink } from '@entity/TransactionLink'
|
||||
import Decimal from 'decimal.js-light'
|
||||
|
||||
@ -7,7 +7,7 @@ export class UserRepository extends Repository<DbUser> {
|
||||
async findBySearchCriteriaPagedFiltered(
|
||||
select: string[],
|
||||
searchCriteria: string,
|
||||
filters: SearchUsersFilters,
|
||||
filters: SearchUsersFilters | null,
|
||||
currentPage: number,
|
||||
pageSize: number,
|
||||
): Promise<[DbUser[], number]> {
|
||||
|
||||
@ -10,13 +10,13 @@ describe('utils/decay', () => {
|
||||
// TODO: toString() was required, we could not compare two decimals
|
||||
expect(decayFormula(amount, seconds).toString()).toBe('0.999999978035040489732012')
|
||||
})
|
||||
it('has correct backward calculation', async () => {
|
||||
it('has correct backward calculation', () => {
|
||||
const amount = new Decimal(1.0)
|
||||
const seconds = -1
|
||||
expect(decayFormula(amount, seconds).toString()).toBe('1.000000021964959992727444')
|
||||
})
|
||||
// we get pretty close, but not exact here, skipping
|
||||
it.skip('has correct forward calculation', async () => {
|
||||
it.skip('has correct forward calculation', () => {
|
||||
const amount = new Decimal(1.0).div(
|
||||
new Decimal('0.99999997803504048973201202316767079413460520837376'),
|
||||
)
|
||||
@ -24,7 +24,7 @@ describe('utils/decay', () => {
|
||||
expect(decayFormula(amount, seconds).toString()).toBe('1.0')
|
||||
})
|
||||
})
|
||||
it('has base 0.99999997802044727', async () => {
|
||||
it('has base 0.99999997802044727', () => {
|
||||
const now = new Date()
|
||||
now.setSeconds(1)
|
||||
const oneSecondAgo = new Date(now.getTime())
|
||||
@ -34,7 +34,7 @@ describe('utils/decay', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('returns input amount when from and to is the same', async () => {
|
||||
it('returns input amount when from and to is the same', () => {
|
||||
const now = new Date()
|
||||
expect(calculateDecay(new Decimal(100.0), now, now).balance.toString()).toBe('100')
|
||||
})
|
||||
|
||||
@ -26,4 +26,4 @@ export async function retrieveNotRegisteredEmails(): Promise<string[]> {
|
||||
return notRegisteredUser
|
||||
}
|
||||
|
||||
retrieveNotRegisteredEmails()
|
||||
void retrieveNotRegisteredEmails()
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/*
|
||||
@ -115,7 +119,7 @@ export const elopageWebhook = async (req: any, res: any): Promise<void> => {
|
||||
// Validate inputs
|
||||
if (
|
||||
email === '' ||
|
||||
!email.match(VALIDATE_EMAIL) ||
|
||||
!VALIDATE_EMAIL.exec(email) ||
|
||||
firstName === '' ||
|
||||
firstName.match(VALIDATE_NAME) ||
|
||||
lastName === '' ||
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
|
||||
import Decimal from 'decimal.js-light'
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
import CONFIG from '@/config'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
import { i18n } from '@/server/localization'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user