From e2fc7c173346620c2dfc29757831e04d0288e025 Mon Sep 17 00:00:00 2001 From: elweyn Date: Fri, 10 Mar 2023 11:36:35 +0100 Subject: [PATCH 1/3] chore(other): upgrade version to 1.19.1 --- CHANGELOG.md | 20 ++++++++++++++++++++ admin/package.json | 2 +- backend/package.json | 2 +- database/package.json | 2 +- frontend/package.json | 2 +- package.json | 2 +- 6 files changed, 25 insertions(+), 5 deletions(-) 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/backend/package.json b/backend/package.json index 08a9bf54d..db34fac6e 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", diff --git a/database/package.json b/database/package.json index 95fd9a791..91bcce3f7 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", 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/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", From 73fb123036fff3926c926b4688593391115d2d55 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Fri, 10 Mar 2023 11:54:28 +0100 Subject: [PATCH 2/3] admin open creations query --- backend/src/auth/RIGHTS.ts | 1 + .../graphql/resolver/ContributionResolver.ts | 24 ++++++++----------- .../src/graphql/resolver/util/creations.ts | 18 +++++++++++++- 3 files changed, 28 insertions(+), 15 deletions(-) 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/graphql/resolver/ContributionResolver.ts b/backend/src/graphql/resolver/ContributionResolver.ts index 2469f60ba..ac4bfbac0 100644 --- a/backend/src/graphql/resolver/ContributionResolver.ts +++ b/backend/src/graphql/resolver/ContributionResolver.ts @@ -27,11 +27,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 { @@ -580,21 +580,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]) diff --git a/backend/src/graphql/resolver/util/creations.ts b/backend/src/graphql/resolver/util/creations.ts index b9ba2e69f..8453781ca 100644 --- a/backend/src/graphql/resolver/util/creations.ts +++ b/backend/src/graphql/resolver/util/creations.ts @@ -4,6 +4,7 @@ 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 +101,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 +153,18 @@ export const updateCreations = ( export const isValidDateString = (dateString: string): boolean => { return new Date(dateString).toString() !== 'Invalid Date' } + +export const getOpenCreations = async ( + id: number, + timezoneOffset: number, +): Promise => { + const creations = await getUserCreation(id, timezoneOffset) + const creationDates = getCreationDates(timezoneOffset) + return creationDates.map((date, index) => { + return { + month: date.getMonth(), + year: date.getFullYear(), + amount: creations[index], + } + }) +} From 2af31b6bfddc994c5cc263d3d33a587ec3e8dff3 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Fri, 10 Mar 2023 11:59:01 +0100 Subject: [PATCH 3/3] better arg name --- backend/src/graphql/resolver/util/creations.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/graphql/resolver/util/creations.ts b/backend/src/graphql/resolver/util/creations.ts index 8453781ca..db1cd7d8c 100644 --- a/backend/src/graphql/resolver/util/creations.ts +++ b/backend/src/graphql/resolver/util/creations.ts @@ -155,10 +155,10 @@ export const isValidDateString = (dateString: string): boolean => { } export const getOpenCreations = async ( - id: number, + userId: number, timezoneOffset: number, ): Promise => { - const creations = await getUserCreation(id, timezoneOffset) + const creations = await getUserCreation(userId, timezoneOffset) const creationDates = getCreationDates(timezoneOffset) return creationDates.map((date, index) => { return {