Merge branch 'master' into fix-admin-menu-english

This commit is contained in:
Ulf Gebhardt 2023-03-14 12:36:51 +01:00 committed by GitHub
commit 236853bc97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
103 changed files with 733 additions and 251 deletions

View File

@ -281,7 +281,7 @@ jobs:
# LINT BACKEND ########################################################### # LINT BACKEND ###########################################################
########################################################################## ##########################################################################
- name: backend | Lint - name: backend | Lint
run: cd backend && yarn && yarn run lint run: cd database && yarn && cd ../backend && yarn && yarn run lint
############################################################################## ##############################################################################
# JOB: LOCALES BACKEND ####################################################### # JOB: LOCALES BACKEND #######################################################
@ -550,7 +550,7 @@ jobs:
run: | run: |
cd e2e-tests/ cd e2e-tests/
yarn yarn
yarn run cypress run --spec cypress/e2e/User.Authentication.feature,cypress/e2e/User.Authentication.ResetPassword.feature,cypress/e2e/User.Registration.feature yarn run cypress run
- name: End-to-end tests | if tests failed, upload screenshots - name: End-to-end tests | if tests failed, upload screenshots
if: ${{ failure() && steps.e2e-tests.conclusion == 'failure' }} if: ${{ failure() && steps.e2e-tests.conclusion == 'failure' }}
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3

View File

