diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5eadf1e94..2816e00f4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -281,7 +281,7 @@ jobs: # LINT BACKEND ########################################################### ########################################################################## - name: backend | Lint - run: cd backend && yarn && yarn run lint + run: cd database && yarn && cd ../backend && yarn && yarn run lint ############################################################################## # JOB: LOCALES BACKEND ####################################################### @@ -550,7 +550,7 @@ jobs: run: | cd e2e-tests/ 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 if: ${{ failure() && steps.e2e-tests.conclusion == 'failure' }} uses: actions/upload-artifact@v3 diff --git a/CHANGELOG.md b/CHANGELOG.md index ce3bd4a10..8dc91f2fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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). +#### [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) +> 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) - 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) diff --git a/admin/package.json b/admin/package.json index 2b9f3032f..10399739d 100644 --- a/admin/package.json +++ b/admin/package.json @@ -3,7 +3,7 @@ "description": "Administraion Interface for Gradido", "main": "index.js", "author": "Moriz Wahl", - "version": "1.19.0", + "version": "1.19.1", "license": "Apache-2.0", "private": false, "scripts": { diff --git a/admin/src/graphql/adminCreateContributionMessage.js b/admin/src/graphql/adminCreateContributionMessage.js index 25d81f151..747e6d7d4 100644 --- a/admin/src/graphql/adminCreateContributionMessage.js +++ b/admin/src/graphql/adminCreateContributionMessage.js @@ -1,7 +1,7 @@ import gql from 'graphql-tag' export const adminCreateContributionMessage = gql` - mutation ($contributionId: Float!, $message: String!) { + mutation ($contributionId: Int!, $message: String!) { adminCreateContributionMessage(contributionId: $contributionId, message: $message) { id message diff --git a/admin/src/graphql/listContributionMessages.js b/admin/src/graphql/listContributionMessages.js index c3ffdb0b9..a311598e2 100644 --- a/admin/src/graphql/listContributionMessages.js +++ b/admin/src/graphql/listContributionMessages.js @@ -1,7 +1,7 @@ import gql from 'graphql-tag' 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( contributionId: $contributionId pageSize: $pageSize diff --git a/admin/src/pages/CreationConfirm.vue b/admin/src/pages/CreationConfirm.vue index 3f0b2d87f..55caf8677 100644 --- a/admin/src/pages/CreationConfirm.vue +++ b/admin/src/pages/CreationConfirm.vue @@ -410,6 +410,9 @@ export default { update({ adminListAllContributions }) { this.rows = adminListAllContributions.contributionCount this.items = adminListAllContributions.contributionList + if (this.statusFilter === FILTER_TAB_MAP[0]) { + this.$store.commit('setOpenCreations', adminListAllContributions.contributionCount) + } }, error({ message }) { this.toastError(message) diff --git a/backend/.env.test_e2e b/backend/.env.test_e2e index a5cdc4bfd..99d6c14d5 100644 --- a/backend/.env.test_e2e +++ b/backend/.env.test_e2e @@ -1,5 +1,5 @@ # Server -JWT_EXPIRES_IN=1m +JWT_EXPIRES_IN=2m # Email EMAIL=true diff --git a/backend/.eslintrc.js b/backend/.eslintrc.js index f213be8c6..096e4d60a 100644 --- a/backend/.eslintrc.js +++ b/backend/.eslintrc.js @@ -2,16 +2,10 @@ module.exports = { root: true, env: { node: true, - // jest: true, }, parser: '@typescript-eslint/parser', - plugins: ['prettier', '@typescript-eslint' /*, 'jest' */], - extends: [ - 'standard', - 'eslint:recommended', - 'plugin:prettier/recommended', - 'plugin:@typescript-eslint/recommended', - ], + plugins: ['prettier', '@typescript-eslint', 'type-graphql'], + extends: ['standard', 'eslint:recommended', 'plugin:prettier/recommended'], // add your custom rules here rules: { '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, + }, + }, + ], } diff --git a/backend/package.json b/backend/package.json index 08a9bf54d..dab5e50af 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "gradido-backend", - "version": "1.19.0", + "version": "1.19.1", "description": "Gradido unified backend providing an API-Service for Gradido Transactions", "main": "src/index.ts", "repository": "https://github.com/gradido/gradido/backend", @@ -65,6 +65,7 @@ "eslint-plugin-node": "^11.1.0", "eslint-plugin-prettier": "^3.4.0", "eslint-plugin-promise": "^5.1.0", + "eslint-plugin-type-graphql": "^1.0.0", "faker": "^5.5.3", "jest": "^27.2.4", "nodemon": "^2.0.7", diff --git a/backend/src/apis/HttpRequest.ts b/backend/src/apis/HttpRequest.ts index 4039e3a98..eff0c408a 100644 --- a/backend/src/apis/HttpRequest.ts +++ b/backend/src/apis/HttpRequest.ts @@ -1,16 +1,19 @@ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ import axios from 'axios' import { backendLogger as logger } from '@/server/logger' +import LogError from '@/server/LogError' // eslint-disable-next-line @typescript-eslint/no-explicit-any export const apiPost = async (url: string, payload: unknown): Promise => { - logger.trace('POST: url=' + url + ' payload=' + payload) + logger.trace('POST', url, payload) return axios .post(url, payload) .then((result) => { - logger.trace('POST-Response: result=' + result) + logger.trace('POST-Response', result) if (result.status !== 200) { - throw new Error('HTTP Status Error ' + result.status) + throw new LogError('HTTP Status Error', result.status) } if (result.data.state !== 'success') { throw new Error(result.data.msg) @@ -28,9 +31,9 @@ export const apiGet = async (url: string): Promise => { return axios .get(url) .then((result) => { - logger.trace('GET-Response: result=' + result) + logger.trace('GET-Response', result) if (result.status !== 200) { - throw new Error('HTTP Status Error ' + result.status) + throw new LogError('HTTP Status Error', result.status) } if (!['success', 'warning'].includes(result.data.state)) { throw new Error(result.data.msg) diff --git a/backend/src/apis/KlicktippController.ts b/backend/src/apis/KlicktippController.ts index 824d40af2..fe9ad563a 100644 --- a/backend/src/apis/KlicktippController.ts +++ b/backend/src/apis/KlicktippController.ts @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ import { KlicktippConnector } from './klicktippConnector' diff --git a/backend/src/apis/klicktippConnector.ts b/backend/src/apis/klicktippConnector.ts index b084112ae..0ff741604 100644 --- a/backend/src/apis/klicktippConnector.ts +++ b/backend/src/apis/klicktippConnector.ts @@ -1,3 +1,7 @@ +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ import axios, { AxiosRequestConfig, Method } from 'axios' diff --git a/backend/src/auth/RIGHTS.ts b/backend/src/auth/RIGHTS.ts index 8b0e82c86..22be48e40 100644 --- a/backend/src/auth/RIGHTS.ts +++ b/backend/src/auth/RIGHTS.ts @@ -54,4 +54,5 @@ export enum RIGHTS { UPDATE_CONTRIBUTION_LINK = 'UPDATE_CONTRIBUTION_LINK', ADMIN_CREATE_CONTRIBUTION_MESSAGE = 'ADMIN_CREATE_CONTRIBUTION_MESSAGE', DENY_CONTRIBUTION = 'DENY_CONTRIBUTION', + ADMIN_OPEN_CREATIONS = 'ADMIN_OPEN_CREATIONS', } diff --git a/backend/src/emails/sendEmailTranslated.test.ts b/backend/src/emails/sendEmailTranslated.test.ts index 79ba1cd77..f3c75a7a6 100644 --- a/backend/src/emails/sendEmailTranslated.test.ts +++ b/backend/src/emails/sendEmailTranslated.test.ts @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/unbound-method */ import { createTransport } from 'nodemailer' import { logger, i18n } from '@test/testSetup' import CONFIG from '@/config' diff --git a/backend/src/emails/sendEmailTranslated.ts b/backend/src/emails/sendEmailTranslated.ts index 9fa8af73f..d8ecd3d38 100644 --- a/backend/src/emails/sendEmailTranslated.ts +++ b/backend/src/emails/sendEmailTranslated.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ import CONFIG from '@/config' import { backendLogger as logger } from '@/server/logger' import path from 'path' diff --git a/backend/src/emails/sendEmailVariants.test.ts b/backend/src/emails/sendEmailVariants.test.ts index 9f30a8ce1..21c10bdad 100644 --- a/backend/src/emails/sendEmailVariants.test.ts +++ b/backend/src/emails/sendEmailVariants.test.ts @@ -1,5 +1,8 @@ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-explicit-any */ - +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ import Decimal from 'decimal.js-light' import { testEnvironment } from '@test/helpers' import { logger, i18n as localization } from '@test/testSetup' diff --git a/backend/src/federation/client/1_0/FederationClient.ts b/backend/src/federation/client/1_0/FederationClient.ts index 1c0ec4996..d4ed5960b 100644 --- a/backend/src/federation/client/1_0/FederationClient.ts +++ b/backend/src/federation/client/1_0/FederationClient.ts @@ -1,3 +1,6 @@ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ import { gql } from 'graphql-request' import { backendLogger as logger } from '@/server/logger' import { Community as DbCommunity } from '@entity/Community' diff --git a/backend/src/federation/client/1_1/FederationClient.ts b/backend/src/federation/client/1_1/FederationClient.ts index 1c0ec4996..122fcf5dc 100644 --- a/backend/src/federation/client/1_1/FederationClient.ts +++ b/backend/src/federation/client/1_1/FederationClient.ts @@ -1,3 +1,6 @@ +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ import { gql } from 'graphql-request' import { backendLogger as logger } from '@/server/logger' import { Community as DbCommunity } from '@entity/Community' diff --git a/backend/src/federation/validateCommunities.test.ts b/backend/src/federation/validateCommunities.test.ts index 4899a2987..599564ea6 100644 --- a/backend/src/federation/validateCommunities.test.ts +++ b/backend/src/federation/validateCommunities.test.ts @@ -1,3 +1,7 @@ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/unbound-method */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ @@ -150,7 +154,8 @@ describe('validate Communities', () => { }) it('logs unsupported api for community with api 2_0 ', () => { 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'], ) }) }) diff --git a/backend/src/federation/validateCommunities.ts b/backend/src/federation/validateCommunities.ts index f5a0c50ac..157d83bb5 100644 --- a/backend/src/federation/validateCommunities.ts +++ b/backend/src/federation/validateCommunities.ts @@ -8,14 +8,14 @@ import { backendLogger as logger } from '@/server/logger' import { ApiVersionType } from './enum/apiVersionType' import LogError from '@/server/LogError' -export async function startValidateCommunities(timerInterval: number): Promise { +export function startValidateCommunities(timerInterval: number): void { logger.info( `Federation: startValidateCommunities loop with an interval of ${timerInterval} ms...`, ) // TODO: replace the timer-loop by an event-based communication to verify announced foreign communities // better to use setTimeout twice than setInterval once -> see https://javascript.info/settimeout-setinterval setTimeout(function run() { - validateCommunities() + void validateCommunities() setTimeout(run, timerInterval) }, timerInterval) } @@ -27,8 +27,8 @@ export async function validateCommunities(): Promise { .getMany() logger.debug(`Federation: found ${dbCommunities.length} dbCommunities`) - dbCommunities.forEach(async function (dbCom) { - logger.debug(`Federation: dbCom: ${JSON.stringify(dbCom)}`) + for (const dbCom of dbCommunities) { + logger.debug('Federation: dbCom', dbCom) const apiValueStrings: string[] = Object.values(ApiVersionType) logger.debug(`suppported ApiVersions=`, apiValueStrings) if (apiValueStrings.includes(dbCom.apiVersion)) { @@ -38,11 +38,13 @@ export async function validateCommunities(): Promise { try { const pubKey = await invokeVersionedRequestGetPublicKey(dbCom) logger.info( - `Federation: received publicKey=${pubKey} from endpoint=${dbCom.endPoint}/${dbCom.apiVersion}`, + 'Federation: received publicKey from endpoint', + pubKey, + `${dbCom.endPoint}/${dbCom.apiVersion}`, ) if (pubKey && pubKey === dbCom.publicKey.toString('hex')) { logger.info(`Federation: matching publicKey: ${pubKey}`) - DbCommunity.update({ id: dbCom.id }, { verifiedAt: new Date() }) + await DbCommunity.update({ id: dbCom.id }, { verifiedAt: new Date() }) logger.debug(`Federation: updated dbCom: ${JSON.stringify(dbCom)}`) } /* @@ -58,10 +60,11 @@ export async function validateCommunities(): Promise { } } else { logger.warn( - `Federation: dbCom: ${dbCom.id} with unsupported apiVersion=${dbCom.apiVersion}; supported versions=${apiValueStrings}`, + `Federation: dbCom: ${dbCom.id} with unsupported apiVersion=${dbCom.apiVersion}; supported versions`, + apiValueStrings, ) } - }) + } } function isLogError(err: unknown) { diff --git a/backend/src/graphql/arg/ContributionLinkArgs.ts b/backend/src/graphql/arg/ContributionLinkArgs.ts index 7344a28ff..cf0465501 100644 --- a/backend/src/graphql/arg/ContributionLinkArgs.ts +++ b/backend/src/graphql/arg/ContributionLinkArgs.ts @@ -22,7 +22,7 @@ export default class ContributionLinkArgs { validTo?: string | null @Field(() => Decimal, { nullable: true }) - maxAmountPerMonth: Decimal | null + maxAmountPerMonth?: Decimal | null @Field(() => Int) maxPerCycle: number diff --git a/backend/src/graphql/arg/ContributionMessageArgs.ts b/backend/src/graphql/arg/ContributionMessageArgs.ts index dd75baed0..8b44756a6 100644 --- a/backend/src/graphql/arg/ContributionMessageArgs.ts +++ b/backend/src/graphql/arg/ContributionMessageArgs.ts @@ -1,9 +1,9 @@ -import { ArgsType, Field, InputType } from 'type-graphql' +import { ArgsType, Field, Int, InputType } from 'type-graphql' @InputType() @ArgsType() export default class ContributionMessageArgs { - @Field(() => Number) + @Field(() => Int) contributionId: number @Field(() => String) diff --git a/backend/src/graphql/arg/CreateUserArgs.ts b/backend/src/graphql/arg/CreateUserArgs.ts index af915b91a..56acfd63d 100644 --- a/backend/src/graphql/arg/CreateUserArgs.ts +++ b/backend/src/graphql/arg/CreateUserArgs.ts @@ -11,11 +11,11 @@ export default class CreateUserArgs { @Field(() => String) lastName: string - @Field(() => String) - language?: string // Will default to DEFAULT_LANGUAGE + @Field(() => String, { nullable: true }) + language?: string | null @Field(() => Int, { nullable: true }) - publisherId: number + publisherId?: number | null @Field(() => String, { nullable: true }) redeemCode?: string | null diff --git a/backend/src/graphql/arg/Paginated.ts b/backend/src/graphql/arg/Paginated.ts index 97326caf2..290dba337 100644 --- a/backend/src/graphql/arg/Paginated.ts +++ b/backend/src/graphql/arg/Paginated.ts @@ -1,3 +1,4 @@ +/* eslint-disable type-graphql/invalid-nullable-input-type */ import { ArgsType, Field, Int } from 'type-graphql' import { Order } from '@enum/Order' diff --git a/backend/src/graphql/arg/SearchUsersArgs.ts b/backend/src/graphql/arg/SearchUsersArgs.ts index 38057762d..39996efca 100644 --- a/backend/src/graphql/arg/SearchUsersArgs.ts +++ b/backend/src/graphql/arg/SearchUsersArgs.ts @@ -7,11 +7,14 @@ export default class SearchUsersArgs { searchText: string @Field(() => Int, { nullable: true }) + // eslint-disable-next-line type-graphql/invalid-nullable-input-type currentPage?: number @Field(() => Int, { nullable: true }) + // eslint-disable-next-line type-graphql/invalid-nullable-input-type pageSize?: number + // eslint-disable-next-line type-graphql/wrong-decorator-signature @Field(() => SearchUsersFilters, { nullable: true, defaultValue: null }) - filters: SearchUsersFilters + filters?: SearchUsersFilters | null } diff --git a/backend/src/graphql/arg/SearchUsersFilters.ts b/backend/src/graphql/arg/SearchUsersFilters.ts index dc19d456c..efcdfa00d 100644 --- a/backend/src/graphql/arg/SearchUsersFilters.ts +++ b/backend/src/graphql/arg/SearchUsersFilters.ts @@ -3,8 +3,8 @@ import { Field, InputType } from 'type-graphql' @InputType() export default class SearchUsersFilters { @Field(() => Boolean, { nullable: true, defaultValue: null }) - byActivated: boolean + byActivated?: boolean | null @Field(() => Boolean, { nullable: true, defaultValue: null }) - byDeleted: boolean + byDeleted?: boolean | null } diff --git a/backend/src/graphql/arg/TransactionLinkFilters.ts b/backend/src/graphql/arg/TransactionLinkFilters.ts index 291d244c3..13d630d17 100644 --- a/backend/src/graphql/arg/TransactionLinkFilters.ts +++ b/backend/src/graphql/arg/TransactionLinkFilters.ts @@ -1,13 +1,14 @@ +/* eslint-disable type-graphql/invalid-nullable-input-type */ import { Field, InputType } from 'type-graphql' @InputType() export default class TransactionLinkFilters { @Field(() => Boolean, { nullable: true }) - withDeleted: boolean + withDeleted?: boolean @Field(() => Boolean, { nullable: true }) - withExpired: boolean + withExpired?: boolean @Field(() => Boolean, { nullable: true }) - withRedeemed: boolean + withRedeemed?: boolean } diff --git a/backend/src/graphql/arg/UnsecureLoginArgs.ts b/backend/src/graphql/arg/UnsecureLoginArgs.ts index ac69e7441..a2a7bb683 100644 --- a/backend/src/graphql/arg/UnsecureLoginArgs.ts +++ b/backend/src/graphql/arg/UnsecureLoginArgs.ts @@ -9,5 +9,5 @@ export default class UnsecureLoginArgs { password: string @Field(() => Int, { nullable: true }) - publisherId: number + publisherId?: number | null } diff --git a/backend/src/graphql/arg/UpdateUserInfosArgs.ts b/backend/src/graphql/arg/UpdateUserInfosArgs.ts index b45539487..985d3fed6 100644 --- a/backend/src/graphql/arg/UpdateUserInfosArgs.ts +++ b/backend/src/graphql/arg/UpdateUserInfosArgs.ts @@ -1,4 +1,4 @@ -import { ArgsType, Field } from 'type-graphql' +import { ArgsType, Field, Int } from 'type-graphql' @ArgsType() export default class UpdateUserInfosArgs { @@ -11,8 +11,8 @@ export default class UpdateUserInfosArgs { @Field({ nullable: true }) language?: string - @Field({ nullable: true }) - publisherId?: number + @Field(() => Int, { nullable: true }) + publisherId?: number | null @Field({ nullable: true }) password?: string diff --git a/backend/src/graphql/directive/isAuthorized.ts b/backend/src/graphql/directive/isAuthorized.ts index 59daa89f1..709f470d4 100644 --- a/backend/src/graphql/directive/isAuthorized.ts +++ b/backend/src/graphql/directive/isAuthorized.ts @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-explicit-any */ import { AuthChecker } from 'type-graphql' diff --git a/backend/src/graphql/model/Balance.ts b/backend/src/graphql/model/Balance.ts index f04b235ee..9b54f6987 100644 --- a/backend/src/graphql/model/Balance.ts +++ b/backend/src/graphql/model/Balance.ts @@ -1,4 +1,4 @@ -import { ObjectType, Field } from 'type-graphql' +import { ObjectType, Field, Int, Float } from 'type-graphql' import Decimal from 'decimal.js-light' @ObjectType() @@ -19,14 +19,14 @@ export class Balance { @Field(() => Decimal) balance: Decimal - @Field(() => Number, { nullable: true }) + @Field(() => Float, { nullable: true }) balanceGDT: number | null // the count of all transactions - @Field(() => Number) + @Field(() => Int) count: number // the count of transaction links - @Field(() => Number) + @Field(() => Int) linkCount: number } diff --git a/backend/src/graphql/model/Community.ts b/backend/src/graphql/model/Community.ts index 466028d00..0cd1926f5 100644 --- a/backend/src/graphql/model/Community.ts +++ b/backend/src/graphql/model/Community.ts @@ -1,6 +1,8 @@ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ -import { ObjectType, Field } from 'type-graphql' +import { ObjectType, Field, Int } from 'type-graphql' @ObjectType() export class Community { @@ -14,7 +16,7 @@ export class Community { } } - @Field(() => Number) + @Field(() => Int) id: number @Field(() => String) diff --git a/backend/src/graphql/model/CommunityStatistics.ts b/backend/src/graphql/model/CommunityStatistics.ts index 87ef595af..4864b630d 100644 --- a/backend/src/graphql/model/CommunityStatistics.ts +++ b/backend/src/graphql/model/CommunityStatistics.ts @@ -1,9 +1,9 @@ -import { ObjectType, Field } from 'type-graphql' +import { ObjectType, Field, Int } from 'type-graphql' import Decimal from 'decimal.js-light' @ObjectType() export class DynamicStatisticsFields { - @Field(() => Number) + @Field(() => Int) activeUsers: number @Field(() => Decimal) @@ -15,13 +15,13 @@ export class DynamicStatisticsFields { @ObjectType() export class CommunityStatistics { - @Field(() => Number) + @Field(() => Int) allUsers: number - @Field(() => Number) + @Field(() => Int) totalUsers: number - @Field(() => Number) + @Field(() => Int) deletedUsers: number @Field(() => Decimal) diff --git a/backend/src/graphql/model/Contribution.ts b/backend/src/graphql/model/Contribution.ts index b966b714e..a683534af 100644 --- a/backend/src/graphql/model/Contribution.ts +++ b/backend/src/graphql/model/Contribution.ts @@ -23,7 +23,7 @@ export class Contribution { this.deletedBy = contribution.deletedBy } - @Field(() => Number) + @Field(() => Int) id: number @Field(() => String, { nullable: true }) @@ -44,25 +44,25 @@ export class Contribution { @Field(() => Date, { nullable: true }) confirmedAt: Date | null - @Field(() => Number, { nullable: true }) + @Field(() => Int, { nullable: true }) confirmedBy: number | null @Field(() => Date, { nullable: true }) deniedAt: Date | null - @Field(() => Number, { nullable: true }) + @Field(() => Int, { nullable: true }) deniedBy: number | null @Field(() => Date, { nullable: true }) deletedAt: Date | null - @Field(() => Number, { nullable: true }) + @Field(() => Int, { nullable: true }) deletedBy: number | null @Field(() => Date) contributionDate: Date - @Field(() => Number) + @Field(() => Int) messagesCount: number @Field(() => String) diff --git a/backend/src/graphql/model/ContributionLink.ts b/backend/src/graphql/model/ContributionLink.ts index 9fe9eccd6..7a06f8dff 100644 --- a/backend/src/graphql/model/ContributionLink.ts +++ b/backend/src/graphql/model/ContributionLink.ts @@ -21,7 +21,7 @@ export class ContributionLink { this.link = CONFIG.COMMUNITY_REDEEM_CONTRIBUTION_URL.replace(/{code}/g, this.code) } - @Field(() => Number) + @Field(() => Int) id: number @Field(() => Decimal) diff --git a/backend/src/graphql/model/ContributionLinkList.ts b/backend/src/graphql/model/ContributionLinkList.ts index 412d0bf7b..d2c347b27 100644 --- a/backend/src/graphql/model/ContributionLinkList.ts +++ b/backend/src/graphql/model/ContributionLinkList.ts @@ -1,4 +1,4 @@ -import { ObjectType, Field } from 'type-graphql' +import { ObjectType, Field, Int } from 'type-graphql' import { ContributionLink } from '@model/ContributionLink' @ObjectType() @@ -6,6 +6,6 @@ export class ContributionLinkList { @Field(() => [ContributionLink]) links: ContributionLink[] - @Field(() => Number) + @Field(() => Int) count: number } diff --git a/backend/src/graphql/model/ContributionMessage.ts b/backend/src/graphql/model/ContributionMessage.ts index d757db136..6bd6a4715 100644 --- a/backend/src/graphql/model/ContributionMessage.ts +++ b/backend/src/graphql/model/ContributionMessage.ts @@ -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 { User } from '@entity/User' @@ -16,7 +16,7 @@ export class ContributionMessage { this.isModerator = contributionMessage.isModerator } - @Field(() => Number) + @Field(() => Int) id: number @Field(() => String) @@ -26,7 +26,7 @@ export class ContributionMessage { createdAt: Date @Field(() => Date, { nullable: true }) - updatedAt?: Date | null + updatedAt: Date | null @Field(() => String) type: string @@ -37,7 +37,7 @@ export class ContributionMessage { @Field(() => String, { nullable: true }) userLastName: string | null - @Field(() => Number, { nullable: true }) + @Field(() => Int, { nullable: true }) userId: number | null @Field(() => Boolean) @@ -45,7 +45,7 @@ export class ContributionMessage { } @ObjectType() export class ContributionMessageListResult { - @Field(() => Number) + @Field(() => Int) count: number @Field(() => [ContributionMessage]) diff --git a/backend/src/graphql/model/GdtEntry.ts b/backend/src/graphql/model/GdtEntry.ts index 43529fb06..bbf1cceef 100644 --- a/backend/src/graphql/model/GdtEntry.ts +++ b/backend/src/graphql/model/GdtEntry.ts @@ -1,6 +1,8 @@ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ -import { ObjectType, Field } from 'type-graphql' +import { ObjectType, Field, Float, Int } from 'type-graphql' import { GdtEntryType } from '@enum/GdtEntryType' @ObjectType() @@ -19,10 +21,10 @@ export class GdtEntry { this.gdt = json.gdt } - @Field(() => Number) + @Field(() => Int) id: number - @Field(() => Number) + @Field(() => Float) amount: number @Field(() => String) @@ -40,15 +42,15 @@ export class GdtEntry { @Field(() => GdtEntryType) gdtEntryType: GdtEntryType - @Field(() => Number) + @Field(() => Float) factor: number - @Field(() => Number) + @Field(() => Float) amount2: number - @Field(() => Number) + @Field(() => Float) factor2: number - @Field(() => Number) + @Field(() => Float) gdt: number } diff --git a/backend/src/graphql/model/GdtEntryList.ts b/backend/src/graphql/model/GdtEntryList.ts index 9d529b6f3..7c4bffb5a 100644 --- a/backend/src/graphql/model/GdtEntryList.ts +++ b/backend/src/graphql/model/GdtEntryList.ts @@ -1,7 +1,10 @@ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ import { GdtEntry } from './GdtEntry' -import { ObjectType, Field } from 'type-graphql' +import { ObjectType, Field, Int, Float } from 'type-graphql' @ObjectType() export class GdtEntryList { @@ -16,15 +19,15 @@ export class GdtEntryList { @Field(() => String) state: string - @Field(() => Number) + @Field(() => Int) count: number @Field(() => [GdtEntry], { nullable: true }) - gdtEntries?: GdtEntry[] + gdtEntries: GdtEntry[] | null - @Field(() => Number) + @Field(() => Float) gdtSum: number - @Field(() => Number) + @Field(() => Float) timeUsed: number } diff --git a/backend/src/graphql/model/KlickTipp.ts b/backend/src/graphql/model/KlickTipp.ts index a7dd9eead..059c7874d 100644 --- a/backend/src/graphql/model/KlickTipp.ts +++ b/backend/src/graphql/model/KlickTipp.ts @@ -1,4 +1,5 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ import { ObjectType, Field } from 'type-graphql' diff --git a/backend/src/graphql/model/Transaction.ts b/backend/src/graphql/model/Transaction.ts index a7329bcef..96b80f9a0 100644 --- a/backend/src/graphql/model/Transaction.ts +++ b/backend/src/graphql/model/Transaction.ts @@ -1,4 +1,4 @@ -import { ObjectType, Field } from 'type-graphql' +import { ObjectType, Field, Int } from 'type-graphql' import { Decay } from './Decay' import { Transaction as dbTransaction } from '@entity/Transaction' import Decimal from 'decimal.js-light' @@ -41,19 +41,19 @@ export class Transaction { this.memo = transaction.memo this.creationDate = transaction.creationDate this.linkedUser = linkedUser - this.linkedTransactionId = transaction.linkedTransactionId + this.linkedTransactionId = transaction.linkedTransactionId || null this.linkId = transaction.contribution ? transaction.contribution.contributionLinkId - : transaction.transactionLinkId + : transaction.transactionLinkId || null } - @Field(() => Number) + @Field(() => Int) id: number @Field(() => User) user: User - @Field(() => Number, { nullable: true }) + @Field(() => Int, { nullable: true }) previous: number | null @Field(() => TransactionTypeId) @@ -80,10 +80,10 @@ export class Transaction { @Field(() => User, { nullable: true }) linkedUser: User | null - @Field(() => Number, { nullable: true }) - linkedTransactionId?: number | null + @Field(() => Int, { nullable: true }) + linkedTransactionId: number | null // Links to the TransactionLink/ContributionLink when transaction was created by a link - @Field(() => Number, { nullable: true }) - linkId?: number | null + @Field(() => Int, { nullable: true }) + linkId: number | null } diff --git a/backend/src/graphql/model/TransactionLink.ts b/backend/src/graphql/model/TransactionLink.ts index 416527ec9..b0a8ab184 100644 --- a/backend/src/graphql/model/TransactionLink.ts +++ b/backend/src/graphql/model/TransactionLink.ts @@ -21,7 +21,7 @@ export class TransactionLink { this.link = CONFIG.COMMUNITY_REDEEM_URL.replace(/{code}/g, this.code) } - @Field(() => Number) + @Field(() => Int) id: number @Field(() => User) diff --git a/backend/src/graphql/model/UnconfirmedContribution.ts b/backend/src/graphql/model/UnconfirmedContribution.ts index c42b4fd11..75112ecf5 100644 --- a/backend/src/graphql/model/UnconfirmedContribution.ts +++ b/backend/src/graphql/model/UnconfirmedContribution.ts @@ -24,12 +24,12 @@ export class UnconfirmedContribution { firstName: string @Field(() => Int) - id?: number + id: number @Field(() => String) lastName: string - @Field(() => Number) + @Field(() => Int) userId: number @Field(() => String) @@ -44,7 +44,7 @@ export class UnconfirmedContribution { @Field(() => Decimal) amount: Decimal - @Field(() => Number, { nullable: true }) + @Field(() => Int, { nullable: true }) moderator: number | null @Field(() => [Decimal]) @@ -53,6 +53,6 @@ export class UnconfirmedContribution { @Field(() => String) state: string - @Field(() => Number) + @Field(() => Int) messageCount: number } diff --git a/backend/src/graphql/model/User.ts b/backend/src/graphql/model/User.ts index b4fdcae4f..aeb764941 100644 --- a/backend/src/graphql/model/User.ts +++ b/backend/src/graphql/model/User.ts @@ -1,4 +1,4 @@ -import { ObjectType, Field } from 'type-graphql' +import { ObjectType, Field, Int } from 'type-graphql' import { KlickTipp } from './KlickTipp' import { User as dbUser } from '@entity/User' import { UserContact } from './UserContact' @@ -28,21 +28,21 @@ export class User { this.hideAmountGDT = user.hideAmountGDT } - @Field(() => Number) + @Field(() => Int) id: number @Field(() => String) gradidoID: string @Field(() => String, { nullable: true }) - alias?: string + alias: string | null - @Field(() => Number, { nullable: true }) + @Field(() => Int, { nullable: true }) emailId: number | null // TODO privacy issue here @Field(() => String, { nullable: true }) - email: string + email: string | null @Field(() => UserContact) emailContact: UserContact @@ -72,7 +72,7 @@ export class User { hideAmountGDT: boolean // This is not the users publisherId, but the one of the users who recommend him - @Field(() => Number, { nullable: true }) + @Field(() => Int, { nullable: true }) publisherId: number | null @Field(() => Date, { nullable: true }) diff --git a/backend/src/graphql/model/UserAdmin.ts b/backend/src/graphql/model/UserAdmin.ts index 08dc405ac..e7330471b 100644 --- a/backend/src/graphql/model/UserAdmin.ts +++ b/backend/src/graphql/model/UserAdmin.ts @@ -17,7 +17,7 @@ export class UserAdmin { this.isAdmin = user.isAdmin } - @Field(() => Number) + @Field(() => Int) userId: number @Field(() => String) @@ -39,10 +39,10 @@ export class UserAdmin { hasElopage: boolean @Field(() => Date, { nullable: true }) - deletedAt?: Date | null + deletedAt: Date | null @Field(() => String, { nullable: true }) - emailConfirmationSend?: string + emailConfirmationSend: string | null @Field(() => Date, { nullable: true }) isAdmin: Date | null diff --git a/backend/src/graphql/model/UserContact.ts b/backend/src/graphql/model/UserContact.ts index 796c7f5f3..bb31d0745 100644 --- a/backend/src/graphql/model/UserContact.ts +++ b/backend/src/graphql/model/UserContact.ts @@ -1,4 +1,4 @@ -import { ObjectType, Field } from 'type-graphql' +import { ObjectType, Field, Int } from 'type-graphql' import { UserContact as dbUserContact } from '@entity/UserContact' @ObjectType() @@ -18,13 +18,13 @@ export class UserContact { this.deletedAt = userContact.deletedAt } - @Field(() => Number) + @Field(() => Int) id: number @Field(() => String) type: string - @Field(() => Number) + @Field(() => Int) userId: number @Field(() => String) @@ -33,10 +33,10 @@ export class UserContact { // @Field(() => BigInt, { nullable: true }) // emailVerificationCode: BigInt | null - @Field(() => Number, { nullable: true }) + @Field(() => Int, { nullable: true }) emailOptInTypeId: number | null - @Field(() => Number, { nullable: true }) + @Field(() => Int, { nullable: true }) emailResendCount: number | null @Field(() => Boolean) diff --git a/backend/src/graphql/resolver/BalanceResolver.ts b/backend/src/graphql/resolver/BalanceResolver.ts index 65cccf4d4..18aed5ae6 100644 --- a/backend/src/graphql/resolver/BalanceResolver.ts +++ b/backend/src/graphql/resolver/BalanceResolver.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ import Decimal from 'decimal.js-light' import { Resolver, Query, Ctx, Authorized } from 'type-graphql' import { getCustomRepository } from '@dbTools/typeorm' diff --git a/backend/src/graphql/resolver/CommunityResolver.test.ts b/backend/src/graphql/resolver/CommunityResolver.test.ts index cb916e47c..95f2ec5dd 100644 --- a/backend/src/graphql/resolver/CommunityResolver.test.ts +++ b/backend/src/graphql/resolver/CommunityResolver.test.ts @@ -1,3 +1,6 @@ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/unbound-method */ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ diff --git a/backend/src/graphql/resolver/CommunityResolver.ts b/backend/src/graphql/resolver/CommunityResolver.ts index f56254e1f..4cd0c8f69 100644 --- a/backend/src/graphql/resolver/CommunityResolver.ts +++ b/backend/src/graphql/resolver/CommunityResolver.ts @@ -9,7 +9,7 @@ import CONFIG from '@/config' export class CommunityResolver { @Authorized([RIGHTS.GET_COMMUNITY_INFO]) @Query(() => Community) - async getCommunityInfo(): Promise { + getCommunityInfo(): Community { return new Community({ name: CONFIG.COMMUNITY_NAME, description: CONFIG.COMMUNITY_DESCRIPTION, @@ -20,7 +20,7 @@ export class CommunityResolver { @Authorized([RIGHTS.COMMUNITIES]) @Query(() => [Community]) - async communities(): Promise { + communities(): Community[] { if (CONFIG.PRODUCTION) return [ new Community({ diff --git a/backend/src/graphql/resolver/ContributionLinkResolver.test.ts b/backend/src/graphql/resolver/ContributionLinkResolver.test.ts index 62f273829..4563d2a6a 100644 --- a/backend/src/graphql/resolver/ContributionLinkResolver.test.ts +++ b/backend/src/graphql/resolver/ContributionLinkResolver.test.ts @@ -1,3 +1,7 @@ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/unbound-method */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-explicit-any */ import Decimal from 'decimal.js-light' diff --git a/backend/src/graphql/resolver/ContributionLinkResolver.ts b/backend/src/graphql/resolver/ContributionLinkResolver.ts index 39f202848..cccf47399 100644 --- a/backend/src/graphql/resolver/ContributionLinkResolver.ts +++ b/backend/src/graphql/resolver/ContributionLinkResolver.ts @@ -35,7 +35,7 @@ export class ContributionLinkResolver { cycle, validFrom, validTo, - maxAmountPerMonth, + maxAmountPerMonth = null, maxPerCycle, }: ContributionLinkArgs, ): Promise { @@ -114,7 +114,7 @@ export class ContributionLinkResolver { cycle, validFrom, validTo, - maxAmountPerMonth, + maxAmountPerMonth = null, maxPerCycle, }: ContributionLinkArgs, @Arg('id', () => Int) id: number, diff --git a/backend/src/graphql/resolver/ContributionMessageResolver.test.ts b/backend/src/graphql/resolver/ContributionMessageResolver.test.ts index f3e5e865d..8b5c5a0a7 100644 --- a/backend/src/graphql/resolver/ContributionMessageResolver.test.ts +++ b/backend/src/graphql/resolver/ContributionMessageResolver.test.ts @@ -1,3 +1,8 @@ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/unbound-method */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ @@ -181,7 +186,7 @@ describe('ContributionMessageResolver', () => { ) }) - it('calls sendAddedContributionMessageEmail', async () => { + it('calls sendAddedContributionMessageEmail', () => { expect(sendAddedContributionMessageEmail).toBeCalledWith({ firstName: 'Bibi', lastName: 'Bloxberg', diff --git a/backend/src/graphql/resolver/ContributionMessageResolver.ts b/backend/src/graphql/resolver/ContributionMessageResolver.ts index adfcdf160..e9258490e 100644 --- a/backend/src/graphql/resolver/ContributionMessageResolver.ts +++ b/backend/src/graphql/resolver/ContributionMessageResolver.ts @@ -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 { ContributionMessage as DbContributionMessage } from '@entity/ContributionMessage' @@ -68,7 +69,7 @@ export class ContributionMessageResolver { @Authorized([RIGHTS.LIST_ALL_CONTRIBUTION_MESSAGES]) @Query(() => ContributionMessageListResult) async listContributionMessages( - @Arg('contributionId') contributionId: number, + @Arg('contributionId', () => Int) contributionId: number, @Args() { currentPage = 1, pageSize = 5, order = Order.DESC }: Paginated, ): Promise { diff --git a/backend/src/graphql/resolver/ContributionResolver.test.ts b/backend/src/graphql/resolver/ContributionResolver.test.ts index 27f6d1c2a..274067ba0 100644 --- a/backend/src/graphql/resolver/ContributionResolver.test.ts +++ b/backend/src/graphql/resolver/ContributionResolver.test.ts @@ -1,3 +1,8 @@ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/unbound-method */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ @@ -176,7 +181,7 @@ describe('ContributionResolver', () => { }) }) - afterAll(async () => { + afterAll(() => { resetToken() }) @@ -265,7 +270,7 @@ describe('ContributionResolver', () => { }) describe('valid input', () => { - it('creates contribution', async () => { + it('creates contribution', () => { expect(pendingContribution.data.createContribution).toMatchObject({ id: expect.any(Number), amount: '100', @@ -311,7 +316,7 @@ describe('ContributionResolver', () => { }) }) - afterAll(async () => { + afterAll(() => { resetToken() }) @@ -452,7 +457,7 @@ describe('ContributionResolver', () => { id: pendingContribution.data.createContribution.id, }) contribution.contributionStatus = ContributionStatus.DELETED - contribution.save() + await contribution.save() await mutate({ mutation: login, variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' }, @@ -464,7 +469,7 @@ describe('ContributionResolver', () => { id: pendingContribution.data.createContribution.id, }) contribution.contributionStatus = ContributionStatus.PENDING - contribution.save() + await contribution.save() }) it('throws an error', async () => { @@ -636,7 +641,7 @@ describe('ContributionResolver', () => { }) }) - afterAll(async () => { + afterAll(() => { resetToken() }) @@ -820,7 +825,7 @@ describe('ContributionResolver', () => { ) }) - it('calls sendContributionDeniedEmail', async () => { + it('calls sendContributionDeniedEmail', () => { expect(sendContributionDeniedEmail).toBeCalledWith({ firstName: 'Bibi', lastName: 'Bloxberg', @@ -856,7 +861,7 @@ describe('ContributionResolver', () => { }) }) - afterAll(async () => { + afterAll(() => { resetToken() }) @@ -1009,7 +1014,7 @@ describe('ContributionResolver', () => { }) }) - afterAll(async () => { + afterAll(() => { resetToken() }) @@ -1140,7 +1145,7 @@ describe('ContributionResolver', () => { }) }) - afterAll(async () => { + afterAll(() => { resetToken() }) @@ -1720,7 +1725,7 @@ describe('ContributionResolver', () => { }) }) - afterAll(async () => { + afterAll(() => { resetToken() }) @@ -1798,7 +1803,7 @@ describe('ContributionResolver', () => { }) }) - afterAll(async () => { + afterAll(() => { resetToken() }) @@ -1913,7 +1918,7 @@ describe('ContributionResolver', () => { }) describe('valid user to create for', () => { - beforeAll(async () => { + beforeAll(() => { variables.email = 'bibi@bloxberg.de' variables.creationDate = 'invalid-date' }) @@ -2019,7 +2024,7 @@ describe('ContributionResolver', () => { ).resolves.toEqual( expect.objectContaining({ 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({ firstName: 'Peter', lastName: 'Lustig', @@ -2551,7 +2556,7 @@ describe('ContributionResolver', () => { expect(transaction[0].typeId).toEqual(1) }) - it('calls sendContributionConfirmedEmail', async () => { + it('calls sendContributionConfirmedEmail', () => { expect(sendContributionConfirmedEmail).toBeCalledWith({ firstName: 'Bibi', lastName: 'Bloxberg', diff --git a/backend/src/graphql/resolver/ContributionResolver.ts b/backend/src/graphql/resolver/ContributionResolver.ts index 2469f60ba..88bfde902 100644 --- a/backend/src/graphql/resolver/ContributionResolver.ts +++ b/backend/src/graphql/resolver/ContributionResolver.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ import Decimal from 'decimal.js-light' import { Arg, Args, Authorized, Ctx, Int, Mutation, Query, Resolver } from 'type-graphql' import { IsNull, getConnection } from '@dbTools/typeorm' @@ -27,11 +28,11 @@ import { RIGHTS } from '@/auth/RIGHTS' import { Context, getUser, getClientTimezoneOffset } from '@/server/context' import { backendLogger as logger } from '@/server/logger' import { - getCreationDates, getUserCreation, validateContribution, updateCreations, isValidDateString, + getOpenCreations, } from './util/creations' import { MEMO_MAX_CHARS, MEMO_MIN_CHARS } from './const/const' import { @@ -131,7 +132,7 @@ export class ContributionResolver { @Args() { currentPage = 1, pageSize = 5, order = Order.DESC }: Paginated, @Arg('statusFilter', () => [ContributionStatus], { nullable: true }) - statusFilter?: ContributionStatus[], + statusFilter?: ContributionStatus[] | null, ): Promise { const user = getUser(context) @@ -156,7 +157,7 @@ export class ContributionResolver { @Args() { currentPage = 1, pageSize = 5, order = Order.DESC }: Paginated, @Arg('statusFilter', () => [ContributionStatus], { nullable: true }) - statusFilter?: ContributionStatus[], + statusFilter?: ContributionStatus[] | null, ): Promise { const [dbContributions, count] = await findContributions( order, @@ -239,14 +240,14 @@ export class ContributionResolver { contributionMessage.isModerator = false contributionMessage.userId = user.id contributionMessage.type = ContributionMessageType.HISTORY - ContributionMessage.save(contributionMessage) + await ContributionMessage.save(contributionMessage) contributionToUpdate.amount = amount contributionToUpdate.memo = memo contributionToUpdate.contributionDate = new Date(creationDate) contributionToUpdate.contributionStatus = ContributionStatus.PENDING contributionToUpdate.updatedAt = new Date() - DbContribution.save(contributionToUpdate) + await DbContribution.save(contributionToUpdate) await EVENT_CONTRIBUTION_UPDATE(user.id, contributionId, amount) @@ -254,7 +255,7 @@ export class ContributionResolver { } @Authorized([RIGHTS.ADMIN_CREATE_CONTRIBUTION]) - @Mutation(() => [Number]) + @Mutation(() => [Decimal]) async adminCreateContribution( @Args() { email, amount, memo, creationDate }: AdminCreateContributionArgs, @Ctx() context: Context, @@ -384,7 +385,7 @@ export class ContributionResolver { @Args() { currentPage = 1, pageSize = 3, order = Order.DESC }: Paginated, @Arg('statusFilter', () => [ContributionStatus], { nullable: true }) - statusFilter?: ContributionStatus[], + statusFilter?: ContributionStatus[] | null, ): Promise { const [dbContributions, count] = await findContributions( order, @@ -433,7 +434,7 @@ export class ContributionResolver { await EVENT_ADMIN_CONTRIBUTION_DELETE(contribution.userId, contribution.id, contribution.amount) - sendContributionDeletedEmail({ + void sendContributionDeletedEmail({ firstName: user.firstName, lastName: user.lastName, email: user.emailContact.email, @@ -527,7 +528,7 @@ export class ContributionResolver { await queryRunner.commitTransaction() logger.info('creation commited successfuly.') - sendContributionConfirmedEmail({ + void sendContributionConfirmedEmail({ firstName: user.firstName, lastName: user.lastName, email: user.emailContact.email, @@ -580,21 +581,17 @@ export class ContributionResolver { @Authorized([RIGHTS.OPEN_CREATIONS]) @Query(() => [OpenCreation]) - async openCreations( - @Arg('userId', () => Int, { nullable: true }) userId: number | null, + async openCreations(@Ctx() context: Context): Promise { + return getOpenCreations(getUser(context).id, getClientTimezoneOffset(context)) + } + + @Authorized([RIGHTS.ADMIN_OPEN_CREATIONS]) + @Query(() => [OpenCreation]) + async adminOpenCreations( + @Arg('userId', () => Int) userId: number, @Ctx() context: Context, ): Promise { - const id = userId || getUser(context).id - 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], - } - }) + return getOpenCreations(userId, getClientTimezoneOffset(context)) } @Authorized([RIGHTS.DENY_CONTRIBUTION]) @@ -641,7 +638,7 @@ export class ContributionResolver { contributionToUpdate.amount, ) - sendContributionDeniedEmail({ + void sendContributionDeniedEmail({ firstName: user.firstName, lastName: user.lastName, email: user.emailContact.email, diff --git a/backend/src/graphql/resolver/EmailOptinCodes.test.ts b/backend/src/graphql/resolver/EmailOptinCodes.test.ts index 988595723..47fb3963c 100644 --- a/backend/src/graphql/resolver/EmailOptinCodes.test.ts +++ b/backend/src/graphql/resolver/EmailOptinCodes.test.ts @@ -1,3 +1,6 @@ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ diff --git a/backend/src/graphql/resolver/GdtResolver.ts b/backend/src/graphql/resolver/GdtResolver.ts index 1745e7bbd..e12f92458 100644 --- a/backend/src/graphql/resolver/GdtResolver.ts +++ b/backend/src/graphql/resolver/GdtResolver.ts @@ -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 { Order } from '@enum/Order' @@ -23,6 +26,7 @@ export class GdtResolver { try { const resultGDT = await apiGet( + // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `${CONFIG.GDT_API_URL}/GdtEntries/listPerEmailApi/${userEntity.emailContact.email}/${currentPage}/${pageSize}/${order}`, ) if (!resultGDT.success) { @@ -35,7 +39,7 @@ export class GdtResolver { } @Authorized([RIGHTS.GDT_BALANCE]) - @Query(() => Number) + @Query(() => Float, { nullable: true }) async gdtBalance(@Ctx() context: Context): Promise { const user = getUser(context) try { @@ -54,9 +58,9 @@ export class GdtResolver { } @Authorized([RIGHTS.EXIST_PID]) - @Query(() => Number) + @Query(() => Int) // eslint-disable-next-line @typescript-eslint/no-explicit-any - async existPid(@Arg('pid') pid: number): Promise { + async existPid(@Arg('pid', () => Int) pid: number): Promise { // load user const resultPID = await apiGet(`${CONFIG.GDT_API_URL}/publishers/checkPidApi/${pid}`) if (!resultPID.success) { diff --git a/backend/src/graphql/resolver/KlicktippResolver.ts b/backend/src/graphql/resolver/KlicktippResolver.ts index 4f88ccdc1..dd137f07c 100644 --- a/backend/src/graphql/resolver/KlicktippResolver.ts +++ b/backend/src/graphql/resolver/KlicktippResolver.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unsafe-return */ import { Resolver, Query, Authorized, Arg, Mutation, Args } from 'type-graphql' import SubscribeNewsletterArgs from '@arg/SubscribeNewsletterArgs' diff --git a/backend/src/graphql/resolver/StatisticsResolver.ts b/backend/src/graphql/resolver/StatisticsResolver.ts index e91840f10..38d0000cb 100644 --- a/backend/src/graphql/resolver/StatisticsResolver.ts +++ b/backend/src/graphql/resolver/StatisticsResolver.ts @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ import Decimal from 'decimal.js-light' import { Resolver, Query, Authorized, FieldResolver } from 'type-graphql' import { getConnection } from '@dbTools/typeorm' @@ -15,7 +17,7 @@ import { calculateDecay } from '@/util/decay' export class StatisticsResolver { @Authorized([RIGHTS.COMMUNITY_STATISTICS]) @Query(() => CommunityStatistics) - async communityStatistics(): Promise { + communityStatistics(): CommunityStatistics { return new CommunityStatistics() } diff --git a/backend/src/graphql/resolver/TransactionLinkResolver.test.ts b/backend/src/graphql/resolver/TransactionLinkResolver.test.ts index 60b4551be..14c5b350b 100644 --- a/backend/src/graphql/resolver/TransactionLinkResolver.test.ts +++ b/backend/src/graphql/resolver/TransactionLinkResolver.test.ts @@ -1,3 +1,8 @@ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/unbound-method */ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ @@ -17,10 +22,12 @@ import { createContribution, updateContribution, createTransactionLink, + confirmContribution, } from '@/seeds/graphql/mutations' import { listTransactionLinksAdmin } from '@/seeds/graphql/queries' import { ContributionLink as DbContributionLink } from '@entity/ContributionLink' import { User } from '@entity/User' +import { Transaction } from '@entity/Transaction' import { UnconfirmedContribution } from '@model/UnconfirmedContribution' import Decimal from 'decimal.js-light' import { GraphQLError } from 'graphql' @@ -137,6 +144,8 @@ describe('TransactionLinkResolver', () => { resetToken() }) + let contributionId: number + describe('unauthenticated', () => { it('throws an error', async () => { jest.clearAllMocks() @@ -210,7 +219,7 @@ describe('TransactionLinkResolver', () => { mutate({ mutation: redeemTransactionLink, variables: { - code: 'CL-' + contributionLink.code, + code: `CL-${contributionLink.code}`, }, }), ).resolves.toMatchObject({ @@ -249,7 +258,7 @@ describe('TransactionLinkResolver', () => { mutate({ mutation: redeemTransactionLink, variables: { - code: 'CL-' + contributionLink.code, + code: `CL-${contributionLink.code}`, }, }), ).resolves.toMatchObject({ @@ -288,7 +297,7 @@ describe('TransactionLinkResolver', () => { mutate({ mutation: redeemTransactionLink, variables: { - code: 'CL-' + contributionLink.code, + code: `CL-${contributionLink.code}`, }, }), ).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', () => { const now = new Date() 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 () => { const cls = await DbContributionLink.find() expect(cls).toHaveLength(1) @@ -373,6 +385,7 @@ describe('TransactionLinkResolver', () => { }, }) contribution = result.data.createContribution + contributionId = result.data.createContribution.id }) 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), + ) + }) + }) + }) + }) }) }) diff --git a/backend/src/graphql/resolver/TransactionLinkResolver.ts b/backend/src/graphql/resolver/TransactionLinkResolver.ts index ab5b52bad..9e365ab51 100644 --- a/backend/src/graphql/resolver/TransactionLinkResolver.ts +++ b/backend/src/graphql/resolver/TransactionLinkResolver.ts @@ -285,12 +285,20 @@ export class TransactionLinkResolver { return true } else { const now = new Date() - const transactionLink = await DbTransactionLink.findOneOrFail({ code }) - const linkedUser = await DbUser.findOneOrFail( + const transactionLink = await DbTransactionLink.findOne({ code }) + if (!transactionLink) { + throw new LogError('Transaction link not found', code) + } + + const linkedUser = await DbUser.findOne( { id: transactionLink.userId }, { relations: ['emailContact'] }, ) + if (!linkedUser) { + throw new LogError('Linked user not found for given link', transactionLink.userId) + } + if (user.id === linkedUser.id) { throw new LogError('Cannot redeem own transaction link', user.id) } @@ -341,8 +349,9 @@ export class TransactionLinkResolver { async listTransactionLinksAdmin( @Args() paginated: Paginated, + // eslint-disable-next-line type-graphql/wrong-decorator-signature @Arg('filters', () => TransactionLinkFilters, { nullable: true }) - filters: TransactionLinkFilters | null, + filters: TransactionLinkFilters | null, // eslint-disable-line type-graphql/invalid-nullable-input-type @Arg('userId', () => Int) userId: number, ): Promise { diff --git a/backend/src/graphql/resolver/TransactionResolver.test.ts b/backend/src/graphql/resolver/TransactionResolver.test.ts index 6751aa6ad..c660a72da 100644 --- a/backend/src/graphql/resolver/TransactionResolver.test.ts +++ b/backend/src/graphql/resolver/TransactionResolver.test.ts @@ -1,3 +1,7 @@ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/unbound-method */ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ @@ -324,7 +328,7 @@ describe('send coins', () => { ).toEqual( expect.objectContaining({ data: { - sendCoins: 'true', + sendCoins: true, }, }), ) @@ -337,7 +341,7 @@ describe('send coins', () => { memo: 'unrepeatable memo', }) - expect(EventProtocol.find()).resolves.toContainEqual( + await expect(EventProtocol.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.TRANSACTION_SEND, userId: user[1].id, @@ -354,7 +358,7 @@ describe('send coins', () => { memo: 'unrepeatable memo', }) - expect(EventProtocol.find()).resolves.toContainEqual( + await expect(EventProtocol.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.TRANSACTION_RECEIVE, userId: user[0].id, @@ -379,7 +383,7 @@ describe('send coins', () => { ).resolves.toEqual( expect.objectContaining({ data: { - sendCoins: 'true', + sendCoins: true, }, }), ) @@ -395,7 +399,7 @@ describe('send coins', () => { ).resolves.toEqual( expect.objectContaining({ data: { - sendCoins: 'true', + sendCoins: true, }, }), ) @@ -411,7 +415,7 @@ describe('send coins', () => { ).resolves.toEqual( expect.objectContaining({ data: { - sendCoins: 'true', + sendCoins: true, }, }), ) @@ -427,7 +431,7 @@ describe('send coins', () => { ).resolves.toEqual( expect.objectContaining({ data: { - sendCoins: 'true', + sendCoins: true, }, }), ) diff --git a/backend/src/graphql/resolver/TransactionResolver.ts b/backend/src/graphql/resolver/TransactionResolver.ts index 9d5a1d38c..a11c5b377 100644 --- a/backend/src/graphql/resolver/TransactionResolver.ts +++ b/backend/src/graphql/resolver/TransactionResolver.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable new-cap */ /* eslint-disable @typescript-eslint/no-non-null-assertion */ @@ -304,7 +305,7 @@ export class TransactionResolver { } @Authorized([RIGHTS.SEND_COINS]) - @Mutation(() => String) + @Mutation(() => Boolean) async sendCoins( @Args() { email, amount, memo }: TransactionSendArgs, @Ctx() context: Context, diff --git a/backend/src/graphql/resolver/UserResolver.test.ts b/backend/src/graphql/resolver/UserResolver.test.ts index 19eb04b34..a57346583 100644 --- a/backend/src/graphql/resolver/UserResolver.test.ts +++ b/backend/src/graphql/resolver/UserResolver.test.ts @@ -1,3 +1,8 @@ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/unbound-method */ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ @@ -182,7 +187,7 @@ describe('UserResolver', () => { { email: 'peter@lustig.de' }, { relations: ['user'] }, ) - expect(EventProtocol.find()).resolves.toContainEqual( + await expect(EventProtocol.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.REGISTER, userId: userConatct.user.id, @@ -210,8 +215,8 @@ describe('UserResolver', () => { }) }) - it('stores the SEND_CONFIRMATION_EMAIL event in the database', () => { - expect(EventProtocol.find()).resolves.toContainEqual( + it('stores the SEND_CONFIRMATION_EMAIL event in the database', async () => { + await expect(EventProtocol.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.SEND_CONFIRMATION_EMAIL, userId: user[0].id, @@ -226,7 +231,7 @@ describe('UserResolver', () => { mutation = await mutate({ mutation: createUser, variables }) }) - it('logs an info', async () => { + it('logs an info', () => { expect(logger.info).toBeCalledWith('User already exists with this email=peter@lustig.de') }) @@ -239,7 +244,7 @@ describe('UserResolver', () => { }) }) - it('results with partly faked user with random "id"', async () => { + it('results with partly faked user with random "id"', () => { expect(mutation).toEqual( expect.objectContaining({ data: { @@ -256,7 +261,7 @@ describe('UserResolver', () => { { email: 'peter@lustig.de' }, { relations: ['user'] }, ) - expect(EventProtocol.find()).resolves.toContainEqual( + await expect(EventProtocol.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.SEND_ACCOUNT_MULTIREGISTRATION_EMAIL, userId: userConatct.user.id, @@ -283,7 +288,7 @@ describe('UserResolver', () => { }) describe('no publisher id', () => { - it('sets publisher id to null', async () => { + it('sets publisher id to 0', async () => { await mutate({ mutation: createUser, variables: { ...variables, email: 'raeuber@hotzenplotz.de', publisherId: undefined }, @@ -294,7 +299,7 @@ describe('UserResolver', () => { emailContact: expect.objectContaining({ email: 'raeuber@hotzenplotz.de', }), - publisherId: null, + publisherId: 0, }), ]), ) @@ -355,8 +360,8 @@ describe('UserResolver', () => { ) }) - it('stores the ACTIVATE_ACCOUNT event in the database', () => { - expect(EventProtocol.find()).resolves.toContainEqual( + it('stores the ACTIVATE_ACCOUNT event in the database', async () => { + await expect(EventProtocol.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.ACTIVATE_ACCOUNT, userId: user[0].id, @@ -364,8 +369,8 @@ describe('UserResolver', () => { ) }) - it('stores the REDEEM_REGISTER event in the database', () => { - expect(EventProtocol.find()).resolves.toContainEqual( + it('stores the REDEEM_REGISTER event in the database', async () => { + await expect(EventProtocol.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.REDEEM_REGISTER, userId: result.data.createUser.id, @@ -680,7 +685,7 @@ describe('UserResolver', () => { { email: 'bibi@bloxberg.de' }, { relations: ['user'] }, ) - expect(EventProtocol.find()).resolves.toContainEqual( + await expect(EventProtocol.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.LOGIN, userId: userConatct.user.id, @@ -849,7 +854,7 @@ describe('UserResolver', () => { it('returns true', async () => { await expect(mutate({ mutation: logout })).resolves.toEqual( expect.objectContaining({ - data: { logout: 'true' }, + data: { logout: true }, errors: undefined, }), ) @@ -927,8 +932,8 @@ describe('UserResolver', () => { ) }) - it('stores the LOGIN event in the database', () => { - expect(EventProtocol.find()).resolves.toContainEqual( + it('stores the LOGIN event in the database', async () => { + await expect(EventProtocol.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.LOGIN, userId: user[0].id, @@ -1847,7 +1852,7 @@ describe('UserResolver', () => { { email: 'bibi@bloxberg.de' }, { relations: ['user'] }, ) - expect(EventProtocol.find()).resolves.toContainEqual( + await expect(EventProtocol.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.ADMIN_SEND_CONFIRMATION_EMAIL, userId: userConatct.user.id, diff --git a/backend/src/graphql/resolver/UserResolver.ts b/backend/src/graphql/resolver/UserResolver.ts index f9617b0df..078a29a8e 100644 --- a/backend/src/graphql/resolver/UserResolver.ts +++ b/backend/src/graphql/resolver/UserResolver.ts @@ -1,3 +1,7 @@ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ import i18n from 'i18n' import { v4 as uuidv4 } from 'uuid' import { @@ -166,11 +170,11 @@ export class UserResolver { // Elopage Status & Stored PublisherId user.hasElopage = await this.hasElopage({ ...context, user: dbUser }) - logger.info('user.hasElopage=' + user.hasElopage) + logger.info('user.hasElopage', user.hasElopage) if (!user.hasElopage && publisherId) { user.publisherId = publisherId dbUser.publisherId = publisherId - DbUser.save(dbUser) + await DbUser.save(dbUser) } context.setHeaders.push({ @@ -184,8 +188,8 @@ export class UserResolver { } @Authorized([RIGHTS.LOGOUT]) - @Mutation(() => String) - async logout(): Promise { + @Mutation(() => Boolean) + logout(): boolean { // TODO: Event still missing here!! // TODO: We dont need this anymore, but might need this in the future in oder to invalidate a valid JWT-Token. // Furthermore this hook can be useful for tracking user behaviour (did he logout or not? Warn him if he didn't on next login) @@ -202,7 +206,7 @@ export class UserResolver { @Mutation(() => User) async createUser( @Args() - { email, firstName, lastName, language, publisherId, redeemCode = null }: CreateUserArgs, + { email, firstName, lastName, language, publisherId = null, redeemCode = null }: CreateUserArgs, ): Promise { logger.addContext('user', 'unknown') logger.info( @@ -239,7 +243,7 @@ export class UserResolver { user.lastName = lastName user.language = language user.publisherId = publisherId - logger.debug('partly faked user=' + user) + logger.debug('partly faked user', user) const emailSent = await sendAccountMultiRegistrationEmail({ firstName: foundUser.firstName, // this is the real name of the email owner, but just "firstName" would be the name of the new registrant which shall not be passed to the outside @@ -272,22 +276,22 @@ export class UserResolver { dbUser.firstName = firstName dbUser.lastName = lastName dbUser.language = language - dbUser.publisherId = publisherId + dbUser.publisherId = publisherId || 0 dbUser.passwordEncryptionType = PasswordEncryptionType.NO_PASSWORD - logger.debug('new dbUser=' + dbUser) + logger.debug('new dbUser', dbUser) if (redeemCode) { if (redeemCode.match(/^CL-/)) { const contributionLink = await DbContributionLink.findOne({ code: redeemCode.replace('CL-', ''), }) - logger.info('redeemCode found contributionLink=' + contributionLink) + logger.info('redeemCode found contributionLink', contributionLink) if (contributionLink) { dbUser.contributionLinkId = contributionLink.id eventRegisterRedeem.contributionId = contributionLink.id } } else { const transactionLink = await DbTransactionLink.findOne({ code: redeemCode }) - logger.info('redeemCode found transactionLink=' + transactionLink) + logger.info('redeemCode found transactionLink', transactionLink) if (transactionLink) { dbUser.referrerId = transactionLink.userId eventRegisterRedeem.transactionId = transactionLink.id @@ -654,7 +658,7 @@ export class UserResolver { return 'user.' + fieldName }), searchText, - filters, + filters || null, currentPage, pageSize, ) diff --git a/backend/src/graphql/resolver/semaphore.test.ts b/backend/src/graphql/resolver/semaphore.test.ts index e334910f1..b3c99ba7d 100644 --- a/backend/src/graphql/resolver/semaphore.test.ts +++ b/backend/src/graphql/resolver/semaphore.test.ts @@ -1,3 +1,7 @@ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/no-explicit-any */ import Decimal from 'decimal.js-light' @@ -79,7 +83,7 @@ describe('semaphore', () => { maxPerCycle: 1, }, }) - contributionLinkCode = 'CL-' + contributionLink.code + contributionLinkCode = `CL-${contributionLink.code}` await mutate({ mutation: login, variables: { email: 'bob@baumeister.de', password: 'Aa12345_' }, @@ -187,4 +191,50 @@ describe('semaphore', () => { await expect(confirmBibisContribution).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, + }) + }) + }) }) diff --git a/backend/src/graphql/resolver/util/creations.test.ts b/backend/src/graphql/resolver/util/creations.test.ts index 4d8132333..4eabec500 100644 --- a/backend/src/graphql/resolver/util/creations.test.ts +++ b/backend/src/graphql/resolver/util/creations.test.ts @@ -1,3 +1,6 @@ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ diff --git a/backend/src/graphql/resolver/util/creations.ts b/backend/src/graphql/resolver/util/creations.ts index b9ba2e69f..a45703ed2 100644 --- a/backend/src/graphql/resolver/util/creations.ts +++ b/backend/src/graphql/resolver/util/creations.ts @@ -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 { backendLogger as logger } from '@/server/logger' import { getConnection } from '@dbTools/typeorm' import { Contribution } from '@entity/Contribution' import Decimal from 'decimal.js-light' import { FULL_CREATION_AVAILABLE, MAX_CREATION_AMOUNT } from '../const/const' +import { OpenCreation } from '@model/OpenCreation' interface CreationMap { id: number @@ -100,7 +103,7 @@ const getCreationMonths = (timezoneOffset: number): number[] => { return getCreationDates(timezoneOffset).map((date) => date.getMonth() + 1) } -export const getCreationDates = (timezoneOffset: number): Date[] => { +const getCreationDates = (timezoneOffset: number): Date[] => { const clientNow = new Date() clientNow.setTime(clientNow.getTime() - timezoneOffset * 60 * 1000) logger.info( @@ -152,3 +155,18 @@ export const updateCreations = ( export const isValidDateString = (dateString: string): boolean => { return new Date(dateString).toString() !== 'Invalid Date' } + +export const getOpenCreations = async ( + userId: number, + timezoneOffset: number, +): Promise => { + 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], + } + }) +} diff --git a/backend/src/graphql/resolver/util/findContributions.ts b/backend/src/graphql/resolver/util/findContributions.ts index 5201284aa..8957a29d8 100644 --- a/backend/src/graphql/resolver/util/findContributions.ts +++ b/backend/src/graphql/resolver/util/findContributions.ts @@ -10,7 +10,7 @@ export const findContributions = async ( withDeleted: boolean, relations: string[], userId?: number, - statusFilter?: ContributionStatus[], + statusFilter?: ContributionStatus[] | null, ): Promise<[DbContribution[], number]> => DbContribution.findAndCount({ where: { diff --git a/backend/src/index.ts b/backend/src/index.ts index 10b7c91ac..cd6d002cc 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -17,7 +17,7 @@ async function main() { console.log(`GraphIQL available at http://localhost:${CONFIG.PORT}`) } }) - startValidateCommunities(Number(CONFIG.FEDERATION_VALIDATE_COMMUNITY_TIMER)) + void startValidateCommunities(Number(CONFIG.FEDERATION_VALIDATE_COMMUNITY_TIMER)) } main().catch((e) => { diff --git a/backend/src/middleware/klicktippMiddleware.ts b/backend/src/middleware/klicktippMiddleware.ts index 6bdaa63fd..0469b4ccc 100644 --- a/backend/src/middleware/klicktippMiddleware.ts +++ b/backend/src/middleware/klicktippMiddleware.ts @@ -1,3 +1,7 @@ +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ import { MiddlewareFn } from 'type-graphql' import { /* klicktippSignIn, */ getKlickTippUser } from '@/apis/KlicktippController' import { KlickTipp } from '@model/KlickTipp' diff --git a/backend/src/password/EncryptorUtils.ts b/backend/src/password/EncryptorUtils.ts index d03f5d169..4c802a86f 100644 --- a/backend/src/password/EncryptorUtils.ts +++ b/backend/src/password/EncryptorUtils.ts @@ -1,3 +1,6 @@ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ import CONFIG from '@/config' import LogError from '@/server/LogError' import { backendLogger as logger } from '@/server/logger' diff --git a/backend/src/seeds/factory/contributionLink.ts b/backend/src/seeds/factory/contributionLink.ts index 08f784604..5925cdcfe 100644 --- a/backend/src/seeds/factory/contributionLink.ts +++ b/backend/src/seeds/factory/contributionLink.ts @@ -1,3 +1,6 @@ +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/unbound-method */ import { ApolloServerTestClient } from 'apollo-server-testing' import { login, createContributionLink } from '@/seeds/graphql/mutations' import { ContributionLink } from '@model/ContributionLink' diff --git a/backend/src/seeds/factory/creation.ts b/backend/src/seeds/factory/creation.ts index 69d77aa03..db58c9d51 100644 --- a/backend/src/seeds/factory/creation.ts +++ b/backend/src/seeds/factory/creation.ts @@ -1,3 +1,7 @@ +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/unbound-method */ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ diff --git a/backend/src/seeds/factory/transactionLink.ts b/backend/src/seeds/factory/transactionLink.ts index be5a01d22..797a93183 100644 --- a/backend/src/seeds/factory/transactionLink.ts +++ b/backend/src/seeds/factory/transactionLink.ts @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/unbound-method */ import { ApolloServerTestClient } from 'apollo-server-testing' import { login, createTransactionLink } from '@/seeds/graphql/mutations' import { TransactionLinkInterface } from '@/seeds/transactionLink/TransactionLinkInterface' diff --git a/backend/src/seeds/factory/user.ts b/backend/src/seeds/factory/user.ts index d566275db..854e5a4ed 100644 --- a/backend/src/seeds/factory/user.ts +++ b/backend/src/seeds/factory/user.ts @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/unbound-method */ import { createUser, setPassword } from '@/seeds/graphql/mutations' import { User } from '@entity/User' import { UserInterface } from '@/seeds/users/UserInterface' diff --git a/backend/src/seeds/graphql/mutations.ts b/backend/src/seeds/graphql/mutations.ts index 79684d378..1aa12a32f 100644 --- a/backend/src/seeds/graphql/mutations.ts +++ b/backend/src/seeds/graphql/mutations.ts @@ -89,6 +89,12 @@ export const createTransactionLink = gql` } ` +export const deleteTransactionLink = gql` + mutation ($id: Int!) { + deleteTransactionLink(id: $id) + } +` + // from admin interface export const adminCreateContribution = gql` @@ -269,7 +275,7 @@ export const denyContribution = gql` ` export const createContributionMessage = gql` - mutation ($contributionId: Float!, $message: String!) { + mutation ($contributionId: Int!, $message: String!) { createContributionMessage(contributionId: $contributionId, message: $message) { id message @@ -283,7 +289,7 @@ export const createContributionMessage = gql` ` export const adminCreateContributionMessage = gql` - mutation ($contributionId: Float!, $message: String!) { + mutation ($contributionId: Int!, $message: String!) { adminCreateContributionMessage(contributionId: $contributionId, message: $message) { id message diff --git a/backend/src/seeds/graphql/queries.ts b/backend/src/seeds/graphql/queries.ts index 6e2e58c67..299a0103d 100644 --- a/backend/src/seeds/graphql/queries.ts +++ b/backend/src/seeds/graphql/queries.ts @@ -301,7 +301,7 @@ export const searchAdminUsers = 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( contributionId: $contributionId pageSize: $pageSize diff --git a/backend/src/seeds/index.ts b/backend/src/seeds/index.ts index 9e1939db8..55cd65ec1 100644 --- a/backend/src/seeds/index.ts +++ b/backend/src/seeds/index.ts @@ -1,3 +1,7 @@ +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ @@ -94,4 +98,4 @@ const run = async () => { await con.close() } -run() +void run() diff --git a/backend/src/server/LogError.test.ts b/backend/src/server/LogError.test.ts index 6654c42f3..5aa1cae21 100644 --- a/backend/src/server/LogError.test.ts +++ b/backend/src/server/LogError.test.ts @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/unbound-method */ import { logger } from '@test/testSetup' import LogError from './LogError' diff --git a/backend/src/server/createServer.ts b/backend/src/server/createServer.ts index 390ff1c6b..0c5009b6f 100644 --- a/backend/src/server/createServer.ts +++ b/backend/src/server/createServer.ts @@ -1,3 +1,6 @@ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/unbound-method */ import 'reflect-metadata' import { ApolloServer } from 'apollo-server-express' @@ -71,6 +74,7 @@ const createServer = async ( app.use(localization.init) // Elopage Webhook + // eslint-disable-next-line @typescript-eslint/no-misused-promises app.post('/hook/elopage/' + CONFIG.WEBHOOK_ELOPAGE_SECRET, elopageWebhook) // Apollo Server diff --git a/backend/src/server/logger.ts b/backend/src/server/logger.ts index 0cfa5689b..5cfa94285 100644 --- a/backend/src/server/logger.ts +++ b/backend/src/server/logger.ts @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ import log4js from 'log4js' import CONFIG from '@/config' diff --git a/backend/src/server/plugins.ts b/backend/src/server/plugins.ts index 7ecbedf2a..bc2495b71 100644 --- a/backend/src/server/plugins.ts +++ b/backend/src/server/plugins.ts @@ -1,3 +1,8 @@ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ diff --git a/backend/src/typeorm/repository/TransactionLink.ts b/backend/src/typeorm/repository/TransactionLink.ts index 46926673a..7df1fd465 100644 --- a/backend/src/typeorm/repository/TransactionLink.ts +++ b/backend/src/typeorm/repository/TransactionLink.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ import { Repository, EntityRepository } from '@dbTools/typeorm' import { TransactionLink as dbTransactionLink } from '@entity/TransactionLink' import Decimal from 'decimal.js-light' diff --git a/backend/src/typeorm/repository/User.ts b/backend/src/typeorm/repository/User.ts index 4972aa9c4..e72a6e717 100644 --- a/backend/src/typeorm/repository/User.ts +++ b/backend/src/typeorm/repository/User.ts @@ -7,7 +7,7 @@ export class UserRepository extends Repository { async findBySearchCriteriaPagedFiltered( select: string[], searchCriteria: string, - filters: SearchUsersFilters, + filters: SearchUsersFilters | null, currentPage: number, pageSize: number, ): Promise<[DbUser[], number]> { diff --git a/backend/src/util/decay.test.ts b/backend/src/util/decay.test.ts index f1111fab4..cf00ec851 100644 --- a/backend/src/util/decay.test.ts +++ b/backend/src/util/decay.test.ts @@ -10,13 +10,13 @@ describe('utils/decay', () => { // TODO: toString() was required, we could not compare two decimals expect(decayFormula(amount, seconds).toString()).toBe('0.999999978035040489732012') }) - it('has correct backward calculation', async () => { + it('has correct backward calculation', () => { const amount = new Decimal(1.0) const seconds = -1 expect(decayFormula(amount, seconds).toString()).toBe('1.000000021964959992727444') }) // we get pretty close, but not exact here, skipping - it.skip('has correct forward calculation', async () => { + it.skip('has correct forward calculation', () => { const amount = new Decimal(1.0).div( new Decimal('0.99999997803504048973201202316767079413460520837376'), ) @@ -24,7 +24,7 @@ describe('utils/decay', () => { expect(decayFormula(amount, seconds).toString()).toBe('1.0') }) }) - it('has base 0.99999997802044727', async () => { + it('has base 0.99999997802044727', () => { const now = new Date() now.setSeconds(1) const oneSecondAgo = new Date(now.getTime()) @@ -34,7 +34,7 @@ describe('utils/decay', () => { ) }) - it('returns input amount when from and to is the same', async () => { + it('returns input amount when from and to is the same', () => { const now = new Date() expect(calculateDecay(new Decimal(100.0), now, now).balance.toString()).toBe('100') }) diff --git a/backend/src/util/klicktipp.ts b/backend/src/util/klicktipp.ts index 02bdd853b..baa7970fc 100644 --- a/backend/src/util/klicktipp.ts +++ b/backend/src/util/klicktipp.ts @@ -26,4 +26,4 @@ export async function retrieveNotRegisteredEmails(): Promise { return notRegisteredUser } -retrieveNotRegisteredEmails() +void retrieveNotRegisteredEmails() diff --git a/backend/src/webhook/elopage.ts b/backend/src/webhook/elopage.ts index 87af4088c..587bb788c 100644 --- a/backend/src/webhook/elopage.ts +++ b/backend/src/webhook/elopage.ts @@ -1,3 +1,7 @@ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /* diff --git a/backend/test/extensions.ts b/backend/test/extensions.ts index 69c2ff7a6..26fb11510 100644 --- a/backend/test/extensions.ts +++ b/backend/test/extensions.ts @@ -1,3 +1,6 @@ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/no-empty-interface */ import Decimal from 'decimal.js-light' diff --git a/backend/test/helpers.ts b/backend/test/helpers.ts index 1935b01a0..a5f721717 100644 --- a/backend/test/helpers.ts +++ b/backend/test/helpers.ts @@ -1,3 +1,8 @@ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/unbound-method */ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ diff --git a/backend/test/testSetup.ts b/backend/test/testSetup.ts index 300a9cbf3..b13e3cf26 100644 --- a/backend/test/testSetup.ts +++ b/backend/test/testSetup.ts @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ import CONFIG from '@/config' import { backendLogger as logger } from '@/server/logger' import { i18n } from '@/server/localization' diff --git a/backend/yarn.lock b/backend/yarn.lock index fe50e680c..3151557ab 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -1014,6 +1014,11 @@ resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.9.tgz#97edc9037ea0c38585320b28964dde3b39e4660d" 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": version "0.0.29" 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" 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": version "7.3.8" resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.8.tgz#508a27995498d7586dcecd77c25e289bfaf90c59" @@ -1196,6 +1206,13 @@ eslint-scope "^5.1.1" 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": version "4.33.0" 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/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": version "4.33.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.33.0.tgz#a1e59036a3b53ae8430ceebf2a919dc7f9af6d72" 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": version "4.33.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.33.0.tgz#0dfb51c2908f68c5c08d82aefeaf166a17c24609" @@ -1232,6 +1262,33 @@ semver "^7.3.5" 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": version "4.33.0" 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" 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": version "0.1.11" 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" 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: version "5.1.1" 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" 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: version "7.32.0" 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" 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: version "2.1.0" 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" 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: version "9.6.0" 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" 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: version "3.3.0" 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" 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" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" 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" integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== -merge2@^1.3.0: +merge2@^1.3.0, merge2@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" 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" 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: version "0.17.1" resolved "https://registry.yarnpkg.com/send/-/send-0.17.1.tgz#c1d8b059f7900f7466dd4938bdc44e11ddb376c8" diff --git a/database/package.json b/database/package.json index 95fd9a791..6dc8acf8c 100644 --- a/database/package.json +++ b/database/package.json @@ -1,6 +1,6 @@ { "name": "gradido-database", - "version": "1.19.0", + "version": "1.19.1", "description": "Gradido Database Tool to execute database migrations", "main": "src/index.ts", "repository": "https://github.com/gradido/gradido/database", @@ -16,9 +16,7 @@ "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_reset": "cross-env TZ=UTC ts-node src/index.ts reset", - "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" + "lint": "eslint --max-warnings=0 --ext .js,.ts ." }, "devDependencies": { "@types/faker": "^5.5.9", diff --git a/e2e-tests/cypress.config.ts b/e2e-tests/cypress.config.ts index 9dff98a9b..7205ef9cb 100644 --- a/e2e-tests/cypress.config.ts +++ b/e2e-tests/cypress.config.ts @@ -56,7 +56,7 @@ export default defineConfig({ env: { backendURL: 'http://localhost:4000', 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) { email firstName @@ -69,7 +69,8 @@ export default defineConfig({ hasElopage publisherId isAdmin - creation + hideAmountGDD + hideAmountGDT __typename } }`, diff --git a/e2e-tests/cypress/e2e/User.Authentication.ResetPassword.feature b/e2e-tests/cypress/e2e/User.Authentication.ResetPassword.feature index b0f660709..50a29d320 100644 --- a/e2e-tests/cypress/e2e/User.Authentication.ResetPassword.feature +++ b/e2e-tests/cypress/e2e/User.Authentication.ResetPassword.feature @@ -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 # Background: # Given the following "users" are in the database: - # | email | password | name | - # | bibi@bloxberg.de | Aa12345_ | Bibi Bloxberg | + # | email | password | name | + # | raeuber@hotzenplotz.de | Aa12345_ | Räuber Hotzenplotz | Scenario: Reset password from signin page successfully Given the user navigates to page "/login" 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 Then the user receives an e-mail containing the "password reset" link 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 submits the password form 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 - But the user submits the credentials "bibi@bloxberg.de" "12345Aa_" - And the user is logged in with username "Bibi Bloxberg" + But the user submits the credentials "raeuber@hotzenplotz.de" "12345Aa_" + And the user is logged in with username "Räuber Hotzenplotz" diff --git a/e2e-tests/cypress/e2e/UserProfile.ChangePassword.feature b/e2e-tests/cypress/e2e/UserProfile.ChangePassword.feature index aa853f6ff..b7aa6960c 100644 --- a/e2e-tests/cypress/e2e/UserProfile.ChangePassword.feature +++ b/e2e-tests/cypress/e2e/UserProfile.ChangePassword.feature @@ -5,14 +5,14 @@ Feature: User profile - change password Background: # TODO for these pre-conditions utilize seeding or API check, if user exists in test system # Given the following "users" are in the database: - # | email | password | name | - # | bibi@bloxberg.de | Aa12345_ | Bibi Bloxberg | | + # | email | password | name | + # | bob@baumeister.de | Aa12345_ | Bob der Baumeister | # 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 - Given the user navigates to page "/profile" + Given the user navigates to page "/settings" And the user opens the change password menu When the user fills the password form with: | Old password | Aa12345_ | @@ -21,7 +21,7 @@ Feature: User profile - change password And the user submits the password form And the user is presented a "success" message 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 - But the user submits the credentials "bibi@bloxberg.de" "12345Aa_" - And the user is logged in with username "Bibi Bloxberg" + But the user submits the credentials "bob@baumeister.de" "12345Aa_" + And the user is logged in with username "Bob der Baumeister" diff --git a/e2e-tests/cypress/e2e/models/SideNavMenu.ts b/e2e-tests/cypress/e2e/models/SideNavMenu.ts index ccd177b66..b52f35ed4 100644 --- a/e2e-tests/cypress/e2e/models/SideNavMenu.ts +++ b/e2e-tests/cypress/e2e/models/SideNavMenu.ts @@ -11,7 +11,7 @@ export class SideNavMenu { } logout() { - cy.get(this.logoutMenu).click() + cy.get('.main-sidebar').find(this.logoutMenu).click() return this } } diff --git a/frontend/package.json b/frontend/package.json index 180959bc5..865ba060f 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "bootstrap-vue-gradido-wallet", - "version": "1.19.0", + "version": "1.19.1", "private": true, "scripts": { "start": "node run/server.js", diff --git a/frontend/src/components/Contributions/ContributionListItem.vue b/frontend/src/components/Contributions/ContributionListItem.vue index ffbf29fdd..56546d183 100644 --- a/frontend/src/components/Contributions/ContributionListItem.vue +++ b/frontend/src/components/Contributions/ContributionListItem.vue @@ -25,7 +25,11 @@
{{ $t('contributionText') }}
{{ memo }}
-
+
{{ $t('contribution.alert.answerQuestion') }}
diff --git a/frontend/src/components/Menu/Sidebar.spec.js b/frontend/src/components/Menu/Sidebar.spec.js index 321d73a3a..e6e4cfe2a 100644 --- a/frontend/src/components/Menu/Sidebar.spec.js +++ b/frontend/src/components/Menu/Sidebar.spec.js @@ -49,15 +49,15 @@ describe('Sidebar', () => { 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') }) - it('has nav-item "creation" in navbar', () => { + it('has nav-item "GDT" in navbar', () => { 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') }) }) @@ -68,13 +68,13 @@ describe('Sidebar', () => { 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( '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( 'navigation.logout', ) diff --git a/frontend/src/components/Menu/Sidebar.vue b/frontend/src/components/Menu/Sidebar.vue index c6cc4c4e0..644fb37e0 100644 --- a/frontend/src/components/Menu/Sidebar.vue +++ b/frontend/src/components/Menu/Sidebar.vue @@ -13,7 +13,7 @@ {{ $t('navigation.overview') }} - + {{ $t('navigation.send') }} @@ -48,7 +48,12 @@ {{ $t('navigation.admin_area') }} - + {{ $t('navigation.logout') }} diff --git a/frontend/src/graphql/mutations.js b/frontend/src/graphql/mutations.js index 111eb7ab5..55858b09b 100644 --- a/frontend/src/graphql/mutations.js +++ b/frontend/src/graphql/mutations.js @@ -128,7 +128,7 @@ export const deleteContribution = gql` ` export const createContributionMessage = gql` - mutation($contributionId: Float!, $message: String!) { + mutation($contributionId: Int!, $message: String!) { createContributionMessage(contributionId: $contributionId, message: $message) { id message diff --git a/package.json b/package.json index c28757c68..cba894803 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gradido", - "version": "1.19.0", + "version": "1.19.1", "description": "Gradido", "main": "index.js", "repository": "git@github.com:gradido/gradido.git",