@ -4,8 +4,28 @@ All notable changes to this project will be documented in this file. Dates are d
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
#### [1.19.1](https://github.com/gradido/gradido/compare/1.19.0...1.19.1)
- fix(frontend): admin question clickable [`#2810`](https://github.com/gradido/gradido/pull/2810)
- refactor(frontend): change b-img to b-icon send [`#2809`](https://github.com/gradido/gradido/pull/2809)
- fix(admin): update openCreation in case of tab open. [`#2806`](https://github.com/gradido/gradido/pull/2806)
- fix(admin): english language for contributions in admin [`#2804`](https://github.com/gradido/gradido/pull/2804)
- refactor(admin): event buttons for myself turned off in open contributions [`#2760`](https://github.com/gradido/gradido/pull/2760)
- fix(admin): contribution page [`#2794`](https://github.com/gradido/gradido/pull/2794)
- fix(frontend): info.svg [`#2798`](https://github.com/gradido/gradido/pull/2798)
- fix(backend): add relation messages to database query [`#2795`](https://github.com/gradido/gradido/pull/2795)
- fix(admin): header and menu [`#2793`](https://github.com/gradido/gradido/pull/2793)
- fix(frontend): send gdd - change first submit button text to 'Check Now' [`#2774`](https://github.com/gradido/gradido/pull/2774)
- refactor(frontend): creations generated by link NL [`#2771`](https://github.com/gradido/gradido/pull/2771)
- refactor(frontend): creations generated by link (FR) + (NL) [`#2770`](https://github.com/gradido/gradido/pull/2770)
- refactor(frontend): update German locales [`#2765`](https://github.com/gradido/gradido/pull/2765)
- refactor(backend): use find contributions helper for list contributions [`#2762`](https://github.com/gradido/gradido/pull/2762)
#### [1.19.0](https://github.com/gradido/gradido/compare/1.18.2...1.19.0) #### [1.19.0](https://github.com/gradido/gradido/compare/1.18.2...1.19.0)
> 7 March 2023
- chore(release): version 1.19.0 [`#2786`](https://github.com/gradido/gradido/pull/2786)
- fix(frontend): change contribution design [`#2731`](https://github.com/gradido/gradido/pull/2731) - fix(frontend): change contribution design [`#2731`](https://github.com/gradido/gradido/pull/2731)
- refactor(frontend): commnity navbar- & unauthenticated b-gradido styles [`#2732`](https://github.com/gradido/gradido/pull/2732) - refactor(frontend): commnity navbar- & unauthenticated b-gradido styles [`#2732`](https://github.com/gradido/gradido/pull/2732)
- fix(database): change downwards migration to delete entries with last_announced_at IS NULL [`#2767`](https://github.com/gradido/gradido/pull/2767) - fix(database): change downwards migration to delete entries with last_announced_at IS NULL [`#2767`](https://github.com/gradido/gradido/pull/2767)

View File

@ -3,7 +3,7 @@
"description": "Administraion Interface for Gradido", "description": "Administraion Interface for Gradido",
"main": "index.js", "main": "index.js",
"author": "Moriz Wahl", "author": "Moriz Wahl",
"version": "1.19.0", "version": "1.19.1",
"license": "Apache-2.0", "license": "Apache-2.0",
"private": false, "private": false,
"scripts": { "scripts": {

View File

@ -1,7 +1,7 @@
import gql from 'graphql-tag' import gql from 'graphql-tag'
export const adminCreateContributionMessage = gql` export const adminCreateContributionMessage = gql`
mutation ($contributionId: Float!, $message: String!) { mutation ($contributionId: Int!, $message: String!) {
adminCreateContributionMessage(contributionId: $contributionId, message: $message) { adminCreateContributionMessage(contributionId: $contributionId, message: $message) {
id id
message message

View File

@ -1,7 +1,7 @@
import gql from 'graphql-tag' import gql from 'graphql-tag'
export const listContributionMessages = gql` export const listContributionMessages = gql`
query ($contributionId: Float!, $pageSize: Int = 25, $currentPage: Int = 1, $order: Order = ASC) { query ($contributionId: Int!, $pageSize: Int = 25, $currentPage: Int = 1, $order: Order = ASC) {
listContributionMessages( listContributionMessages(
contributionId: $contributionId contributionId: $contributionId
pageSize: $pageSize pageSize: $pageSize

View File

@ -410,6 +410,9 @@ export default {
update({ adminListAllContributions }) { update({ adminListAllContributions }) {
this.rows = adminListAllContributions.contributionCount this.rows = adminListAllContributions.contributionCount
this.items = adminListAllContributions.contributionList this.items = adminListAllContributions.contributionList
if (this.statusFilter === FILTER_TAB_MAP[0]) {
this.$store.commit('setOpenCreations', adminListAllContributions.contributionCount)
}
}, },
error({ message }) { error({ message }) {
this.toastError(message) this.toastError(message)

View File

@ -1,5 +1,5 @@
# Server # Server
JWT_EXPIRES_IN=1m JWT_EXPIRES_IN=2m
# Email # Email
EMAIL=true EMAIL=true

View File

@ -2,16 +2,10 @@ module.exports = {
root: true, root: true,
env: { env: {
node: true, node: true,
// jest: true,
}, },
parser: '@typescript-eslint/parser', parser: '@typescript-eslint/parser',
plugins: ['prettier', '@typescript-eslint' /*, 'jest' */], plugins: ['prettier', '@typescript-eslint', 'type-graphql'],
extends: [ extends: ['standard', 'eslint:recommended', 'plugin:prettier/recommended'],
'standard',
'eslint:recommended',
'plugin:prettier/recommended',
'plugin:@typescript-eslint/recommended',
],
// add your custom rules here // add your custom rules here
rules: { rules: {
'no-console': ['error'], 'no-console': ['error'],
@ -23,4 +17,28 @@ module.exports = {
}, },
], ],
}, },
overrides: [
// only for ts files
{
files: ['*.ts'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:type-graphql/recommended',
],
rules: {
// allow explicitly defined dangling promises
'@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: true }],
'no-void': ['error', { allowAsStatement: true }],
// ignore prefer-regexp-exec rule to allow string.match(regex)
'@typescript-eslint/prefer-regexp-exec': 'off',
},
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
// this is to properly reference the referenced project database without requirement of compiling it
EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true,
},
},
],
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "gradido-backend", "name": "gradido-backend",
"version": "1.19.0", "version": "1.19.1",
"description": "Gradido unified backend providing an API-Service for Gradido Transactions", "description": "Gradido unified backend providing an API-Service for Gradido Transactions",
"main": "src/index.ts", "main": "src/index.ts",
"repository": "https://github.com/gradido/gradido/backend", "repository": "https://github.com/gradido/gradido/backend",
@ -65,6 +65,7 @@
"eslint-plugin-node": "^11.1.0", "eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.4.0", "eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-promise": "^5.1.0", "eslint-plugin-promise": "^5.1.0",
"eslint-plugin-type-graphql": "^1.0.0",
"faker": "^5.5.3", "faker": "^5.5.3",
"jest": "^27.2.4", "jest": "^27.2.4",
"nodemon": "^2.0.7", "nodemon": "^2.0.7",

View File

@ -1,16 +1,19 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import axios from 'axios' import axios from 'axios'
import { backendLogger as logger } from '@/server/logger' import { backendLogger as logger } from '@/server/logger'
import LogError from '@/server/LogError'
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
export const apiPost = async (url: string, payload: unknown): Promise<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 return axios
.post(url, payload) .post(url, payload)
.then((result) => { .then((result) => {
logger.trace('POST-Response: result=' + result) logger.trace('POST-Response', result)
if (result.status !== 200) { 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') { if (result.data.state !== 'success') {
throw new Error(result.data.msg) throw new Error(result.data.msg)
@ -28,9 +31,9 @@ export const apiGet = async (url: string): Promise<any> => {
return axios return axios
.get(url) .get(url)
.then((result) => { .then((result) => {
logger.trace('GET-Response: result=' + result) logger.trace('GET-Response', result)
if (result.status !== 200) { 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)) { if (!['success', 'warning'].includes(result.data.state)) {
throw new Error(result.data.msg) throw new Error(result.data.msg)

View File

@ -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/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import { KlicktippConnector } from './klicktippConnector' import { KlicktippConnector } from './klicktippConnector'

View File

@ -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/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import axios, { AxiosRequestConfig, Method } from 'axios' import axios, { AxiosRequestConfig, Method } from 'axios'

View File

@ -54,4 +54,5 @@ export enum RIGHTS {
UPDATE_CONTRIBUTION_LINK = 'UPDATE_CONTRIBUTION_LINK', UPDATE_CONTRIBUTION_LINK = 'UPDATE_CONTRIBUTION_LINK',
ADMIN_CREATE_CONTRIBUTION_MESSAGE = 'ADMIN_CREATE_CONTRIBUTION_MESSAGE', ADMIN_CREATE_CONTRIBUTION_MESSAGE = 'ADMIN_CREATE_CONTRIBUTION_MESSAGE',
DENY_CONTRIBUTION = 'DENY_CONTRIBUTION', DENY_CONTRIBUTION = 'DENY_CONTRIBUTION',
ADMIN_OPEN_CREATIONS = 'ADMIN_OPEN_CREATIONS',
} }

View File

@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/unbound-method */
import { createTransport } from 'nodemailer' import { createTransport } from 'nodemailer'
import { logger, i18n } from '@test/testSetup' import { logger, i18n } from '@test/testSetup'
import CONFIG from '@/config' import CONFIG from '@/config'

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/restrict-template-expressions */
import CONFIG from '@/config' import CONFIG from '@/config'
import { backendLogger as logger } from '@/server/logger' import { backendLogger as logger } from '@/server/logger'
import path from 'path' import path from 'path'

View File

@ -1,5 +1,8 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-explicit-any */ /* 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 Decimal from 'decimal.js-light'
import { testEnvironment } from '@test/helpers' import { testEnvironment } from '@test/helpers'
import { logger, i18n as localization } from '@test/testSetup' import { logger, i18n as localization } from '@test/testSetup'

View File

@ -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 { gql } from 'graphql-request'
import { backendLogger as logger } from '@/server/logger' import { backendLogger as logger } from '@/server/logger'
import { Community as DbCommunity } from '@entity/Community' import { Community as DbCommunity } from '@entity/Community'

View File

@ -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 { gql } from 'graphql-request'
import { backendLogger as logger } from '@/server/logger' import { backendLogger as logger } from '@/server/logger'
import { Community as DbCommunity } from '@entity/Community' import { Community as DbCommunity } from '@entity/Community'

View File

@ -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/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
@ -150,7 +154,8 @@ describe('validate Communities', () => {
}) })
it('logs unsupported api for community with api 2_0 ', () => { it('logs unsupported api for community with api 2_0 ', () => {
expect(logger.warn).toBeCalledWith( expect(logger.warn).toBeCalledWith(
`Federation: dbCom: ${dbCom.id} with unsupported apiVersion=2_0; supported versions=1_0,1_1`, `Federation: dbCom: ${dbCom.id} with unsupported apiVersion=2_0; supported versions`,
['1_0', '1_1'],
) )
}) })
}) })

View File

@ -8,14 +8,14 @@ import { backendLogger as logger } from '@/server/logger'
import { ApiVersionType } from './enum/apiVersionType' import { ApiVersionType } from './enum/apiVersionType'
import LogError from '@/server/LogError' import LogError from '@/server/LogError'
export async function startValidateCommunities(timerInterval: number): Promise<void> { export function startValidateCommunities(timerInterval: number): void {
logger.info( logger.info(
`Federation: startValidateCommunities loop with an interval of ${timerInterval} ms...`, `Federation: startValidateCommunities loop with an interval of ${timerInterval} ms...`,
) )
// TODO: replace the timer-loop by an event-based communication to verify announced foreign communities // 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 // better to use setTimeout twice than setInterval once -> see https://javascript.info/settimeout-setinterval
setTimeout(function run() { setTimeout(function run() {
validateCommunities() void validateCommunities()
setTimeout(run, timerInterval) setTimeout(run, timerInterval)
}, timerInterval) }, timerInterval)
} }
@ -27,8 +27,8 @@ export async function validateCommunities(): Promise<void> {
.getMany() .getMany()
logger.debug(`Federation: found ${dbCommunities.length} dbCommunities`) logger.debug(`Federation: found ${dbCommunities.length} dbCommunities`)
dbCommunities.forEach(async function (dbCom) { for (const dbCom of dbCommunities) {
logger.debug(`Federation: dbCom: ${JSON.stringify(dbCom)}`) logger.debug('Federation: dbCom', dbCom)
const apiValueStrings: string[] = Object.values(ApiVersionType) const apiValueStrings: string[] = Object.values(ApiVersionType)
logger.debug(`suppported ApiVersions=`, apiValueStrings) logger.debug(`suppported ApiVersions=`, apiValueStrings)
if (apiValueStrings.includes(dbCom.apiVersion)) { if (apiValueStrings.includes(dbCom.apiVersion)) {
@ -38,11 +38,13 @@ export async function validateCommunities(): Promise<void> {
try { try {
const pubKey = await invokeVersionedRequestGetPublicKey(dbCom) const pubKey = await invokeVersionedRequestGetPublicKey(dbCom)
logger.info( 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')) { if (pubKey && pubKey === dbCom.publicKey.toString('hex')) {
logger.info(`Federation: matching publicKey: ${pubKey}`) 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)}`) logger.debug(`Federation: updated dbCom: ${JSON.stringify(dbCom)}`)
} }
/* /*
@ -58,10 +60,11 @@ export async function validateCommunities(): Promise<void> {
} }
} else { } else {
logger.warn( 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) { function isLogError(err: unknown) {

View File

@ -22,7 +22,7 @@ export default class ContributionLinkArgs {
validTo?: string | null validTo?: string | null
@Field(() => Decimal, { nullable: true }) @Field(() => Decimal, { nullable: true })
maxAmountPerMonth: Decimal | null maxAmountPerMonth?: Decimal | null
@Field(() => Int) @Field(() => Int)
maxPerCycle: number maxPerCycle: number

View File

@ -1,9 +1,9 @@
import { ArgsType, Field, InputType } from 'type-graphql' import { ArgsType, Field, Int, InputType } from 'type-graphql'
@InputType() @InputType()
@ArgsType() @ArgsType()
export default class ContributionMessageArgs { export default class ContributionMessageArgs {
@Field(() => Number) @Field(() => Int)
contributionId: number contributionId: number
@Field(() => String) @Field(() => String)

View File

@ -11,11 +11,11 @@ export default class CreateUserArgs {
@Field(() => String) @Field(() => String)
lastName: string lastName: string
@Field(() => String) @Field(() => String, { nullable: true })
language?: string // Will default to DEFAULT_LANGUAGE language?: string | null
@Field(() => Int, { nullable: true }) @Field(() => Int, { nullable: true })
publisherId: number publisherId?: number | null
@Field(() => String, { nullable: true }) @Field(() => String, { nullable: true })
redeemCode?: string | null redeemCode?: string | null

View File

@ -1,3 +1,4 @@
/* eslint-disable type-graphql/invalid-nullable-input-type */
import { ArgsType, Field, Int } from 'type-graphql' import { ArgsType, Field, Int } from 'type-graphql'
import { Order } from '@enum/Order' import { Order } from '@enum/Order'

View File

@ -7,11 +7,14 @@ export default class SearchUsersArgs {
searchText: string searchText: string
@Field(() => Int, { nullable: true }) @Field(() => Int, { nullable: true })
// eslint-disable-next-line type-graphql/invalid-nullable-input-type
currentPage?: number currentPage?: number
@Field(() => Int, { nullable: true }) @Field(() => Int, { nullable: true })
// eslint-disable-next-line type-graphql/invalid-nullable-input-type
pageSize?: number pageSize?: number
// eslint-disable-next-line type-graphql/wrong-decorator-signature
@Field(() => SearchUsersFilters, { nullable: true, defaultValue: null }) @Field(() => SearchUsersFilters, { nullable: true, defaultValue: null })
filters: SearchUsersFilters filters?: SearchUsersFilters | null
} }

View File

@ -3,8 +3,8 @@ import { Field, InputType } from 'type-graphql'
@InputType() @InputType()
export default class SearchUsersFilters { export default class SearchUsersFilters {
@Field(() => Boolean, { nullable: true, defaultValue: null }) @Field(() => Boolean, { nullable: true, defaultValue: null })
byActivated: boolean byActivated?: boolean | null
@Field(() => Boolean, { nullable: true, defaultValue: null }) @Field(() => Boolean, { nullable: true, defaultValue: null })
byDeleted: boolean byDeleted?: boolean | null
} }

View File

@ -1,13 +1,14 @@
/* eslint-disable type-graphql/invalid-nullable-input-type */
import { Field, InputType } from 'type-graphql' import { Field, InputType } from 'type-graphql'
@InputType() @InputType()
export default class TransactionLinkFilters { export default class TransactionLinkFilters {
@Field(() => Boolean, { nullable: true }) @Field(() => Boolean, { nullable: true })
withDeleted: boolean withDeleted?: boolean
@Field(() => Boolean, { nullable: true }) @Field(() => Boolean, { nullable: true })
withExpired: boolean withExpired?: boolean
@Field(() => Boolean, { nullable: true }) @Field(() => Boolean, { nullable: true })
withRedeemed: boolean withRedeemed?: boolean
} }

View File

@ -9,5 +9,5 @@ export default class UnsecureLoginArgs {
password: string password: string
@Field(() => Int, { nullable: true }) @Field(() => Int, { nullable: true })
publisherId: number publisherId?: number | null
} }

View File

@ -1,4 +1,4 @@
import { ArgsType, Field } from 'type-graphql' import { ArgsType, Field, Int } from 'type-graphql'
@ArgsType() @ArgsType()
export default class UpdateUserInfosArgs { export default class UpdateUserInfosArgs {
@ -11,8 +11,8 @@ export default class UpdateUserInfosArgs {
@Field({ nullable: true }) @Field({ nullable: true })
language?: string language?: string
@Field({ nullable: true }) @Field(() => Int, { nullable: true })
publisherId?: number publisherId?: number | null
@Field({ nullable: true }) @Field({ nullable: true })
password?: string password?: string

View File

@ -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 */ /* eslint-disable @typescript-eslint/no-explicit-any */
import { AuthChecker } from 'type-graphql' import { AuthChecker } from 'type-graphql'

View File

@ -1,4 +1,4 @@
import { ObjectType, Field } from 'type-graphql' import { ObjectType, Field, Int, Float } from 'type-graphql'
import Decimal from 'decimal.js-light' import Decimal from 'decimal.js-light'
@ObjectType() @ObjectType()
@ -19,14 +19,14 @@ export class Balance {
@Field(() => Decimal) @Field(() => Decimal)
balance: Decimal balance: Decimal
@Field(() => Number, { nullable: true }) @Field(() => Float, { nullable: true })
balanceGDT: number | null balanceGDT: number | null
// the count of all transactions // the count of all transactions
@Field(() => Number) @Field(() => Int)
count: number count: number
// the count of transaction links // the count of transaction links
@Field(() => Number) @Field(() => Int)
linkCount: number linkCount: number
} }

View File

@ -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/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import { ObjectType, Field } from 'type-graphql' import { ObjectType, Field, Int } from 'type-graphql'
@ObjectType() @ObjectType()
export class Community { export class Community {
@ -14,7 +16,7 @@ export class Community {
} }
} }
@Field(() => Number) @Field(() => Int)
id: number id: number
@Field(() => String) @Field(() => String)

View File

@ -1,9 +1,9 @@
import { ObjectType, Field } from 'type-graphql' import { ObjectType, Field, Int } from 'type-graphql'
import Decimal from 'decimal.js-light' import Decimal from 'decimal.js-light'
@ObjectType() @ObjectType()
export class DynamicStatisticsFields { export class DynamicStatisticsFields {
@Field(() => Number) @Field(() => Int)
activeUsers: number activeUsers: number
@Field(() => Decimal) @Field(() => Decimal)
@ -15,13 +15,13 @@ export class DynamicStatisticsFields {
@ObjectType() @ObjectType()
export class CommunityStatistics { export class CommunityStatistics {
@Field(() => Number) @Field(() => Int)
allUsers: number allUsers: number
@Field(() => Number) @Field(() => Int)
totalUsers: number totalUsers: number
@Field(() => Number) @Field(() => Int)
deletedUsers: number deletedUsers: number
@Field(() => Decimal) @Field(() => Decimal)

View File

@ -23,7 +23,7 @@ export class Contribution {
this.deletedBy = contribution.deletedBy this.deletedBy = contribution.deletedBy
} }
@Field(() => Number) @Field(() => Int)
id: number id: number
@Field(() => String, { nullable: true }) @Field(() => String, { nullable: true })
@ -44,25 +44,25 @@ export class Contribution {
@Field(() => Date, { nullable: true }) @Field(() => Date, { nullable: true })
confirmedAt: Date | null confirmedAt: Date | null
@Field(() => Number, { nullable: true }) @Field(() => Int, { nullable: true })
confirmedBy: number | null confirmedBy: number | null
@Field(() => Date, { nullable: true }) @Field(() => Date, { nullable: true })
deniedAt: Date | null deniedAt: Date | null
@Field(() => Number, { nullable: true }) @Field(() => Int, { nullable: true })
deniedBy: number | null deniedBy: number | null
@Field(() => Date, { nullable: true }) @Field(() => Date, { nullable: true })
deletedAt: Date | null deletedAt: Date | null
@Field(() => Number, { nullable: true }) @Field(() => Int, { nullable: true })
deletedBy: number | null deletedBy: number | null
@Field(() => Date) @Field(() => Date)
contributionDate: Date contributionDate: Date
@Field(() => Number) @Field(() => Int)
messagesCount: number messagesCount: number
@Field(() => String) @Field(() => String)

View File

@ -21,7 +21,7 @@ export class ContributionLink {
this.link = CONFIG.COMMUNITY_REDEEM_CONTRIBUTION_URL.replace(/{code}/g, this.code) this.link = CONFIG.COMMUNITY_REDEEM_CONTRIBUTION_URL.replace(/{code}/g, this.code)
} }
@Field(() => Number) @Field(() => Int)
id: number id: number
@Field(() => Decimal) @Field(() => Decimal)

View File

@ -1,4 +1,4 @@
import { ObjectType, Field } from 'type-graphql' import { ObjectType, Field, Int } from 'type-graphql'
import { ContributionLink } from '@model/ContributionLink' import { ContributionLink } from '@model/ContributionLink'
@ObjectType() @ObjectType()
@ -6,6 +6,6 @@ export class ContributionLinkList {
@Field(() => [ContributionLink]) @Field(() => [ContributionLink])
links: ContributionLink[] links: ContributionLink[]
@Field(() => Number) @Field(() => Int)
count: number count: number
} }

View File

@ -1,4 +1,4 @@
import { Field, ObjectType } from 'type-graphql' import { Field, Int, ObjectType } from 'type-graphql'
import { ContributionMessage as DbContributionMessage } from '@entity/ContributionMessage' import { ContributionMessage as DbContributionMessage } from '@entity/ContributionMessage'
import { User } from '@entity/User' import { User } from '@entity/User'
@ -16,7 +16,7 @@ export class ContributionMessage {
this.isModerator = contributionMessage.isModerator this.isModerator = contributionMessage.isModerator
} }
@Field(() => Number) @Field(() => Int)
id: number id: number
@Field(() => String) @Field(() => String)
@ -26,7 +26,7 @@ export class ContributionMessage {
createdAt: Date createdAt: Date
@Field(() => Date, { nullable: true }) @Field(() => Date, { nullable: true })
updatedAt?: Date | null updatedAt: Date | null
@Field(() => String) @Field(() => String)
type: string type: string
@ -37,7 +37,7 @@ export class ContributionMessage {
@Field(() => String, { nullable: true }) @Field(() => String, { nullable: true })
userLastName: string | null userLastName: string | null
@Field(() => Number, { nullable: true }) @Field(() => Int, { nullable: true })
userId: number | null userId: number | null
@Field(() => Boolean) @Field(() => Boolean)
@ -45,7 +45,7 @@ export class ContributionMessage {
} }
@ObjectType() @ObjectType()
export class ContributionMessageListResult { export class ContributionMessageListResult {
@Field(() => Number) @Field(() => Int)
count: number count: number
@Field(() => [ContributionMessage]) @Field(() => [ContributionMessage])

View File

@ -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/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import { ObjectType, Field } from 'type-graphql' import { ObjectType, Field, Float, Int } from 'type-graphql'
import { GdtEntryType } from '@enum/GdtEntryType' import { GdtEntryType } from '@enum/GdtEntryType'
@ObjectType() @ObjectType()
@ -19,10 +21,10 @@ export class GdtEntry {
this.gdt = json.gdt this.gdt = json.gdt
} }
@Field(() => Number) @Field(() => Int)
id: number id: number
@Field(() => Number) @Field(() => Float)
amount: number amount: number
@Field(() => String) @Field(() => String)
@ -40,15 +42,15 @@ export class GdtEntry {
@Field(() => GdtEntryType) @Field(() => GdtEntryType)
gdtEntryType: GdtEntryType gdtEntryType: GdtEntryType
@Field(() => Number) @Field(() => Float)
factor: number factor: number
@Field(() => Number) @Field(() => Float)
amount2: number amount2: number
@Field(() => Number) @Field(() => Float)
factor2: number factor2: number
@Field(() => Number) @Field(() => Float)
gdt: number gdt: number
} }

View File

@ -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/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import { GdtEntry } from './GdtEntry' import { GdtEntry } from './GdtEntry'
import { ObjectType, Field } from 'type-graphql' import { ObjectType, Field, Int, Float } from 'type-graphql'
@ObjectType() @ObjectType()
export class GdtEntryList { export class GdtEntryList {
@ -16,15 +19,15 @@ export class GdtEntryList {
@Field(() => String) @Field(() => String)
state: string state: string
@Field(() => Number) @Field(() => Int)
count: number count: number
@Field(() => [GdtEntry], { nullable: true }) @Field(() => [GdtEntry], { nullable: true })
gdtEntries?: GdtEntry[] gdtEntries: GdtEntry[] | null
@Field(() => Number) @Field(() => Float)
gdtSum: number gdtSum: number
@Field(() => Number) @Field(() => Float)
timeUsed: number timeUsed: number
} }

View File

@ -1,4 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import { ObjectType, Field } from 'type-graphql' import { ObjectType, Field } from 'type-graphql'

View File

@ -1,4 +1,4 @@
import { ObjectType, Field } from 'type-graphql' import { ObjectType, Field, Int } from 'type-graphql'
import { Decay } from './Decay' import { Decay } from './Decay'
import { Transaction as dbTransaction } from '@entity/Transaction' import { Transaction as dbTransaction } from '@entity/Transaction'
import Decimal from 'decimal.js-light' import Decimal from 'decimal.js-light'
@ -41,19 +41,19 @@ export class Transaction {
this.memo = transaction.memo this.memo = transaction.memo
this.creationDate = transaction.creationDate this.creationDate = transaction.creationDate
this.linkedUser = linkedUser this.linkedUser = linkedUser
this.linkedTransactionId = transaction.linkedTransactionId this.linkedTransactionId = transaction.linkedTransactionId || null
this.linkId = transaction.contribution this.linkId = transaction.contribution
? transaction.contribution.contributionLinkId ? transaction.contribution.contributionLinkId
: transaction.transactionLinkId : transaction.transactionLinkId || null
} }
@Field(() => Number) @Field(() => Int)
id: number id: number
@Field(() => User) @Field(() => User)
user: User user: User
@Field(() => Number, { nullable: true }) @Field(() => Int, { nullable: true })
previous: number | null previous: number | null
@Field(() => TransactionTypeId) @Field(() => TransactionTypeId)
@ -80,10 +80,10 @@ export class Transaction {
@Field(() => User, { nullable: true }) @Field(() => User, { nullable: true })
linkedUser: User | null linkedUser: User | null
@Field(() => Number, { nullable: true }) @Field(() => Int, { nullable: true })
linkedTransactionId?: number | null linkedTransactionId: number | null
// Links to the TransactionLink/ContributionLink when transaction was created by a link // Links to the TransactionLink/ContributionLink when transaction was created by a link
@Field(() => Number, { nullable: true }) @Field(() => Int, { nullable: true })
linkId?: number | null linkId: number | null
} }

View File

@ -21,7 +21,7 @@ export class TransactionLink {
this.link = CONFIG.COMMUNITY_REDEEM_URL.replace(/{code}/g, this.code) this.link = CONFIG.COMMUNITY_REDEEM_URL.replace(/{code}/g, this.code)
} }
@Field(() => Number) @Field(() => Int)
id: number id: number
@Field(() => User) @Field(() => User)

View File

@ -24,12 +24,12 @@ export class UnconfirmedContribution {
firstName: string firstName: string
@Field(() => Int) @Field(() => Int)
id?: number id: number
@Field(() => String) @Field(() => String)
lastName: string lastName: string
@Field(() => Number) @Field(() => Int)
userId: number userId: number
@Field(() => String) @Field(() => String)
@ -44,7 +44,7 @@ export class UnconfirmedContribution {
@Field(() => Decimal) @Field(() => Decimal)
amount: Decimal amount: Decimal
@Field(() => Number, { nullable: true }) @Field(() => Int, { nullable: true })
moderator: number | null moderator: number | null
@Field(() => [Decimal]) @Field(() => [Decimal])
@ -53,6 +53,6 @@ export class UnconfirmedContribution {
@Field(() => String) @Field(() => String)
state: string state: string
@Field(() => Number) @Field(() => Int)
messageCount: number messageCount: number
} }

View File

@ -1,4 +1,4 @@
import { ObjectType, Field } from 'type-graphql' import { ObjectType, Field, Int } from 'type-graphql'
import { KlickTipp } from './KlickTipp' import { KlickTipp } from './KlickTipp'
import { User as dbUser } from '@entity/User' import { User as dbUser } from '@entity/User'
import { UserContact } from './UserContact' import { UserContact } from './UserContact'
@ -28,21 +28,21 @@ export class User {
this.hideAmountGDT = user.hideAmountGDT this.hideAmountGDT = user.hideAmountGDT
} }
@Field(() => Number) @Field(() => Int)
id: number id: number
@Field(() => String) @Field(() => String)
gradidoID: string gradidoID: string
@Field(() => String, { nullable: true }) @Field(() => String, { nullable: true })
alias?: string alias: string | null
@Field(() => Number, { nullable: true }) @Field(() => Int, { nullable: true })
emailId: number | null emailId: number | null
// TODO privacy issue here // TODO privacy issue here
@Field(() => String, { nullable: true }) @Field(() => String, { nullable: true })
email: string email: string | null
@Field(() => UserContact) @Field(() => UserContact)
emailContact: UserContact emailContact: UserContact
@ -72,7 +72,7 @@ export class User {
hideAmountGDT: boolean hideAmountGDT: boolean
// This is not the users publisherId, but the one of the users who recommend him // 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 publisherId: number | null
@Field(() => Date, { nullable: true }) @Field(() => Date, { nullable: true })

View File

@ -17,7 +17,7 @@ export class UserAdmin {
this.isAdmin = user.isAdmin this.isAdmin = user.isAdmin
} }
@Field(() => Number) @Field(() => Int)
userId: number userId: number
@Field(() => String) @Field(() => String)
@ -39,10 +39,10 @@ export class UserAdmin {
hasElopage: boolean hasElopage: boolean
@Field(() => Date, { nullable: true }) @Field(() => Date, { nullable: true })
deletedAt?: Date | null deletedAt: Date | null
@Field(() => String, { nullable: true }) @Field(() => String, { nullable: true })
emailConfirmationSend?: string emailConfirmationSend: string | null
@Field(() => Date, { nullable: true }) @Field(() => Date, { nullable: true })
isAdmin: Date | null isAdmin: Date | null

View File

@ -1,4 +1,4 @@
import { ObjectType, Field } from 'type-graphql' import { ObjectType, Field, Int } from 'type-graphql'
import { UserContact as dbUserContact } from '@entity/UserContact' import { UserContact as dbUserContact } from '@entity/UserContact'
@ObjectType() @ObjectType()
@ -18,13 +18,13 @@ export class UserContact {
this.deletedAt = userContact.deletedAt this.deletedAt = userContact.deletedAt
} }
@Field(() => Number) @Field(() => Int)
id: number id: number
@Field(() => String) @Field(() => String)
type: string type: string
@Field(() => Number) @Field(() => Int)
userId: number userId: number
@Field(() => String) @Field(() => String)
@ -33,10 +33,10 @@ export class UserContact {
// @Field(() => BigInt, { nullable: true }) // @Field(() => BigInt, { nullable: true })
// emailVerificationCode: BigInt | null // emailVerificationCode: BigInt | null
@Field(() => Number, { nullable: true }) @Field(() => Int, { nullable: true })
emailOptInTypeId: number | null emailOptInTypeId: number | null
@Field(() => Number, { nullable: true }) @Field(() => Int, { nullable: true })
emailResendCount: number | null emailResendCount: number | null
@Field(() => Boolean) @Field(() => Boolean)

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/restrict-template-expressions */
import Decimal from 'decimal.js-light' import Decimal from 'decimal.js-light'
import { Resolver, Query, Ctx, Authorized } from 'type-graphql' import { Resolver, Query, Ctx, Authorized } from 'type-graphql'
import { getCustomRepository } from '@dbTools/typeorm' import { getCustomRepository } from '@dbTools/typeorm'

View File

@ -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/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */

View File

@ -9,7 +9,7 @@ import CONFIG from '@/config'
export class CommunityResolver { export class CommunityResolver {
@Authorized([RIGHTS.GET_COMMUNITY_INFO]) @Authorized([RIGHTS.GET_COMMUNITY_INFO])
@Query(() => Community) @Query(() => Community)
async getCommunityInfo(): Promise<Community> { getCommunityInfo(): Community {
return new Community({ return new Community({
name: CONFIG.COMMUNITY_NAME, name: CONFIG.COMMUNITY_NAME,
description: CONFIG.COMMUNITY_DESCRIPTION, description: CONFIG.COMMUNITY_DESCRIPTION,
@ -20,7 +20,7 @@ export class CommunityResolver {
@Authorized([RIGHTS.COMMUNITIES]) @Authorized([RIGHTS.COMMUNITIES])
@Query(() => [Community]) @Query(() => [Community])
async communities(): Promise<Community[]> { communities(): Community[] {
if (CONFIG.PRODUCTION) if (CONFIG.PRODUCTION)
return [ return [
new Community({ new Community({

View File

@ -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 */ /* eslint-disable @typescript-eslint/no-explicit-any */
import Decimal from 'decimal.js-light' import Decimal from 'decimal.js-light'

View File

@ -35,7 +35,7 @@ export class ContributionLinkResolver {
cycle, cycle,
validFrom, validFrom,
validTo, validTo,
maxAmountPerMonth, maxAmountPerMonth = null,
maxPerCycle, maxPerCycle,
}: ContributionLinkArgs, }: ContributionLinkArgs,
): Promise<ContributionLink> { ): Promise<ContributionLink> {
@ -114,7 +114,7 @@ export class ContributionLinkResolver {
cycle, cycle,
validFrom, validFrom,
validTo, validTo,
maxAmountPerMonth, maxAmountPerMonth = null,
maxPerCycle, maxPerCycle,
}: ContributionLinkArgs, }: ContributionLinkArgs,
@Arg('id', () => Int) id: number, @Arg('id', () => Int) id: number,

View File

@ -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/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
@ -181,7 +186,7 @@ describe('ContributionMessageResolver', () => {
) )
}) })
it('calls sendAddedContributionMessageEmail', async () => { it('calls sendAddedContributionMessageEmail', () => {
expect(sendAddedContributionMessageEmail).toBeCalledWith({ expect(sendAddedContributionMessageEmail).toBeCalledWith({
firstName: 'Bibi', firstName: 'Bibi',
lastName: 'Bloxberg', lastName: 'Bloxberg',

View File

@ -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, Int, Mutation, Query, Resolver } from 'type-graphql'
import { getConnection } from '@dbTools/typeorm' import { getConnection } from '@dbTools/typeorm'
import { ContributionMessage as DbContributionMessage } from '@entity/ContributionMessage' import { ContributionMessage as DbContributionMessage } from '@entity/ContributionMessage'
@ -68,7 +69,7 @@ export class ContributionMessageResolver {
@Authorized([RIGHTS.LIST_ALL_CONTRIBUTION_MESSAGES]) @Authorized([RIGHTS.LIST_ALL_CONTRIBUTION_MESSAGES])
@Query(() => ContributionMessageListResult) @Query(() => ContributionMessageListResult)
async listContributionMessages( async listContributionMessages(
@Arg('contributionId') contributionId: number, @Arg('contributionId', () => Int) contributionId: number,
@Args() @Args()
{ currentPage = 1, pageSize = 5, order = Order.DESC }: Paginated, { currentPage = 1, pageSize = 5, order = Order.DESC }: Paginated,
): Promise<ContributionMessageListResult> { ): Promise<ContributionMessageListResult> {

View File

@ -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/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
@ -176,7 +181,7 @@ describe('ContributionResolver', () => {
}) })
}) })
afterAll(async () => { afterAll(() => {
resetToken() resetToken()
}) })
@ -265,7 +270,7 @@ describe('ContributionResolver', () => {
}) })
describe('valid input', () => { describe('valid input', () => {
it('creates contribution', async () => { it('creates contribution', () => {
expect(pendingContribution.data.createContribution).toMatchObject({ expect(pendingContribution.data.createContribution).toMatchObject({
id: expect.any(Number), id: expect.any(Number),
amount: '100', amount: '100',
@ -311,7 +316,7 @@ describe('ContributionResolver', () => {
}) })
}) })
afterAll(async () => { afterAll(() => {
resetToken() resetToken()
}) })
@ -452,7 +457,7 @@ describe('ContributionResolver', () => {
id: pendingContribution.data.createContribution.id, id: pendingContribution.data.createContribution.id,
}) })
contribution.contributionStatus = ContributionStatus.DELETED contribution.contributionStatus = ContributionStatus.DELETED
contribution.save() await contribution.save()
await mutate({ await mutate({
mutation: login, mutation: login,
variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' }, variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' },
@ -464,7 +469,7 @@ describe('ContributionResolver', () => {
id: pendingContribution.data.createContribution.id, id: pendingContribution.data.createContribution.id,
}) })
contribution.contributionStatus = ContributionStatus.PENDING contribution.contributionStatus = ContributionStatus.PENDING
contribution.save() await contribution.save()
}) })
it('throws an error', async () => { it('throws an error', async () => {
@ -636,7 +641,7 @@ describe('ContributionResolver', () => {
}) })
}) })
afterAll(async () => { afterAll(() => {
resetToken() resetToken()
}) })
@ -820,7 +825,7 @@ describe('ContributionResolver', () => {
) )
}) })
it('calls sendContributionDeniedEmail', async () => { it('calls sendContributionDeniedEmail', () => {
expect(sendContributionDeniedEmail).toBeCalledWith({ expect(sendContributionDeniedEmail).toBeCalledWith({
firstName: 'Bibi', firstName: 'Bibi',
lastName: 'Bloxberg', lastName: 'Bloxberg',
@ -856,7 +861,7 @@ describe('ContributionResolver', () => {
}) })
}) })
afterAll(async () => { afterAll(() => {
resetToken() resetToken()
}) })
@ -1009,7 +1014,7 @@ describe('ContributionResolver', () => {
}) })
}) })
afterAll(async () => { afterAll(() => {
resetToken() resetToken()
}) })
@ -1140,7 +1145,7 @@ describe('ContributionResolver', () => {
}) })
}) })
afterAll(async () => { afterAll(() => {
resetToken() resetToken()
}) })
@ -1720,7 +1725,7 @@ describe('ContributionResolver', () => {
}) })
}) })
afterAll(async () => { afterAll(() => {
resetToken() resetToken()
}) })
@ -1798,7 +1803,7 @@ describe('ContributionResolver', () => {
}) })
}) })
afterAll(async () => { afterAll(() => {
resetToken() resetToken()
}) })
@ -1913,7 +1918,7 @@ describe('ContributionResolver', () => {
}) })
describe('valid user to create for', () => { describe('valid user to create for', () => {
beforeAll(async () => { beforeAll(() => {
variables.email = 'bibi@bloxberg.de' variables.email = 'bibi@bloxberg.de'
variables.creationDate = 'invalid-date' variables.creationDate = 'invalid-date'
}) })
@ -2019,7 +2024,7 @@ describe('ContributionResolver', () => {
).resolves.toEqual( ).resolves.toEqual(
expect.objectContaining({ expect.objectContaining({
data: { data: {
adminCreateContribution: [1000, 1000, 590], adminCreateContribution: ['1000', '1000', '590'],
}, },
}), }),
) )
@ -2386,7 +2391,7 @@ describe('ContributionResolver', () => {
) )
}) })
it('calls sendContributionDeletedEmail', async () => { it('calls sendContributionDeletedEmail', () => {
expect(sendContributionDeletedEmail).toBeCalledWith({ expect(sendContributionDeletedEmail).toBeCalledWith({
firstName: 'Peter', firstName: 'Peter',
lastName: 'Lustig', lastName: 'Lustig',
@ -2551,7 +2556,7 @@ describe('ContributionResolver', () => {
expect(transaction[0].typeId).toEqual(1) expect(transaction[0].typeId).toEqual(1)
}) })
it('calls sendContributionConfirmedEmail', async () => { it('calls sendContributionConfirmedEmail', () => {
expect(sendContributionConfirmedEmail).toBeCalledWith({ expect(sendContributionConfirmedEmail).toBeCalledWith({
firstName: 'Bibi', firstName: 'Bibi',
lastName: 'Bloxberg', lastName: 'Bloxberg',

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/restrict-template-expressions */
import Decimal from 'decimal.js-light' import Decimal from 'decimal.js-light'
import { Arg, Args, Authorized, Ctx, Int, Mutation, Query, Resolver } from 'type-graphql' import { Arg, Args, Authorized, Ctx, Int, Mutation, Query, Resolver } from 'type-graphql'
import { IsNull, getConnection } from '@dbTools/typeorm' import { IsNull, getConnection } from '@dbTools/typeorm'
@ -27,11 +28,11 @@ import { RIGHTS } from '@/auth/RIGHTS'
import { Context, getUser, getClientTimezoneOffset } from '@/server/context' import { Context, getUser, getClientTimezoneOffset } from '@/server/context'
import { backendLogger as logger } from '@/server/logger' import { backendLogger as logger } from '@/server/logger'
import { import {
getCreationDates,
getUserCreation, getUserCreation,
validateContribution, validateContribution,
updateCreations, updateCreations,
isValidDateString, isValidDateString,
getOpenCreations,
} from './util/creations' } from './util/creations'
import { MEMO_MAX_CHARS, MEMO_MIN_CHARS } from './const/const' import { MEMO_MAX_CHARS, MEMO_MIN_CHARS } from './const/const'
import { import {
@ -131,7 +132,7 @@ export class ContributionResolver {
@Args() @Args()
{ currentPage = 1, pageSize = 5, order = Order.DESC }: Paginated, { currentPage = 1, pageSize = 5, order = Order.DESC }: Paginated,
@Arg('statusFilter', () => [ContributionStatus], { nullable: true }) @Arg('statusFilter', () => [ContributionStatus], { nullable: true })
statusFilter?: ContributionStatus[], statusFilter?: ContributionStatus[] | null,
): Promise<ContributionListResult> { ): Promise<ContributionListResult> {
const user = getUser(context) const user = getUser(context)
@ -156,7 +157,7 @@ export class ContributionResolver {
@Args() @Args()
{ currentPage = 1, pageSize = 5, order = Order.DESC }: Paginated, { currentPage = 1, pageSize = 5, order = Order.DESC }: Paginated,
@Arg('statusFilter', () => [ContributionStatus], { nullable: true }) @Arg('statusFilter', () => [ContributionStatus], { nullable: true })
statusFilter?: ContributionStatus[], statusFilter?: ContributionStatus[] | null,
): Promise<ContributionListResult> { ): Promise<ContributionListResult> {
const [dbContributions, count] = await findContributions( const [dbContributions, count] = await findContributions(
order, order,
@ -239,14 +240,14 @@ export class ContributionResolver {
contributionMessage.isModerator = false contributionMessage.isModerator = false
contributionMessage.userId = user.id contributionMessage.userId = user.id
contributionMessage.type = ContributionMessageType.HISTORY contributionMessage.type = ContributionMessageType.HISTORY
ContributionMessage.save(contributionMessage) await ContributionMessage.save(contributionMessage)
contributionToUpdate.amount = amount contributionToUpdate.amount = amount
contributionToUpdate.memo = memo contributionToUpdate.memo = memo
contributionToUpdate.contributionDate = new Date(creationDate) contributionToUpdate.contributionDate = new Date(creationDate)
contributionToUpdate.contributionStatus = ContributionStatus.PENDING contributionToUpdate.contributionStatus = ContributionStatus.PENDING
contributionToUpdate.updatedAt = new Date() contributionToUpdate.updatedAt = new Date()
DbContribution.save(contributionToUpdate) await DbContribution.save(contributionToUpdate)
await EVENT_CONTRIBUTION_UPDATE(user.id, contributionId, amount) await EVENT_CONTRIBUTION_UPDATE(user.id, contributionId, amount)
@ -254,7 +255,7 @@ export class ContributionResolver {
} }
@Authorized([RIGHTS.ADMIN_CREATE_CONTRIBUTION]) @Authorized([RIGHTS.ADMIN_CREATE_CONTRIBUTION])
@Mutation(() => [Number]) @Mutation(() => [Decimal])
async adminCreateContribution( async adminCreateContribution(
@Args() { email, amount, memo, creationDate }: AdminCreateContributionArgs, @Args() { email, amount, memo, creationDate }: AdminCreateContributionArgs,
@Ctx() context: Context, @Ctx() context: Context,
@ -384,7 +385,7 @@ export class ContributionResolver {
@Args() @Args()
{ currentPage = 1, pageSize = 3, order = Order.DESC }: Paginated, { currentPage = 1, pageSize = 3, order = Order.DESC }: Paginated,
@Arg('statusFilter', () => [ContributionStatus], { nullable: true }) @Arg('statusFilter', () => [ContributionStatus], { nullable: true })
statusFilter?: ContributionStatus[], statusFilter?: ContributionStatus[] | null,
): Promise<ContributionListResult> { ): Promise<ContributionListResult> {
const [dbContributions, count] = await findContributions( const [dbContributions, count] = await findContributions(
order, order,
@ -433,7 +434,7 @@ export class ContributionResolver {
await EVENT_ADMIN_CONTRIBUTION_DELETE(contribution.userId, contribution.id, contribution.amount) await EVENT_ADMIN_CONTRIBUTION_DELETE(contribution.userId, contribution.id, contribution.amount)
sendContributionDeletedEmail({ void sendContributionDeletedEmail({
firstName: user.firstName, firstName: user.firstName,
lastName: user.lastName, lastName: user.lastName,
email: user.emailContact.email, email: user.emailContact.email,
@ -527,7 +528,7 @@ export class ContributionResolver {
await queryRunner.commitTransaction() await queryRunner.commitTransaction()
logger.info('creation commited successfuly.') logger.info('creation commited successfuly.')
sendContributionConfirmedEmail({ void sendContributionConfirmedEmail({
firstName: user.firstName, firstName: user.firstName,
lastName: user.lastName, lastName: user.lastName,
email: user.emailContact.email, email: user.emailContact.email,
@ -580,21 +581,17 @@ export class ContributionResolver {
@Authorized([RIGHTS.OPEN_CREATIONS]) @Authorized([RIGHTS.OPEN_CREATIONS])
@Query(() => [OpenCreation]) @Query(() => [OpenCreation])
async openCreations( async openCreations(@Ctx() context: Context): Promise<OpenCreation[]> {
@Arg('userId', () => Int, { nullable: true }) userId: number | null, return getOpenCreations(getUser(context).id, getClientTimezoneOffset(context))
}
@Authorized([RIGHTS.ADMIN_OPEN_CREATIONS])
@Query(() => [OpenCreation])
async adminOpenCreations(
@Arg('userId', () => Int) userId: number,
@Ctx() context: Context, @Ctx() context: Context,
): Promise<OpenCreation[]> { ): Promise<OpenCreation[]> {
const id = userId || getUser(context).id return getOpenCreations(userId, getClientTimezoneOffset(context))
const clientTimezoneOffset = getClientTimezoneOffset(context)
const creationDates = getCreationDates(clientTimezoneOffset)
const creations = await getUserCreation(id, clientTimezoneOffset)
return creationDates.map((date, index) => {
return {
month: date.getMonth(),
year: date.getFullYear(),
amount: creations[index],
}
})
} }
@Authorized([RIGHTS.DENY_CONTRIBUTION]) @Authorized([RIGHTS.DENY_CONTRIBUTION])
@ -641,7 +638,7 @@ export class ContributionResolver {
contributionToUpdate.amount, contributionToUpdate.amount,
) )
sendContributionDeniedEmail({ void sendContributionDeniedEmail({
firstName: user.firstName, firstName: user.firstName,
lastName: user.lastName, lastName: user.lastName,
email: user.emailContact.email, email: user.emailContact.email,

View File

@ -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/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */

View File

@ -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, Float } from 'type-graphql'
import { GdtEntryList } from '@model/GdtEntryList' import { GdtEntryList } from '@model/GdtEntryList'
import { Order } from '@enum/Order' import { Order } from '@enum/Order'
@ -23,6 +26,7 @@ export class GdtResolver {
try { try {
const resultGDT = await apiGet( 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}`, `${CONFIG.GDT_API_URL}/GdtEntries/listPerEmailApi/${userEntity.emailContact.email}/${currentPage}/${pageSize}/${order}`,
) )
if (!resultGDT.success) { if (!resultGDT.success) {
@ -35,7 +39,7 @@ export class GdtResolver {
} }
@Authorized([RIGHTS.GDT_BALANCE]) @Authorized([RIGHTS.GDT_BALANCE])
@Query(() => Number) @Query(() => Float, { nullable: true })
async gdtBalance(@Ctx() context: Context): Promise<number | null> { async gdtBalance(@Ctx() context: Context): Promise<number | null> {
const user = getUser(context) const user = getUser(context)
try { try {
@ -54,9 +58,9 @@ export class GdtResolver {
} }
@Authorized([RIGHTS.EXIST_PID]) @Authorized([RIGHTS.EXIST_PID])
@Query(() => Number) @Query(() => Int)
// eslint-disable-next-line @typescript-eslint/no-explicit-any // 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 // load user
const resultPID = await apiGet(`${CONFIG.GDT_API_URL}/publishers/checkPidApi/${pid}`) const resultPID = await apiGet(`${CONFIG.GDT_API_URL}/publishers/checkPidApi/${pid}`)
if (!resultPID.success) { if (!resultPID.success) {

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-unsafe-return */
import { Resolver, Query, Authorized, Arg, Mutation, Args } from 'type-graphql' import { Resolver, Query, Authorized, Arg, Mutation, Args } from 'type-graphql'
import SubscribeNewsletterArgs from '@arg/SubscribeNewsletterArgs' import SubscribeNewsletterArgs from '@arg/SubscribeNewsletterArgs'

View File

@ -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 Decimal from 'decimal.js-light'
import { Resolver, Query, Authorized, FieldResolver } from 'type-graphql' import { Resolver, Query, Authorized, FieldResolver } from 'type-graphql'
import { getConnection } from '@dbTools/typeorm' import { getConnection } from '@dbTools/typeorm'
@ -15,7 +17,7 @@ import { calculateDecay } from '@/util/decay'
export class StatisticsResolver { export class StatisticsResolver {
@Authorized([RIGHTS.COMMUNITY_STATISTICS]) @Authorized([RIGHTS.COMMUNITY_STATISTICS])
@Query(() => CommunityStatistics) @Query(() => CommunityStatistics)
async communityStatistics(): Promise<CommunityStatistics> { communityStatistics(): CommunityStatistics {
return new CommunityStatistics() return new CommunityStatistics()
} }

View File

@ -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/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
@ -17,10 +22,12 @@ import {
createContribution, createContribution,
updateContribution, updateContribution,
createTransactionLink, createTransactionLink,
confirmContribution,
} from '@/seeds/graphql/mutations' } from '@/seeds/graphql/mutations'
import { listTransactionLinksAdmin } from '@/seeds/graphql/queries' import { listTransactionLinksAdmin } from '@/seeds/graphql/queries'
import { ContributionLink as DbContributionLink } from '@entity/ContributionLink' import { ContributionLink as DbContributionLink } from '@entity/ContributionLink'
import { User } from '@entity/User' import { User } from '@entity/User'
import { Transaction } from '@entity/Transaction'
import { UnconfirmedContribution } from '@model/UnconfirmedContribution' import { UnconfirmedContribution } from '@model/UnconfirmedContribution'
import Decimal from 'decimal.js-light' import Decimal from 'decimal.js-light'
import { GraphQLError } from 'graphql' import { GraphQLError } from 'graphql'
@ -137,6 +144,8 @@ describe('TransactionLinkResolver', () => {
resetToken() resetToken()
}) })
let contributionId: number
describe('unauthenticated', () => { describe('unauthenticated', () => {
it('throws an error', async () => { it('throws an error', async () => {
jest.clearAllMocks() jest.clearAllMocks()
@ -210,7 +219,7 @@ describe('TransactionLinkResolver', () => {
mutate({ mutate({
mutation: redeemTransactionLink, mutation: redeemTransactionLink,
variables: { variables: {
code: 'CL-' + contributionLink.code, code: `CL-${contributionLink.code}`,
}, },
}), }),
).resolves.toMatchObject({ ).resolves.toMatchObject({
@ -249,7 +258,7 @@ describe('TransactionLinkResolver', () => {
mutate({ mutate({
mutation: redeemTransactionLink, mutation: redeemTransactionLink,
variables: { variables: {
code: 'CL-' + contributionLink.code, code: `CL-${contributionLink.code}`,
}, },
}), }),
).resolves.toMatchObject({ ).resolves.toMatchObject({
@ -288,7 +297,7 @@ describe('TransactionLinkResolver', () => {
mutate({ mutate({
mutation: redeemTransactionLink, mutation: redeemTransactionLink,
variables: { variables: {
code: 'CL-' + contributionLink.code, code: `CL-${contributionLink.code}`,
}, },
}), }),
).resolves.toMatchObject({ ).resolves.toMatchObject({
@ -306,7 +315,6 @@ describe('TransactionLinkResolver', () => {
}) })
}) })
// TODO: have this test separated into a transactionLink and a contributionLink part
describe('redeem daily Contribution Link', () => { describe('redeem daily Contribution Link', () => {
const now = new Date() const now = new Date()
let contributionLink: DbContributionLink | undefined let contributionLink: DbContributionLink | undefined
@ -332,6 +340,10 @@ describe('TransactionLinkResolver', () => {
}) })
}) })
afterAll(async () => {
await resetEntity(Transaction)
})
it('has a daily contribution link in the database', async () => { it('has a daily contribution link in the database', async () => {
const cls = await DbContributionLink.find() const cls = await DbContributionLink.find()
expect(cls).toHaveLength(1) expect(cls).toHaveLength(1)
@ -373,6 +385,7 @@ describe('TransactionLinkResolver', () => {
}, },
}) })
contribution = result.data.createContribution contribution = result.data.createContribution
contributionId = result.data.createContribution.id
}) })
it('does not allow the user to redeem the contribution link', async () => { it('does not allow the user to redeem the contribution link', async () => {
@ -508,6 +521,92 @@ describe('TransactionLinkResolver', () => {
}) })
}) })
}) })
describe('transaction link', () => {
beforeEach(() => {
jest.clearAllMocks()
})
describe('link does not exits', () => {
beforeAll(async () => {
await mutate({
mutation: login,
variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' },
})
})
it('throws and logs the error', async () => {
await expect(
mutate({
mutation: redeemTransactionLink,
variables: {
code: 'not-valid',
},
}),
).resolves.toMatchObject({
errors: [new GraphQLError('Transaction link not found')],
})
expect(logger.error).toBeCalledWith('Transaction link not found', 'not-valid')
})
})
describe('link exists', () => {
let myCode: string
beforeAll(async () => {
await mutate({
mutation: login,
variables: { email: 'peter@lustig.de', password: 'Aa12345_' },
})
await mutate({
mutation: confirmContribution,
variables: { id: contributionId },
})
await mutate({
mutation: login,
variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' },
})
const {
data: {
createTransactionLink: { code },
},
} = await mutate({
mutation: createTransactionLink,
variables: {
amount: 200,
memo: 'This is a transaction link from bibi',
},
})
myCode = code
})
describe('own link', () => {
beforeAll(async () => {
await mutate({
mutation: login,
variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' },
})
})
it('throws and logs an error', async () => {
await expect(
mutate({
mutation: redeemTransactionLink,
variables: {
code: myCode,
},
}),
).resolves.toMatchObject({
errors: [new GraphQLError('Cannot redeem own transaction link')],
})
expect(logger.error).toBeCalledWith(
'Cannot redeem own transaction link',
expect.any(Number),
)
})
})
})
})
}) })
}) })

View File

@ -285,12 +285,20 @@ export class TransactionLinkResolver {
return true return true
} else { } else {
const now = new Date() const now = new Date()
const transactionLink = await DbTransactionLink.findOneOrFail({ code }) const transactionLink = await DbTransactionLink.findOne({ code })
const linkedUser = await DbUser.findOneOrFail( if (!transactionLink) {
throw new LogError('Transaction link not found', code)
}
const linkedUser = await DbUser.findOne(
{ id: transactionLink.userId }, { id: transactionLink.userId },
{ relations: ['emailContact'] }, { relations: ['emailContact'] },
) )
if (!linkedUser) {
throw new LogError('Linked user not found for given link', transactionLink.userId)
}
if (user.id === linkedUser.id) { if (user.id === linkedUser.id) {
throw new LogError('Cannot redeem own transaction link', user.id) throw new LogError('Cannot redeem own transaction link', user.id)
} }
@ -341,8 +349,9 @@ export class TransactionLinkResolver {
async listTransactionLinksAdmin( async listTransactionLinksAdmin(
@Args() @Args()
paginated: Paginated, paginated: Paginated,
// eslint-disable-next-line type-graphql/wrong-decorator-signature
@Arg('filters', () => TransactionLinkFilters, { nullable: true }) @Arg('filters', () => TransactionLinkFilters, { nullable: true })
filters: TransactionLinkFilters | null, filters: TransactionLinkFilters | null, // eslint-disable-line type-graphql/invalid-nullable-input-type
@Arg('userId', () => Int) @Arg('userId', () => Int)
userId: number, userId: number,
): Promise<TransactionLinkResult> { ): Promise<TransactionLinkResult> {

View File

@ -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/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
@ -324,7 +328,7 @@ describe('send coins', () => {
).toEqual( ).toEqual(
expect.objectContaining({ expect.objectContaining({
data: { data: {
sendCoins: 'true', sendCoins: true,
}, },
}), }),
) )
@ -337,7 +341,7 @@ describe('send coins', () => {
memo: 'unrepeatable memo', memo: 'unrepeatable memo',
}) })
expect(EventProtocol.find()).resolves.toContainEqual( await expect(EventProtocol.find()).resolves.toContainEqual(
expect.objectContaining({ expect.objectContaining({
type: EventProtocolType.TRANSACTION_SEND, type: EventProtocolType.TRANSACTION_SEND,
userId: user[1].id, userId: user[1].id,
@ -354,7 +358,7 @@ describe('send coins', () => {
memo: 'unrepeatable memo', memo: 'unrepeatable memo',
}) })
expect(EventProtocol.find()).resolves.toContainEqual( await expect(EventProtocol.find()).resolves.toContainEqual(
expect.objectContaining({ expect.objectContaining({
type: EventProtocolType.TRANSACTION_RECEIVE, type: EventProtocolType.TRANSACTION_RECEIVE,
userId: user[0].id, userId: user[0].id,
@ -379,7 +383,7 @@ describe('send coins', () => {
).resolves.toEqual( ).resolves.toEqual(
expect.objectContaining({ expect.objectContaining({
data: { data: {
sendCoins: 'true', sendCoins: true,
}, },
}), }),
) )
@ -395,7 +399,7 @@ describe('send coins', () => {
).resolves.toEqual( ).resolves.toEqual(
expect.objectContaining({ expect.objectContaining({
data: { data: {
sendCoins: 'true', sendCoins: true,
}, },
}), }),
) )
@ -411,7 +415,7 @@ describe('send coins', () => {
).resolves.toEqual( ).resolves.toEqual(
expect.objectContaining({ expect.objectContaining({
data: { data: {
sendCoins: 'true', sendCoins: true,
}, },
}), }),
) )
@ -427,7 +431,7 @@ describe('send coins', () => {
).resolves.toEqual( ).resolves.toEqual(
expect.objectContaining({ expect.objectContaining({
data: { data: {
sendCoins: 'true', sendCoins: true,
}, },
}), }),
) )

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/restrict-template-expressions */
/* eslint-disable new-cap */ /* eslint-disable new-cap */
/* eslint-disable @typescript-eslint/no-non-null-assertion */ /* eslint-disable @typescript-eslint/no-non-null-assertion */
@ -304,7 +305,7 @@ export class TransactionResolver {
} }
@Authorized([RIGHTS.SEND_COINS]) @Authorized([RIGHTS.SEND_COINS])
@Mutation(() => String) @Mutation(() => Boolean)
async sendCoins( async sendCoins(
@Args() { email, amount, memo }: TransactionSendArgs, @Args() { email, amount, memo }: TransactionSendArgs,
@Ctx() context: Context, @Ctx() context: Context,

View File

@ -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/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
@ -182,7 +187,7 @@ describe('UserResolver', () => {
{ email: 'peter@lustig.de' }, { email: 'peter@lustig.de' },
{ relations: ['user'] }, { relations: ['user'] },
) )
expect(EventProtocol.find()).resolves.toContainEqual( await expect(EventProtocol.find()).resolves.toContainEqual(
expect.objectContaining({ expect.objectContaining({
type: EventProtocolType.REGISTER, type: EventProtocolType.REGISTER,
userId: userConatct.user.id, userId: userConatct.user.id,
@ -210,8 +215,8 @@ describe('UserResolver', () => {
}) })
}) })
it('stores the SEND_CONFIRMATION_EMAIL event in the database', () => { it('stores the SEND_CONFIRMATION_EMAIL event in the database', async () => {
expect(EventProtocol.find()).resolves.toContainEqual( await expect(EventProtocol.find()).resolves.toContainEqual(
expect.objectContaining({ expect.objectContaining({
type: EventProtocolType.SEND_CONFIRMATION_EMAIL, type: EventProtocolType.SEND_CONFIRMATION_EMAIL,
userId: user[0].id, userId: user[0].id,
@ -226,7 +231,7 @@ describe('UserResolver', () => {
mutation = await mutate({ mutation: createUser, variables }) 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') 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(mutation).toEqual(
expect.objectContaining({ expect.objectContaining({
data: { data: {
@ -256,7 +261,7 @@ describe('UserResolver', () => {
{ email: 'peter@lustig.de' }, { email: 'peter@lustig.de' },
{ relations: ['user'] }, { relations: ['user'] },
) )
expect(EventProtocol.find()).resolves.toContainEqual( await expect(EventProtocol.find()).resolves.toContainEqual(
expect.objectContaining({ expect.objectContaining({
type: EventProtocolType.SEND_ACCOUNT_MULTIREGISTRATION_EMAIL, type: EventProtocolType.SEND_ACCOUNT_MULTIREGISTRATION_EMAIL,
userId: userConatct.user.id, userId: userConatct.user.id,
@ -283,7 +288,7 @@ describe('UserResolver', () => {
}) })
describe('no publisher id', () => { describe('no publisher id', () => {
it('sets publisher id to null', async () => { it('sets publisher id to 0', async () => {
await mutate({ await mutate({
mutation: createUser, mutation: createUser,
variables: { ...variables, email: 'raeuber@hotzenplotz.de', publisherId: undefined }, variables: { ...variables, email: 'raeuber@hotzenplotz.de', publisherId: undefined },
@ -294,7 +299,7 @@ describe('UserResolver', () => {
emailContact: expect.objectContaining({ emailContact: expect.objectContaining({
email: 'raeuber@hotzenplotz.de', email: 'raeuber@hotzenplotz.de',
}), }),
publisherId: null, publisherId: 0,
}), }),
]), ]),
) )
@ -355,8 +360,8 @@ describe('UserResolver', () => {
) )
}) })
it('stores the ACTIVATE_ACCOUNT event in the database', () => { it('stores the ACTIVATE_ACCOUNT event in the database', async () => {
expect(EventProtocol.find()).resolves.toContainEqual( await expect(EventProtocol.find()).resolves.toContainEqual(
expect.objectContaining({ expect.objectContaining({
type: EventProtocolType.ACTIVATE_ACCOUNT, type: EventProtocolType.ACTIVATE_ACCOUNT,
userId: user[0].id, userId: user[0].id,
@ -364,8 +369,8 @@ describe('UserResolver', () => {
) )
}) })
it('stores the REDEEM_REGISTER event in the database', () => { it('stores the REDEEM_REGISTER event in the database', async () => {
expect(EventProtocol.find()).resolves.toContainEqual( await expect(EventProtocol.find()).resolves.toContainEqual(
expect.objectContaining({ expect.objectContaining({
type: EventProtocolType.REDEEM_REGISTER, type: EventProtocolType.REDEEM_REGISTER,
userId: result.data.createUser.id, userId: result.data.createUser.id,
@ -680,7 +685,7 @@ describe('UserResolver', () => {
{ email: 'bibi@bloxberg.de' }, { email: 'bibi@bloxberg.de' },
{ relations: ['user'] }, { relations: ['user'] },
) )
expect(EventProtocol.find()).resolves.toContainEqual( await expect(EventProtocol.find()).resolves.toContainEqual(
expect.objectContaining({ expect.objectContaining({
type: EventProtocolType.LOGIN, type: EventProtocolType.LOGIN,
userId: userConatct.user.id, userId: userConatct.user.id,
@ -849,7 +854,7 @@ describe('UserResolver', () => {
it('returns true', async () => { it('returns true', async () => {
await expect(mutate({ mutation: logout })).resolves.toEqual( await expect(mutate({ mutation: logout })).resolves.toEqual(
expect.objectContaining({ expect.objectContaining({
data: { logout: 'true' }, data: { logout: true },
errors: undefined, errors: undefined,
}), }),
) )
@ -927,8 +932,8 @@ describe('UserResolver', () => {
) )
}) })
it('stores the LOGIN event in the database', () => { it('stores the LOGIN event in the database', async () => {
expect(EventProtocol.find()).resolves.toContainEqual( await expect(EventProtocol.find()).resolves.toContainEqual(
expect.objectContaining({ expect.objectContaining({
type: EventProtocolType.LOGIN, type: EventProtocolType.LOGIN,
userId: user[0].id, userId: user[0].id,
@ -1847,7 +1852,7 @@ describe('UserResolver', () => {
{ email: 'bibi@bloxberg.de' }, { email: 'bibi@bloxberg.de' },
{ relations: ['user'] }, { relations: ['user'] },
) )
expect(EventProtocol.find()).resolves.toContainEqual( await expect(EventProtocol.find()).resolves.toContainEqual(
expect.objectContaining({ expect.objectContaining({
type: EventProtocolType.ADMIN_SEND_CONFIRMATION_EMAIL, type: EventProtocolType.ADMIN_SEND_CONFIRMATION_EMAIL,
userId: userConatct.user.id, userId: userConatct.user.id,

View File

@ -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 i18n from 'i18n'
import { v4 as uuidv4 } from 'uuid' import { v4 as uuidv4 } from 'uuid'
import { import {
@ -166,11 +170,11 @@ export class UserResolver {
// Elopage Status & Stored PublisherId // Elopage Status & Stored PublisherId
user.hasElopage = await this.hasElopage({ ...context, user: dbUser }) user.hasElopage = await this.hasElopage({ ...context, user: dbUser })
logger.info('user.hasElopage=' + user.hasElopage) logger.info('user.hasElopage', user.hasElopage)
if (!user.hasElopage && publisherId) { if (!user.hasElopage && publisherId) {
user.publisherId = publisherId user.publisherId = publisherId
dbUser.publisherId = publisherId dbUser.publisherId = publisherId
DbUser.save(dbUser) await DbUser.save(dbUser)
} }
context.setHeaders.push({ context.setHeaders.push({
@ -184,8 +188,8 @@ export class UserResolver {
} }
@Authorized([RIGHTS.LOGOUT]) @Authorized([RIGHTS.LOGOUT])
@Mutation(() => String) @Mutation(() => Boolean)
async logout(): Promise<boolean> { logout(): boolean {
// TODO: Event still missing here!! // 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. // 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) // 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) @Mutation(() => User)
async createUser( async createUser(
@Args() @Args()
{ email, firstName, lastName, language, publisherId, redeemCode = null }: CreateUserArgs, { email, firstName, lastName, language, publisherId = null, redeemCode = null }: CreateUserArgs,
): Promise<User> { ): Promise<User> {
logger.addContext('user', 'unknown') logger.addContext('user', 'unknown')
logger.info( logger.info(
@ -239,7 +243,7 @@ export class UserResolver {
user.lastName = lastName user.lastName = lastName
user.language = language user.language = language
user.publisherId = publisherId user.publisherId = publisherId
logger.debug('partly faked user=' + user) logger.debug('partly faked user', user)
const emailSent = await sendAccountMultiRegistrationEmail({ 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 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.firstName = firstName
dbUser.lastName = lastName dbUser.lastName = lastName
dbUser.language = language dbUser.language = language
dbUser.publisherId = publisherId dbUser.publisherId = publisherId || 0
dbUser.passwordEncryptionType = PasswordEncryptionType.NO_PASSWORD dbUser.passwordEncryptionType = PasswordEncryptionType.NO_PASSWORD
logger.debug('new dbUser=' + dbUser) logger.debug('new dbUser', dbUser)
if (redeemCode) { if (redeemCode) {
if (redeemCode.match(/^CL-/)) { if (redeemCode.match(/^CL-/)) {
const contributionLink = await DbContributionLink.findOne({ const contributionLink = await DbContributionLink.findOne({
code: redeemCode.replace('CL-', ''), code: redeemCode.replace('CL-', ''),
}) })
logger.info('redeemCode found contributionLink=' + contributionLink) logger.info('redeemCode found contributionLink', contributionLink)
if (contributionLink) { if (contributionLink) {
dbUser.contributionLinkId = contributionLink.id dbUser.contributionLinkId = contributionLink.id
eventRegisterRedeem.contributionId = contributionLink.id eventRegisterRedeem.contributionId = contributionLink.id
} }
} else { } else {
const transactionLink = await DbTransactionLink.findOne({ code: redeemCode }) const transactionLink = await DbTransactionLink.findOne({ code: redeemCode })
logger.info('redeemCode found transactionLink=' + transactionLink) logger.info('redeemCode found transactionLink', transactionLink)
if (transactionLink) { if (transactionLink) {
dbUser.referrerId = transactionLink.userId dbUser.referrerId = transactionLink.userId
eventRegisterRedeem.transactionId = transactionLink.id eventRegisterRedeem.transactionId = transactionLink.id
@ -654,7 +658,7 @@ export class UserResolver {
return 'user.' + fieldName return 'user.' + fieldName
}), }),
searchText, searchText,
filters, filters || null,
currentPage, currentPage,
pageSize, pageSize,
) )

View File

@ -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 */ /* eslint-disable @typescript-eslint/no-explicit-any */
import Decimal from 'decimal.js-light' import Decimal from 'decimal.js-light'
@ -79,7 +83,7 @@ describe('semaphore', () => {
maxPerCycle: 1, maxPerCycle: 1,
}, },
}) })
contributionLinkCode = 'CL-' + contributionLink.code contributionLinkCode = `CL-${contributionLink.code}`
await mutate({ await mutate({
mutation: login, mutation: login,
variables: { email: 'bob@baumeister.de', password: 'Aa12345_' }, variables: { email: 'bob@baumeister.de', password: 'Aa12345_' },
@ -187,4 +191,50 @@ describe('semaphore', () => {
await expect(confirmBibisContribution).resolves.toMatchObject({ errors: undefined }) await expect(confirmBibisContribution).resolves.toMatchObject({ errors: undefined })
await expect(confirmBobsContribution).resolves.toMatchObject({ errors: undefined }) await expect(confirmBobsContribution).resolves.toMatchObject({ errors: undefined })
}) })
describe('redeem transaction link twice', () => {
let myCode: string
beforeAll(async () => {
await mutate({
mutation: login,
variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' },
})
const {
data: { createTransactionLink: bibisLink },
} = await mutate({
mutation: createTransactionLink,
variables: {
amount: 20,
memo: 'Bibis Link',
},
})
myCode = bibisLink.code
await mutate({
mutation: login,
variables: { email: 'bob@baumeister.de', password: 'Aa12345_' },
})
})
it('does not throw, but should', async () => {
const redeem1 = mutate({
mutation: redeemTransactionLink,
variables: {
code: myCode,
},
})
const redeem2 = mutate({
mutation: redeemTransactionLink,
variables: {
code: myCode,
},
})
await expect(redeem1).resolves.toMatchObject({
errors: undefined,
})
await expect(redeem2).resolves.toMatchObject({
errors: undefined,
})
})
})
}) })

View File

@ -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/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */

View File

@ -1,9 +1,12 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import LogError from '@/server/LogError' import LogError from '@/server/LogError'
import { backendLogger as logger } from '@/server/logger' import { backendLogger as logger } from '@/server/logger'
import { getConnection } from '@dbTools/typeorm' import { getConnection } from '@dbTools/typeorm'
import { Contribution } from '@entity/Contribution' import { Contribution } from '@entity/Contribution'
import Decimal from 'decimal.js-light' import Decimal from 'decimal.js-light'
import { FULL_CREATION_AVAILABLE, MAX_CREATION_AMOUNT } from '../const/const' import { FULL_CREATION_AVAILABLE, MAX_CREATION_AMOUNT } from '../const/const'
import { OpenCreation } from '@model/OpenCreation'
interface CreationMap { interface CreationMap {
id: number id: number
@ -100,7 +103,7 @@ const getCreationMonths = (timezoneOffset: number): number[] => {
return getCreationDates(timezoneOffset).map((date) => date.getMonth() + 1) return getCreationDates(timezoneOffset).map((date) => date.getMonth() + 1)
} }
export const getCreationDates = (timezoneOffset: number): Date[] => { const getCreationDates = (timezoneOffset: number): Date[] => {
const clientNow = new Date() const clientNow = new Date()
clientNow.setTime(clientNow.getTime() - timezoneOffset * 60 * 1000) clientNow.setTime(clientNow.getTime() - timezoneOffset * 60 * 1000)
logger.info( logger.info(
@ -152,3 +155,18 @@ export const updateCreations = (
export const isValidDateString = (dateString: string): boolean => { export const isValidDateString = (dateString: string): boolean => {
return new Date(dateString).toString() !== 'Invalid Date' return new Date(dateString).toString() !== 'Invalid Date'
} }
export const getOpenCreations = async (
userId: number,
timezoneOffset: number,
): Promise<OpenCreation[]> => {
const creations = await getUserCreation(userId, timezoneOffset)
const creationDates = getCreationDates(timezoneOffset)
return creationDates.map((date, index) => {
return {
month: date.getMonth(),
year: date.getFullYear(),
amount: creations[index],
}
})
}

View File

@ -10,7 +10,7 @@ export const findContributions = async (
withDeleted: boolean, withDeleted: boolean,
relations: string[], relations: string[],
userId?: number, userId?: number,
statusFilter?: ContributionStatus[], statusFilter?: ContributionStatus[] | null,
): Promise<[DbContribution[], number]> => ): Promise<[DbContribution[], number]> =>
DbContribution.findAndCount({ DbContribution.findAndCount({
where: { where: {

View File

@ -17,7 +17,7 @@ async function main() {
console.log(`GraphIQL available at http://localhost:${CONFIG.PORT}`) 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) => { main().catch((e) => {

View File

@ -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 { MiddlewareFn } from 'type-graphql'
import { /* klicktippSignIn, */ getKlickTippUser } from '@/apis/KlicktippController' import { /* klicktippSignIn, */ getKlickTippUser } from '@/apis/KlicktippController'
import { KlickTipp } from '@model/KlickTipp' import { KlickTipp } from '@model/KlickTipp'

View File

@ -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 CONFIG from '@/config'
import LogError from '@/server/LogError' import LogError from '@/server/LogError'
import { backendLogger as logger } from '@/server/logger' import { backendLogger as logger } from '@/server/logger'

View File

@ -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 { ApolloServerTestClient } from 'apollo-server-testing'
import { login, createContributionLink } from '@/seeds/graphql/mutations' import { login, createContributionLink } from '@/seeds/graphql/mutations'
import { ContributionLink } from '@model/ContributionLink' import { ContributionLink } from '@model/ContributionLink'

View File

@ -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/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */

View File

@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/unbound-method */
import { ApolloServerTestClient } from 'apollo-server-testing' import { ApolloServerTestClient } from 'apollo-server-testing'
import { login, createTransactionLink } from '@/seeds/graphql/mutations' import { login, createTransactionLink } from '@/seeds/graphql/mutations'
import { TransactionLinkInterface } from '@/seeds/transactionLink/TransactionLinkInterface' import { TransactionLinkInterface } from '@/seeds/transactionLink/TransactionLinkInterface'

View File

@ -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 { createUser, setPassword } from '@/seeds/graphql/mutations'
import { User } from '@entity/User' import { User } from '@entity/User'
import { UserInterface } from '@/seeds/users/UserInterface' import { UserInterface } from '@/seeds/users/UserInterface'

View File

@ -89,6 +89,12 @@ export const createTransactionLink = gql`
} }
` `
export const deleteTransactionLink = gql`
mutation ($id: Int!) {
deleteTransactionLink(id: $id)
}
`
// from admin interface // from admin interface
export const adminCreateContribution = gql` export const adminCreateContribution = gql`
@ -269,7 +275,7 @@ export const denyContribution = gql`
` `
export const createContributionMessage = gql` export const createContributionMessage = gql`
mutation ($contributionId: Float!, $message: String!) { mutation ($contributionId: Int!, $message: String!) {
createContributionMessage(contributionId: $contributionId, message: $message) { createContributionMessage(contributionId: $contributionId, message: $message) {
id id
message message
@ -283,7 +289,7 @@ export const createContributionMessage = gql`
` `
export const adminCreateContributionMessage = gql` export const adminCreateContributionMessage = gql`
mutation ($contributionId: Float!, $message: String!) { mutation ($contributionId: Int!, $message: String!) {
adminCreateContributionMessage(contributionId: $contributionId, message: $message) { adminCreateContributionMessage(contributionId: $contributionId, message: $message) {
id id
message message

View File

@ -301,7 +301,7 @@ export const searchAdminUsers = gql`
` `
export const listContributionMessages = gql` export const listContributionMessages = gql`
query ($contributionId: Float!, $pageSize: Int = 25, $currentPage: Int = 1, $order: Order = ASC) { query ($contributionId: Int!, $pageSize: Int = 25, $currentPage: Int = 1, $order: Order = ASC) {
listContributionMessages( listContributionMessages(
contributionId: $contributionId contributionId: $contributionId
pageSize: $pageSize pageSize: $pageSize

View File

@ -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/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
@ -94,4 +98,4 @@ const run = async () => {
await con.close() await con.close()
} }
run() void run()

View File

@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/unbound-method */
import { logger } from '@test/testSetup' import { logger } from '@test/testSetup'
import LogError from './LogError' import LogError from './LogError'

View File

@ -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 'reflect-metadata'
import { ApolloServer } from 'apollo-server-express' import { ApolloServer } from 'apollo-server-express'
@ -71,6 +74,7 @@ const createServer = async (
app.use(localization.init) app.use(localization.init)
// Elopage Webhook // Elopage Webhook
// eslint-disable-next-line @typescript-eslint/no-misused-promises
app.post('/hook/elopage/' + CONFIG.WEBHOOK_ELOPAGE_SECRET, elopageWebhook) app.post('/hook/elopage/' + CONFIG.WEBHOOK_ELOPAGE_SECRET, elopageWebhook)
// Apollo Server // Apollo Server

View File

@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import log4js from 'log4js' import log4js from 'log4js'
import CONFIG from '@/config' import CONFIG from '@/config'

View File

@ -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/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { Repository, EntityRepository } from '@dbTools/typeorm' import { Repository, EntityRepository } from '@dbTools/typeorm'
import { TransactionLink as dbTransactionLink } from '@entity/TransactionLink' import { TransactionLink as dbTransactionLink } from '@entity/TransactionLink'
import Decimal from 'decimal.js-light' import Decimal from 'decimal.js-light'

View File

@ -7,7 +7,7 @@ export class UserRepository extends Repository<DbUser> {
async findBySearchCriteriaPagedFiltered( async findBySearchCriteriaPagedFiltered(
select: string[], select: string[],
searchCriteria: string, searchCriteria: string,
filters: SearchUsersFilters, filters: SearchUsersFilters | null,
currentPage: number, currentPage: number,
pageSize: number, pageSize: number,
): Promise<[DbUser[], number]> { ): Promise<[DbUser[], number]> {

View File

@ -10,13 +10,13 @@ describe('utils/decay', () => {
// TODO: toString() was required, we could not compare two decimals // TODO: toString() was required, we could not compare two decimals
expect(decayFormula(amount, seconds).toString()).toBe('0.999999978035040489732012') 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 amount = new Decimal(1.0)
const seconds = -1 const seconds = -1
expect(decayFormula(amount, seconds).toString()).toBe('1.000000021964959992727444') expect(decayFormula(amount, seconds).toString()).toBe('1.000000021964959992727444')
}) })
// we get pretty close, but not exact here, skipping // 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( const amount = new Decimal(1.0).div(
new Decimal('0.99999997803504048973201202316767079413460520837376'), new Decimal('0.99999997803504048973201202316767079413460520837376'),
) )
@ -24,7 +24,7 @@ describe('utils/decay', () => {
expect(decayFormula(amount, seconds).toString()).toBe('1.0') expect(decayFormula(amount, seconds).toString()).toBe('1.0')
}) })
}) })
it('has base 0.99999997802044727', async () => { it('has base 0.99999997802044727', () => {
const now = new Date() const now = new Date()
now.setSeconds(1) now.setSeconds(1)
const oneSecondAgo = new Date(now.getTime()) 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() const now = new Date()
expect(calculateDecay(new Decimal(100.0), now, now).balance.toString()).toBe('100') expect(calculateDecay(new Decimal(100.0), now, now).balance.toString()).toBe('100')
}) })

View File

@ -26,4 +26,4 @@ export async function retrieveNotRegisteredEmails(): Promise<string[]> {
return notRegisteredUser return notRegisteredUser
} }
retrieveNotRegisteredEmails() void retrieveNotRegisteredEmails()

View File

@ -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/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
/* /*

View File

@ -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 */ /* eslint-disable @typescript-eslint/no-empty-interface */
import Decimal from 'decimal.js-light' import Decimal from 'decimal.js-light'

View File

@ -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/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */

View File

@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-return */
import CONFIG from '@/config' import CONFIG from '@/config'
import { backendLogger as logger } from '@/server/logger' import { backendLogger as logger } from '@/server/logger'
import { i18n } from '@/server/localization' import { i18n } from '@/server/localization'

View File

@ -1014,6 +1014,11 @@
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.9.tgz#97edc9037ea0c38585320b28964dde3b39e4660d" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.9.tgz#97edc9037ea0c38585320b28964dde3b39e4660d"
integrity sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ== integrity sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==
"@types/json-schema@^7.0.9":
version "7.0.11"
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3"
integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==
"@types/json5@^0.0.29": "@types/json5@^0.0.29":
version "0.0.29" version "0.0.29"
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
@ -1123,6 +1128,11 @@
resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.4.tgz#cd667bcfdd025213aafb7ca5915a932590acdcdc" resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.4.tgz#cd667bcfdd025213aafb7ca5915a932590acdcdc"
integrity sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw== integrity sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==
"@types/semver@^7.3.12":
version "7.3.13"
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.13.tgz#da4bfd73f49bd541d28920ab0e2bf0ee80f71c91"
integrity sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==
"@types/semver@^7.3.3": "@types/semver@^7.3.3":
version "7.3.8" version "7.3.8"
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.8.tgz#508a27995498d7586dcecd77c25e289bfaf90c59" resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.8.tgz#508a27995498d7586dcecd77c25e289bfaf90c59"
@ -1196,6 +1206,13 @@
eslint-scope "^5.1.1" eslint-scope "^5.1.1"
eslint-utils "^3.0.0" eslint-utils "^3.0.0"
"@typescript-eslint/experimental-utils@^5.9.0":
version "5.53.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-5.53.0.tgz#e249e3a47ace290ea3d83a5a08c8d90cd7fe2a53"
integrity sha512-4SklZEwRn0jqkhtW+pPZpbKFXprwGneBndRM0TGzJu/LWdb9QV2hBgFIVU9AREo02BzqFvyG/ypd+xAW5YGhXw==
dependencies:
"@typescript-eslint/utils" "5.53.0"
"@typescript-eslint/parser@^4.28.0": "@typescript-eslint/parser@^4.28.0":
version "4.33.0" version "4.33.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.33.0.tgz#dfe797570d9694e560528d18eecad86c8c744899" resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.33.0.tgz#dfe797570d9694e560528d18eecad86c8c744899"
@ -1214,11 +1231,24 @@
"@typescript-eslint/types" "4.33.0" "@typescript-eslint/types" "4.33.0"
"@typescript-eslint/visitor-keys" "4.33.0" "@typescript-eslint/visitor-keys" "4.33.0"
"@typescript-eslint/scope-manager@5.53.0":
version "5.53.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.53.0.tgz#42b54f280e33c82939275a42649701024f3fafef"
integrity sha512-Opy3dqNsp/9kBBeCPhkCNR7fmdSQqA+47r21hr9a14Bx0xnkElEQmhoHga+VoaoQ6uDHjDKmQPIYcUcKJifS7w==
dependencies:
"@typescript-eslint/types" "5.53.0"
"@typescript-eslint/visitor-keys" "5.53.0"
"@typescript-eslint/types@4.33.0": "@typescript-eslint/types@4.33.0":
version "4.33.0" version "4.33.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.33.0.tgz#a1e59036a3b53ae8430ceebf2a919dc7f9af6d72" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.33.0.tgz#a1e59036a3b53ae8430ceebf2a919dc7f9af6d72"
integrity sha512-zKp7CjQzLQImXEpLt2BUw1tvOMPfNoTAfb8l51evhYbOEEzdWyQNmHWWGPR6hwKJDAi+1VXSBmnhL9kyVTTOuQ== integrity sha512-zKp7CjQzLQImXEpLt2BUw1tvOMPfNoTAfb8l51evhYbOEEzdWyQNmHWWGPR6hwKJDAi+1VXSBmnhL9kyVTTOuQ==
"@typescript-eslint/types@5.53.0":
version "5.53.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.53.0.tgz#f79eca62b97e518ee124086a21a24f3be267026f"
integrity sha512-5kcDL9ZUIP756K6+QOAfPkigJmCPHcLN7Zjdz76lQWWDdzfOhZDTj1irs6gPBKiXx5/6O3L0+AvupAut3z7D2A==
"@typescript-eslint/typescript-estree@4.33.0": "@typescript-eslint/typescript-estree@4.33.0":
version "4.33.0" version "4.33.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.33.0.tgz#0dfb51c2908f68c5c08d82aefeaf166a17c24609" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.33.0.tgz#0dfb51c2908f68c5c08d82aefeaf166a17c24609"
@ -1232,6 +1262,33 @@
semver "^7.3.5" semver "^7.3.5"
tsutils "^3.21.0" tsutils "^3.21.0"
"@typescript-eslint/typescript-estree@5.53.0":
version "5.53.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.53.0.tgz#bc651dc28cf18ab248ecd18a4c886c744aebd690"
integrity sha512-eKmipH7QyScpHSkhbptBBYh9v8FxtngLquq292YTEQ1pxVs39yFBlLC1xeIZcPPz1RWGqb7YgERJRGkjw8ZV7w==
dependencies:
"@typescript-eslint/types" "5.53.0"
"@typescript-eslint/visitor-keys" "5.53.0"
debug "^4.3.4"
globby "^11.1.0"
is-glob "^4.0.3"
semver "^7.3.7"
tsutils "^3.21.0"
"@typescript-eslint/utils@5.53.0":
version "5.53.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.53.0.tgz#e55eaad9d6fffa120575ffaa530c7e802f13bce8"
integrity sha512-VUOOtPv27UNWLxFwQK/8+7kvxVC+hPHNsJjzlJyotlaHjLSIgOCKj9I0DBUjwOOA64qjBwx5afAPjksqOxMO0g==
dependencies:
"@types/json-schema" "^7.0.9"
"@types/semver" "^7.3.12"
"@typescript-eslint/scope-manager" "5.53.0"
"@typescript-eslint/types" "5.53.0"
"@typescript-eslint/typescript-estree" "5.53.0"
eslint-scope "^5.1.1"
eslint-utils "^3.0.0"
semver "^7.3.7"
"@typescript-eslint/visitor-keys@4.33.0": "@typescript-eslint/visitor-keys@4.33.0":
version "4.33.0" version "4.33.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.33.0.tgz#2a22f77a41604289b7a186586e9ec48ca92ef1dd" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.33.0.tgz#2a22f77a41604289b7a186586e9ec48ca92ef1dd"
@ -1240,6 +1297,14 @@
"@typescript-eslint/types" "4.33.0" "@typescript-eslint/types" "4.33.0"
eslint-visitor-keys "^2.0.0" eslint-visitor-keys "^2.0.0"
"@typescript-eslint/visitor-keys@5.53.0":
version "5.53.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.53.0.tgz#8a5126623937cdd909c30d8fa72f79fa56cc1a9f"
integrity sha512-JqNLnX3leaHFZEN0gCh81sIvgrp/2GOACZNgO4+Tkf64u51kTpAyWFOY8XHx8XuXr3N2C9zgPPHtcpMg6z1g0w==
dependencies:
"@typescript-eslint/types" "5.53.0"
eslint-visitor-keys "^3.3.0"
"@wry/equality@^0.1.2": "@wry/equality@^0.1.2":
version "0.1.11" version "0.1.11"
resolved "https://registry.yarnpkg.com/@wry/equality/-/equality-0.1.11.tgz#35cb156e4a96695aa81a9ecc4d03787bc17f1790" resolved "https://registry.yarnpkg.com/@wry/equality/-/equality-0.1.11.tgz#35cb156e4a96695aa81a9ecc4d03787bc17f1790"
@ -2673,6 +2738,13 @@ eslint-plugin-promise@^5.1.0:
resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-5.1.0.tgz#fb2188fb734e4557993733b41aa1a688f46c6f24" resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-5.1.0.tgz#fb2188fb734e4557993733b41aa1a688f46c6f24"
integrity sha512-NGmI6BH5L12pl7ScQHbg7tvtk4wPxxj8yPHH47NvSmMtFneC077PSeY3huFj06ZWZvtbfxSPt3RuOQD5XcR4ng== integrity sha512-NGmI6BH5L12pl7ScQHbg7tvtk4wPxxj8yPHH47NvSmMtFneC077PSeY3huFj06ZWZvtbfxSPt3RuOQD5XcR4ng==
eslint-plugin-type-graphql@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-type-graphql/-/eslint-plugin-type-graphql-1.0.0.tgz#d348560ed628d6ca1dfcea35a02891432daafe6b"
integrity sha512-l6Yjcylavs88mcRZ3znwRuu8R9a8eoLdSaMGfycaMragf+VMxiz3kwjPmYz8AZxqqp8gvM7/2EGJqkkjM4NKIQ==
dependencies:
"@typescript-eslint/experimental-utils" "^5.9.0"
eslint-scope@^5.1.1: eslint-scope@^5.1.1:
version "5.1.1" version "5.1.1"
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c"
@ -2705,6 +2777,11 @@ eslint-visitor-keys@^2.0.0:
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303"
integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==
eslint-visitor-keys@^3.3.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826"
integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==
eslint@^7.29.0: eslint@^7.29.0:
version "7.32.0" version "7.32.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.32.0.tgz#c6d328a14be3fb08c8d1d21e12c02fdb7a2a812d" resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.32.0.tgz#c6d328a14be3fb08c8d1d21e12c02fdb7a2a812d"
@ -2916,6 +2993,17 @@ fast-glob@^3.1.1:
merge2 "^1.3.0" merge2 "^1.3.0"
micromatch "^4.0.4" micromatch "^4.0.4"
fast-glob@^3.2.9:
version "3.2.12"
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.12.tgz#7f39ec99c2e6ab030337142da9e0c18f37afae80"
integrity sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==
dependencies:
"@nodelib/fs.stat" "^2.0.2"
"@nodelib/fs.walk" "^1.2.3"
glob-parent "^5.1.2"
merge2 "^1.3.0"
micromatch "^4.0.4"
fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0: fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0:
version "2.1.0" version "2.1.0"
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633"
@ -3197,6 +3285,18 @@ globby@^11.0.3:
merge2 "^1.3.0" merge2 "^1.3.0"
slash "^3.0.0" slash "^3.0.0"
globby@^11.1.0:
version "11.1.0"
resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b"
integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==
dependencies:
array-union "^2.1.0"
dir-glob "^3.0.1"
fast-glob "^3.2.9"
ignore "^5.2.0"
merge2 "^1.4.1"
slash "^3.0.0"
got@^9.6.0: got@^9.6.0:
version "9.6.0" version "9.6.0"
resolved "https://registry.yarnpkg.com/got/-/got-9.6.0.tgz#edf45e7d67f99545705de1f7bbeeeb121765ed85" resolved "https://registry.yarnpkg.com/got/-/got-9.6.0.tgz#edf45e7d67f99545705de1f7bbeeeb121765ed85"
@ -3505,6 +3605,11 @@ ignore@^5.1.1, ignore@^5.1.4, ignore@^5.1.8:
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57"
integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw== integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==
ignore@^5.2.0:
version "5.2.4"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.4.tgz#a291c0c6178ff1b960befe47fcdec301674a6324"
integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==
import-fresh@^3.0.0, import-fresh@^3.2.1: import-fresh@^3.0.0, import-fresh@^3.2.1:
version "3.3.0" version "3.3.0"
resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b"
@ -3668,7 +3773,7 @@ is-generator-fn@^2.0.0:
resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118"
integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==
is-glob@^4.0.0, is-glob@^4.0.1, is-glob@~4.0.1: is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1:
version "4.0.3" version "4.0.3"
resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084"
integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==
@ -4690,7 +4795,7 @@ merge-stream@^2.0.0:
resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60"
integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==
merge2@^1.3.0: merge2@^1.3.0, merge2@^1.4.1:
version "1.4.1" version "1.4.1"
resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae"
integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==
@ -5760,6 +5865,13 @@ semver@^6.0.0, semver@^6.1.0, semver@^6.2.0, semver@^6.3.0:
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==
semver@^7.3.7:
version "7.3.8"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.8.tgz#07a78feafb3f7b32347d725e33de7e2a2df67798"
integrity sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==
dependencies:
lru-cache "^6.0.0"
send@0.17.1: send@0.17.1:
version "0.17.1" version "0.17.1"
resolved "https://registry.yarnpkg.com/send/-/send-0.17.1.tgz#c1d8b059f7900f7466dd4938bdc44e11ddb376c8" resolved "https://registry.yarnpkg.com/send/-/send-0.17.1.tgz#c1d8b059f7900f7466dd4938bdc44e11ddb376c8"

View File

@ -1,6 +1,6 @@
{ {
"name": "gradido-database", "name": "gradido-database",
"version": "1.19.0", "version": "1.19.1",
"description": "Gradido Database Tool to execute database migrations", "description": "Gradido Database Tool to execute database migrations",
"main": "src/index.ts", "main": "src/index.ts",
"repository": "https://github.com/gradido/gradido/database", "repository": "https://github.com/gradido/gradido/database",
@ -16,9 +16,7 @@
"dev_up": "cross-env TZ=UTC ts-node src/index.ts up", "dev_up": "cross-env TZ=UTC ts-node src/index.ts up",
"dev_down": "cross-env TZ=UTC ts-node src/index.ts down", "dev_down": "cross-env TZ=UTC ts-node src/index.ts down",
"dev_reset": "cross-env TZ=UTC ts-node src/index.ts reset", "dev_reset": "cross-env TZ=UTC ts-node src/index.ts reset",
"lint": "eslint --max-warnings=0 --ext .js,.ts .", "lint": "eslint --max-warnings=0 --ext .js,.ts ."
"seed:config": "ts-node ./node_modules/typeorm-seeding/dist/cli.js config",
"seed": "cross-env TZ=UTC ts-node src/index.ts seed"
}, },
"devDependencies": { "devDependencies": {
"@types/faker": "^5.5.9", "@types/faker": "^5.5.9",

View File

@ -56,7 +56,7 @@ export default defineConfig({
env: { env: {
backendURL: 'http://localhost:4000', backendURL: 'http://localhost:4000',
mailserverURL: 'http://localhost:1080', mailserverURL: 'http://localhost:1080',
loginQuery: `query ($email: String!, $password: String!, $publisherId: Int) { loginQuery: `mutation ($email: String!, $password: String!, $publisherId: Int) {
login(email: $email, password: $password, publisherId: $publisherId) { login(email: $email, password: $password, publisherId: $publisherId) {
email email
firstName firstName
@ -69,7 +69,8 @@ export default defineConfig({
hasElopage hasElopage
publisherId publisherId
isAdmin isAdmin
creation hideAmountGDD
hideAmountGDT
__typename __typename
} }
}`, }`,

View File

@ -5,13 +5,13 @@ Feature: User Authentication - reset password
# TODO for these pre-conditions utilize seeding or API check, if user exists in test system # TODO for these pre-conditions utilize seeding or API check, if user exists in test system
# Background: # Background:
# Given the following "users" are in the database: # Given the following "users" are in the database:
# | email | password | name | # | email | password | name |
# | bibi@bloxberg.de | Aa12345_ | Bibi Bloxberg | # | raeuber@hotzenplotz.de | Aa12345_ | Räuber Hotzenplotz |
Scenario: Reset password from signin page successfully Scenario: Reset password from signin page successfully
Given the user navigates to page "/login" Given the user navigates to page "/login"
And the user navigates to the forgot password page And the user navigates to the forgot password page
When the user enters the e-mail address "bibi@bloxberg.de" When the user enters the e-mail address "raeuber@hotzenplotz.de"
And the user submits the e-mail form And the user submits the e-mail form
Then the user receives an e-mail containing the "password reset" link Then the user receives an e-mail containing the "password reset" link
When the user opens the "password reset" link in the browser When the user opens the "password reset" link in the browser
@ -19,7 +19,7 @@ Feature: User Authentication - reset password
And the user repeats the password "12345Aa_" And the user repeats the password "12345Aa_"
And the user submits the password form And the user submits the password form
And the user clicks the sign in button And the user clicks the sign in button
Then the user submits the credentials "bibi@bloxberg.de" "Aa12345_" Then the user submits the credentials "raeuber@hotzenplotz.de" "Aa12345_"
And the user cannot login And the user cannot login
But the user submits the credentials "bibi@bloxberg.de" "12345Aa_" But the user submits the credentials "raeuber@hotzenplotz.de" "12345Aa_"
And the user is logged in with username "Bibi Bloxberg" And the user is logged in with username "Räuber Hotzenplotz"

View File

@ -5,14 +5,14 @@ Feature: User profile - change password
Background: Background:
# TODO for these pre-conditions utilize seeding or API check, if user exists in test system # TODO for these pre-conditions utilize seeding or API check, if user exists in test system
# Given the following "users" are in the database: # Given the following "users" are in the database:
# | email | password | name | # | email | password | name |
# | bibi@bloxberg.de | Aa12345_ | Bibi Bloxberg | | # | bob@baumeister.de | Aa12345_ | Bob der Baumeister |
# TODO instead of credentials use the name of an user object (see seeds in backend) # TODO instead of credentials use the name of an user object (see seeds in backend)
Given the user is logged in as "bibi@bloxberg.de" "Aa12345_" Given the user is logged in as "bob@baumeister.de" "Aa12345_"
Scenario: Change password successfully Scenario: Change password successfully
Given the user navigates to page "/profile" Given the user navigates to page "/settings"
And the user opens the change password menu And the user opens the change password menu
When the user fills the password form with: When the user fills the password form with:
| Old password | Aa12345_ | | Old password | Aa12345_ |
@ -21,7 +21,7 @@ Feature: User profile - change password
And the user submits the password form And the user submits the password form
And the user is presented a "success" message And the user is presented a "success" message
And the user logs out And the user logs out
Then the user submits the credentials "bibi@bloxberg.de" "Aa12345_" Then the user submits the credentials "bob@baumeister.de" "Aa12345_"
And the user cannot login And the user cannot login
But the user submits the credentials "bibi@bloxberg.de" "12345Aa_" But the user submits the credentials "bob@baumeister.de" "12345Aa_"
And the user is logged in with username "Bibi Bloxberg" And the user is logged in with username "Bob der Baumeister"

View File

@ -11,7 +11,7 @@ export class SideNavMenu {
} }
logout() { logout() {
cy.get(this.logoutMenu).click() cy.get('.main-sidebar').find(this.logoutMenu).click()
return this return this
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "bootstrap-vue-gradido-wallet", "name": "bootstrap-vue-gradido-wallet",
"version": "1.19.0", "version": "1.19.1",
"private": true, "private": true,
"scripts": { "scripts": {
"start": "node run/server.js", "start": "node run/server.js",

View File

@ -25,7 +25,11 @@
</div> </div>
<div class="mt-3 font-weight-bold">{{ $t('contributionText') }}</div> <div class="mt-3 font-weight-bold">{{ $t('contributionText') }}</div>
<div class="mb-3 text-break word-break">{{ memo }}</div> <div class="mb-3 text-break word-break">{{ memo }}</div>
<div v-if="state === 'IN_PROGRESS' && !allContribution" class="text-205"> <div
v-if="state === 'IN_PROGRESS'"
class="text-205 pointer hover-font-bold"
@click="visible = !visible"
>
{{ $t('contribution.alert.answerQuestion') }} {{ $t('contribution.alert.answerQuestion') }}
</div> </div>
</b-col> </b-col>

View File

@ -49,15 +49,15 @@ describe('Sidebar', () => {
expect(wrapper.findAll('.nav-item').at(2).text()).toEqual('navigation.transactions') expect(wrapper.findAll('.nav-item').at(2).text()).toEqual('navigation.transactions')
}) })
it('has nav-item "gdt.gdt" in navbar', () => { it('has nav-item "creation" in navbar', () => {
expect(wrapper.findAll('.nav-item').at(3).text()).toEqual('creation') expect(wrapper.findAll('.nav-item').at(3).text()).toEqual('creation')
}) })
it('has nav-item "creation" in navbar', () => { it('has nav-item "GDT" in navbar', () => {
expect(wrapper.findAll('.nav-item').at(4).text()).toContain('GDT') expect(wrapper.findAll('.nav-item').at(4).text()).toContain('GDT')
}) })
it('has nav-item "Information" in navbar', () => { it('has nav-item "navigation.info" in navbar', () => {
expect(wrapper.findAll('.nav-item').at(5).text()).toContain('navigation.info') expect(wrapper.findAll('.nav-item').at(5).text()).toContain('navigation.info')
}) })
}) })
@ -68,13 +68,13 @@ describe('Sidebar', () => {
expect(wrapper.findAll('ul').at(1).findAll('.nav-item')).toHaveLength(2) expect(wrapper.findAll('ul').at(1).findAll('.nav-item')).toHaveLength(2)
}) })
it('has nav-item "navigation.info" in navbar', () => { it('has nav-item "navigation.settings" in navbar', () => {
expect(wrapper.findAll('ul').at(1).findAll('.nav-item').at(0).text()).toEqual( expect(wrapper.findAll('ul').at(1).findAll('.nav-item').at(0).text()).toEqual(
'navigation.settings', 'navigation.settings',
) )
}) })
it('has nav-item "navigation.settings" in navbar', () => { it('has nav-item "navigation.logout" in navbar', () => {
expect(wrapper.findAll('ul').at(1).findAll('.nav-item').at(1).text()).toEqual( expect(wrapper.findAll('ul').at(1).findAll('.nav-item').at(1).text()).toEqual(
'navigation.logout', 'navigation.logout',
) )

Some files were not shown because too many files have changed in this diff Show More