From b70565cabf0d888c4038043cb90262ebdce8f75d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus-Peter=20H=C3=BCbner?= Date: Thu, 26 Jan 2023 00:33:42 +0100 Subject: [PATCH 001/181] remove TestResolvers from previous PR "multiple graphql endpoints" --- .../src/graphql/api/1_0/resolver/Test2Resolver.ts | 12 ------------ .../src/graphql/api/1_0/resolver/TestResolver.ts | 12 ------------ .../src/graphql/api/1_1/resolver/TestResolver.ts | 12 ------------ .../src/graphql/api/2_0/resolver/TestResolver.ts | 12 ------------ 4 files changed, 48 deletions(-) delete mode 100644 federation/src/graphql/api/1_0/resolver/Test2Resolver.ts delete mode 100644 federation/src/graphql/api/1_0/resolver/TestResolver.ts delete mode 100644 federation/src/graphql/api/1_1/resolver/TestResolver.ts delete mode 100644 federation/src/graphql/api/2_0/resolver/TestResolver.ts diff --git a/federation/src/graphql/api/1_0/resolver/Test2Resolver.ts b/federation/src/graphql/api/1_0/resolver/Test2Resolver.ts deleted file mode 100644 index 3388003b8..000000000 --- a/federation/src/graphql/api/1_0/resolver/Test2Resolver.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Query, Resolver } from 'type-graphql' -import { federationLogger as logger } from '@/server/logger' -import { GetTestApiResult } from '../../GetTestApiResult' - -@Resolver() -export class Test2Resolver { - @Query(() => GetTestApiResult) - async test2(): Promise { - logger.info(`test api 2 1_0`) - return new GetTestApiResult('1_0') - } -} diff --git a/federation/src/graphql/api/1_0/resolver/TestResolver.ts b/federation/src/graphql/api/1_0/resolver/TestResolver.ts deleted file mode 100644 index 7291e5ef2..000000000 --- a/federation/src/graphql/api/1_0/resolver/TestResolver.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Field, ObjectType, Query, Resolver } from 'type-graphql' -import { federationLogger as logger } from '@/server/logger' -import { GetTestApiResult } from '../../GetTestApiResult' - -@Resolver() -export class TestResolver { - @Query(() => GetTestApiResult) - async test(): Promise { - logger.info(`test api 1_0`) - return new GetTestApiResult('1_0') - } -} diff --git a/federation/src/graphql/api/1_1/resolver/TestResolver.ts b/federation/src/graphql/api/1_1/resolver/TestResolver.ts deleted file mode 100644 index 8880cad6e..000000000 --- a/federation/src/graphql/api/1_1/resolver/TestResolver.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Field, ObjectType, Query, Resolver } from 'type-graphql' -import { federationLogger as logger } from '@/server/logger' -import { GetTestApiResult } from '../../GetTestApiResult' - -@Resolver() -export class TestResolver { - @Query(() => GetTestApiResult) - async test(): Promise { - logger.info(`test api 1_1`) - return new GetTestApiResult('1_1') - } -} diff --git a/federation/src/graphql/api/2_0/resolver/TestResolver.ts b/federation/src/graphql/api/2_0/resolver/TestResolver.ts deleted file mode 100644 index f50149e33..000000000 --- a/federation/src/graphql/api/2_0/resolver/TestResolver.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Field, ObjectType, Query, Resolver } from 'type-graphql' -import { federationLogger as logger } from '@/server/logger' -import { GetTestApiResult } from '../../GetTestApiResult' - -@Resolver() -export class TestResolver { - @Query(() => GetTestApiResult) - async test(): Promise { - logger.info(`test api 2_0`) - return new GetTestApiResult('2_0') - } -} From a05c2307ee4becd498ec85509d09e213810e5a41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus-Peter=20H=C3=BCbner?= Date: Thu, 26 Jan 2023 00:34:45 +0100 Subject: [PATCH 002/181] add columns to communities table --- backend/src/config/index.ts | 2 +- .../Community.ts | 48 +++++++++++++++++++ database/entity/Community.ts | 2 +- .../0060-update_communities_table.ts | 22 +++++++++ federation/src/config/index.ts | 2 +- 5 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 database/entity/0060-update_communities_table/Community.ts create mode 100644 database/migrations/0060-update_communities_table.ts diff --git a/backend/src/config/index.ts b/backend/src/config/index.ts index d010b4ab0..3b8d0d1d6 100644 --- a/backend/src/config/index.ts +++ b/backend/src/config/index.ts @@ -10,7 +10,7 @@ Decimal.set({ }) const constants = { - DB_VERSION: '0059-add_hide_amount_to_users', + DB_VERSION: '0060-update_communities_table', DECAY_START_TIME: new Date('2021-05-13 17:46:31-0000'), // GMT+0 LOG4JS_CONFIG: 'log4js-config.json', // default log level on production should be info diff --git a/database/entity/0060-update_communities_table/Community.ts b/database/entity/0060-update_communities_table/Community.ts new file mode 100644 index 000000000..3a9082667 --- /dev/null +++ b/database/entity/0060-update_communities_table/Community.ts @@ -0,0 +1,48 @@ +import { + BaseEntity, + Entity, + PrimaryGeneratedColumn, + Column, + CreateDateColumn, + UpdateDateColumn, +} from 'typeorm' + +@Entity('communities') +export class Community extends BaseEntity { + @PrimaryGeneratedColumn('increment', { unsigned: true }) + id: number + + @Column({ name: 'foreign', type: 'bool', nullable: false, default: false }) + foreign: boolean + + @Column({ name: 'public_key', type: 'binary', length: 64, default: null, nullable: true }) + publicKey: Buffer + + @Column({ name: 'api_version', length: 10, nullable: false }) + apiVersion: string + + @Column({ name: 'end_point', length: 255, nullable: false }) + endPoint: string + + @Column({ name: 'last_announced_at', type: 'datetime', nullable: false }) + lastAnnouncedAt: Date + + @Column({ name: 'pubkey_verified_at', type: 'datetime', nullable: false }) + pubKeyVerifiedAt: Date + + @CreateDateColumn({ + name: 'created_at', + type: 'datetime', + default: () => 'CURRENT_TIMESTAMP(3)', + nullable: false, + }) + createdAt: Date + + @UpdateDateColumn({ + name: 'updated_at', + type: 'datetime', + onUpdate: 'CURRENT_TIMESTAMP(3)', + nullable: true, + }) + updatedAt: Date | null +} diff --git a/database/entity/Community.ts b/database/entity/Community.ts index 457d03eae..80e5ace30 100644 --- a/database/entity/Community.ts +++ b/database/entity/Community.ts @@ -1 +1 @@ -export { Community } from './0058-add_communities_table/Community' +export { Community } from './0060-update_communities_table/Community' diff --git a/database/migrations/0060-update_communities_table.ts b/database/migrations/0060-update_communities_table.ts new file mode 100644 index 000000000..1047481ee --- /dev/null +++ b/database/migrations/0060-update_communities_table.ts @@ -0,0 +1,22 @@ +/* MIGRATION TO CREATE THE FEDERATION COMMUNITY TABLES + * + * This migration creates the `community` and 'communityfederation' tables in the `apollo` database (`gradido_community`). + */ + +/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ +/* eslint-disable @typescript-eslint/no-explicit-any */ + +export async function upgrade(queryFn: (query: string, values?: any[]) => Promise>) { + await queryFn( + 'ALTER TABLE `communities` ADD COLUMN `foreign` tinyint(4) NOT NULL DEFAULT 0 AFTER `id`;', + ) + await queryFn( + 'ALTER TABLE `communities` ADD COLUMN `pubkey_verified_at` datetime(3) AFTER `last_announced_at`;', + ) +} + +export async function downgrade(queryFn: (query: string, values?: any[]) => Promise>) { + // write downgrade logic as parameter of queryFn + await queryFn('ALTER TABLE communities DROP COLUMN foreign;') + await queryFn('ALTER TABLE communities DROP COLUMN pubkey_verified_at;') +} diff --git a/federation/src/config/index.ts b/federation/src/config/index.ts index c2d81d2c8..2404c610f 100644 --- a/federation/src/config/index.ts +++ b/federation/src/config/index.ts @@ -11,7 +11,7 @@ Decimal.set({ */ const constants = { - DB_VERSION: '0059-add_hide_amount_to_users', + DB_VERSION: '0060-update_communities_table', // DECAY_START_TIME: new Date('2021-05-13 17:46:31-0000'), // GMT+0 LOG4JS_CONFIG: 'log4js-config.json', // default log level on production should be info From 4e1a6d965e620311c4d2f9678901accaa5299e56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus-Peter=20H=C3=BCbner?= Date: Thu, 26 Jan 2023 00:35:28 +0100 Subject: [PATCH 003/181] create graphql endpoint for GetPublicKey request --- .../api/1_0/model/GetPublicKeyResult.ts | 11 +++++++++++ .../api/1_0/resolver/PublicKeyResolver.ts | 18 ++++++++++++++++++ federation/src/graphql/api/GetTestApiResult.ts | 11 ----------- 3 files changed, 29 insertions(+), 11 deletions(-) create mode 100644 federation/src/graphql/api/1_0/model/GetPublicKeyResult.ts create mode 100644 federation/src/graphql/api/1_0/resolver/PublicKeyResolver.ts delete mode 100644 federation/src/graphql/api/GetTestApiResult.ts diff --git a/federation/src/graphql/api/1_0/model/GetPublicKeyResult.ts b/federation/src/graphql/api/1_0/model/GetPublicKeyResult.ts new file mode 100644 index 000000000..1582ad892 --- /dev/null +++ b/federation/src/graphql/api/1_0/model/GetPublicKeyResult.ts @@ -0,0 +1,11 @@ +import { Field, ObjectType } from 'type-graphql' + +@ObjectType() +export class GetPublicKeyResult { + constructor(pubKey: string) { + this.publicKey = pubKey + } + + @Field(() => String) + publicKey: string +} diff --git a/federation/src/graphql/api/1_0/resolver/PublicKeyResolver.ts b/federation/src/graphql/api/1_0/resolver/PublicKeyResolver.ts new file mode 100644 index 000000000..53f0d0bd4 --- /dev/null +++ b/federation/src/graphql/api/1_0/resolver/PublicKeyResolver.ts @@ -0,0 +1,18 @@ +import { Field, ObjectType, Query, Resolver } from 'type-graphql' +import { federationLogger as logger } from '@/server/logger' +import { Community as DbCommunity } from '@entity/Community' +import { GetPublicKeyResult } from '../model/GetPublicKeyResult' + +@Resolver() +export class PublicKeyResolver { + @Query(() => GetPublicKeyResult) + async getPublicKey(): Promise { + logger.info(`getPublicKey()...`) + const homeCom = await DbCommunity.findOneOrFail({ + foreign: false, + apiVersion: '1_0', + }) + logger.info(`getPublicKey()... with publicKey=${homeCom.publicKey}`) + return new GetPublicKeyResult(homeCom.publicKey.toString()) + } +} diff --git a/federation/src/graphql/api/GetTestApiResult.ts b/federation/src/graphql/api/GetTestApiResult.ts deleted file mode 100644 index 7c8c6c487..000000000 --- a/federation/src/graphql/api/GetTestApiResult.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Field, ObjectType } from 'type-graphql' - -@ObjectType() -export class GetTestApiResult { - constructor(apiVersion: string) { - this.api = apiVersion - } - - @Field(() => String) - api: string -} From ae2097ff71439eab415573420b565c4bf25a321d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus-Peter=20H=C3=BCbner?= Date: Fri, 27 Jan 2023 21:55:43 +0100 Subject: [PATCH 004/181] rename pubkeyVerifiedAt to verifiedAt --- database/entity/0060-update_communities_table/Community.ts | 4 ++-- database/migrations/0060-update_communities_table.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/database/entity/0060-update_communities_table/Community.ts b/database/entity/0060-update_communities_table/Community.ts index 3a9082667..73f098f46 100644 --- a/database/entity/0060-update_communities_table/Community.ts +++ b/database/entity/0060-update_communities_table/Community.ts @@ -27,8 +27,8 @@ export class Community extends BaseEntity { @Column({ name: 'last_announced_at', type: 'datetime', nullable: false }) lastAnnouncedAt: Date - @Column({ name: 'pubkey_verified_at', type: 'datetime', nullable: false }) - pubKeyVerifiedAt: Date + @Column({ name: 'verified_at', type: 'datetime', nullable: false }) + verifiedAt: Date @CreateDateColumn({ name: 'created_at', diff --git a/database/migrations/0060-update_communities_table.ts b/database/migrations/0060-update_communities_table.ts index 1047481ee..1e1b8411e 100644 --- a/database/migrations/0060-update_communities_table.ts +++ b/database/migrations/0060-update_communities_table.ts @@ -11,12 +11,12 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis 'ALTER TABLE `communities` ADD COLUMN `foreign` tinyint(4) NOT NULL DEFAULT 0 AFTER `id`;', ) await queryFn( - 'ALTER TABLE `communities` ADD COLUMN `pubkey_verified_at` datetime(3) AFTER `last_announced_at`;', + 'ALTER TABLE `communities` ADD COLUMN `verified_at` datetime(3) AFTER `last_announced_at`;', ) } export async function downgrade(queryFn: (query: string, values?: any[]) => Promise>) { // write downgrade logic as parameter of queryFn await queryFn('ALTER TABLE communities DROP COLUMN foreign;') - await queryFn('ALTER TABLE communities DROP COLUMN pubkey_verified_at;') + await queryFn('ALTER TABLE communities DROP COLUMN verified_at;') } From b542f6c81e8a2b1c38e1a394a289851b1b106b9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus-Peter=20H=C3=BCbner?= Date: Tue, 31 Jan 2023 01:02:20 +0100 Subject: [PATCH 005/181] add column last_error_at --- database/entity/0060-update_communities_table/Community.ts | 3 +++ database/migrations/0060-update_communities_table.ts | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/database/entity/0060-update_communities_table/Community.ts b/database/entity/0060-update_communities_table/Community.ts index 73f098f46..227400fdf 100644 --- a/database/entity/0060-update_communities_table/Community.ts +++ b/database/entity/0060-update_communities_table/Community.ts @@ -30,6 +30,9 @@ export class Community extends BaseEntity { @Column({ name: 'verified_at', type: 'datetime', nullable: false }) verifiedAt: Date + @Column({ name: 'last_error_at', type: 'datetime', nullable: false }) + lastErrorAt: Date + @CreateDateColumn({ name: 'created_at', type: 'datetime', diff --git a/database/migrations/0060-update_communities_table.ts b/database/migrations/0060-update_communities_table.ts index 1e1b8411e..55617fd0a 100644 --- a/database/migrations/0060-update_communities_table.ts +++ b/database/migrations/0060-update_communities_table.ts @@ -13,10 +13,14 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis await queryFn( 'ALTER TABLE `communities` ADD COLUMN `verified_at` datetime(3) AFTER `last_announced_at`;', ) + await queryFn( + 'ALTER TABLE `communities` ADD COLUMN `last_error_at` datetime(3) AFTER `verified_at`;', + ) } export async function downgrade(queryFn: (query: string, values?: any[]) => Promise>) { // write downgrade logic as parameter of queryFn await queryFn('ALTER TABLE communities DROP COLUMN foreign;') await queryFn('ALTER TABLE communities DROP COLUMN verified_at;') + await queryFn('ALTER TABLE communities DROP COLUMN last_error_at;') } From 72f882add3ffade6dd3c0dd67bca0048a1ad987f Mon Sep 17 00:00:00 2001 From: clauspeterhuebner <86960882+clauspeterhuebner@users.noreply.github.com> Date: Tue, 7 Feb 2023 22:34:30 +0100 Subject: [PATCH 006/181] Update database/migrations/0060-update_communities_table.ts Co-authored-by: Moriz Wahl --- database/migrations/0060-update_communities_table.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/migrations/0060-update_communities_table.ts b/database/migrations/0060-update_communities_table.ts index 55617fd0a..1804ee6c7 100644 --- a/database/migrations/0060-update_communities_table.ts +++ b/database/migrations/0060-update_communities_table.ts @@ -8,7 +8,7 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promise>) { await queryFn( - 'ALTER TABLE `communities` ADD COLUMN `foreign` tinyint(4) NOT NULL DEFAULT 0 AFTER `id`;', + 'ALTER TABLE `communities` ADD COLUMN `foreign` tinyint(4) NOT NULL DEFAULT 1 AFTER `id`;', ) await queryFn( 'ALTER TABLE `communities` ADD COLUMN `verified_at` datetime(3) AFTER `last_announced_at`;', From fcab712f86468e5a19311f9284acd99a404f3bfd Mon Sep 17 00:00:00 2001 From: clauspeterhuebner <86960882+clauspeterhuebner@users.noreply.github.com> Date: Tue, 7 Feb 2023 22:35:12 +0100 Subject: [PATCH 007/181] Update database/entity/0060-update_communities_table/Community.ts Co-authored-by: Moriz Wahl --- database/entity/0060-update_communities_table/Community.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/entity/0060-update_communities_table/Community.ts b/database/entity/0060-update_communities_table/Community.ts index 227400fdf..d764fc98f 100644 --- a/database/entity/0060-update_communities_table/Community.ts +++ b/database/entity/0060-update_communities_table/Community.ts @@ -12,7 +12,7 @@ export class Community extends BaseEntity { @PrimaryGeneratedColumn('increment', { unsigned: true }) id: number - @Column({ name: 'foreign', type: 'bool', nullable: false, default: false }) + @Column({ name: 'foreign', type: 'bool', nullable: false, default: true }) foreign: boolean @Column({ name: 'public_key', type: 'binary', length: 64, default: null, nullable: true }) From 0d6fb2a427f1c294fe2c7cbca0f6f17180a2d6d5 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 16 Feb 2023 19:16:33 +0100 Subject: [PATCH 008/181] started event refactoring on database level --- .../entity/0061-event_refactoring/Event.ts | 82 +++++++++++++++++++ database/entity/Event.ts | 1 + database/entity/EventProtocol.ts | 1 - database/entity/index.ts | 8 +- database/migrations/0061-event_refactoring.ts | 33 ++++++++ 5 files changed, 120 insertions(+), 5 deletions(-) create mode 100644 database/entity/0061-event_refactoring/Event.ts create mode 100644 database/entity/Event.ts delete mode 100644 database/entity/EventProtocol.ts create mode 100644 database/migrations/0061-event_refactoring.ts diff --git a/database/entity/0061-event_refactoring/Event.ts b/database/entity/0061-event_refactoring/Event.ts new file mode 100644 index 000000000..62f517aba --- /dev/null +++ b/database/entity/0061-event_refactoring/Event.ts @@ -0,0 +1,82 @@ +import { Contribution } from '@entity/Contribution' +import { ContributionMessage } from '@entity/ContributionMessage' +import { User } from '@entity/User' +import Decimal from 'decimal.js-light' +import { BaseEntity, Entity, PrimaryGeneratedColumn, Column, Transaction } from 'typeorm' +import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' + +@Entity('event') +// TODO tablename event_protocol +export class Event extends BaseEntity { + @PrimaryGeneratedColumn('increment', { unsigned: true }) + id: number + + @Column({ length: 100, nullable: false, collation: 'utf8mb4_unicode_ci' }) + type: string + + // TODO proper field type + @Column({ name: 'created_at', type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) + createdAt: Date + + // TODO field name user_id + // @Column({ name: 'affected_user_id', unsigned: true, nullable: false }) + // affectedUserId: number + + @ManyToOne(() => User) + @JoinColumn({ name: 'affected_user_id', referencedColumnName: 'id' }) + affectedUser: User | null + + // TODO new column + // TODO potentially save actingRole aswell + // @Column({ name: 'acting_user_id', unsigned: true, nullable: false }) + // actingUserId: number + + @ManyToOne(() => User) + @JoinColumn({ name: 'acting_user_id', referencedColumnName: 'id' }) + actingUser: User | null + + // TODO rename column x_user_id + // @Column({ name: 'involved_user_id', type: 'int', unsigned: true, nullable: true }) + // involvedUserId: number | null + + @ManyToOne(() => User) + @JoinColumn({ name: 'involved_user_id', referencedColumnName: 'id' }) + involvedUser: User | null + + // TODO drop column xCommunityId + + // TODO rename column transaction_id + // @Column({ name: 'involved_transaction_id', type: 'int', unsigned: true, nullable: true }) + // involvedTransactionId: number | null + + @ManyToOne(() => Transaction) + @JoinColumn({ name: 'involved_transaction_id', referencedColumnName: 'id' }) + involvedTransaction: Transaction | null + + // TODO rename column contribution_id + // @Column({ name: 'involved_contribution_id', type: 'int', unsigned: true, nullable: true }) + // involvedContributionId: number | null + + @ManyToOne(() => Contribution) + @JoinColumn({ name: 'involved_contribution_id', referencedColumnName: 'id' }) + involvedContribution: Contribution | null + + // TODO move column + // TODO rename column message_id + // TEST do we need the Id field definition? + // @Column({ name: 'involved_contribution_message_id', type: 'int', unsigned: true, nullable: true }) + // involvedContributionMessageId: number | null + + @ManyToOne(() => ContributionMessage) + @JoinColumn({ name: 'involved_contribution_message_id', referencedColumnName: 'id' }) + involvedContributionMessage: ContributionMessage | null + + @Column({ + type: 'decimal', + precision: 40, + scale: 20, + nullable: true, + transformer: DecimalTransformer, + }) + amount: Decimal | null +} diff --git a/database/entity/Event.ts b/database/entity/Event.ts new file mode 100644 index 000000000..e53085f2f --- /dev/null +++ b/database/entity/Event.ts @@ -0,0 +1 @@ +export { Event } from './0061-event_refactoring/Event' diff --git a/database/entity/EventProtocol.ts b/database/entity/EventProtocol.ts deleted file mode 100644 index 6ebbd3d68..000000000 --- a/database/entity/EventProtocol.ts +++ /dev/null @@ -1 +0,0 @@ -export { EventProtocol } from './0050-add_messageId_to_event_protocol/EventProtocol' diff --git a/database/entity/index.ts b/database/entity/index.ts index a58afb816..2d9d04c3b 100644 --- a/database/entity/index.ts +++ b/database/entity/index.ts @@ -7,21 +7,21 @@ import { TransactionLink } from './TransactionLink' import { User } from './User' import { UserContact } from './UserContact' import { Contribution } from './Contribution' -import { EventProtocol } from './EventProtocol' +import { Event } from './Event' import { ContributionMessage } from './ContributionMessage' import { Community } from './Community' export const entities = [ + Community, Contribution, ContributionLink, + ContributionMessage, + Event, LoginElopageBuys, LoginEmailOptIn, Migration, Transaction, TransactionLink, User, - EventProtocol, - ContributionMessage, UserContact, - Community, ] diff --git a/database/migrations/0061-event_refactoring.ts b/database/migrations/0061-event_refactoring.ts new file mode 100644 index 000000000..a5ce50595 --- /dev/null +++ b/database/migrations/0061-event_refactoring.ts @@ -0,0 +1,33 @@ +/* MIGRATION TO REFACTOR THE EVENT_PROTOCOL TABLE + * + * This migration refactors the `event_protocol` table. + * It renames the table to `event`, introduces new fields and renames others. + */ + +/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ +/* eslint-disable @typescript-eslint/no-explicit-any */ + +export async function upgrade(queryFn: (query: string, values?: any[]) => Promise>) { + await queryFn( + 'ALTER TABLE `communities` MODIFY COLUMN `last_announced_at` datetime(3) AFTER `end_point`;', + ) + await queryFn( + 'ALTER TABLE `communities` ADD COLUMN `foreign` tinyint(4) NOT NULL DEFAULT 1 AFTER `id`;', + ) + await queryFn( + 'ALTER TABLE `communities` ADD COLUMN `verified_at` datetime(3) AFTER `last_announced_at`;', + ) + await queryFn( + 'ALTER TABLE `communities` ADD COLUMN `last_error_at` datetime(3) AFTER `verified_at`;', + ) +} + +export async function downgrade(queryFn: (query: string, values?: any[]) => Promise>) { + // write downgrade logic as parameter of queryFn + await queryFn( + 'ALTER TABLE `communities` MODIFY COLUMN `last_announced_at` datetime(3) NOT NULL AFTER `end_point`;', + ) + await queryFn('ALTER TABLE `communities` DROP COLUMN `foreign`;') + await queryFn('ALTER TABLE `communities` DROP COLUMN `verified_at`;') + await queryFn('ALTER TABLE `communities` DROP COLUMN `last_error_at`;') +} From 225a8239ec028c4b1433800acc3affae7760c69b Mon Sep 17 00:00:00 2001 From: mahula Date: Fri, 17 Feb 2023 09:57:53 +0100 Subject: [PATCH 009/181] move all backend jobs to separate workflow file --- .github/workflows/test-admin-interface.yml | 69 ++++++++++++ .github/workflows/test.yml | 124 +-------------------- 2 files changed, 74 insertions(+), 119 deletions(-) create mode 100644 .github/workflows/test-admin-interface.yml diff --git a/.github/workflows/test-admin-interface.yml b/.github/workflows/test-admin-interface.yml new file mode 100644 index 000000000..d126a9075 --- /dev/null +++ b/.github/workflows/test-admin-interface.yml @@ -0,0 +1,69 @@ +name: Gradido Admin Interface Test CI + +on: + push: + branches: + - separate-admin-interface-workflow + +jobs: + build_test_admin: + name: Docker Build Test - Admin Interface + runs-on: ubuntu-latest + steps: + + - name: Checkout code + uses: actions/checkout@v3 + + - name: Admin Interface | Build 'test' image + run: docker build --target test -t "gradido/admin:test" admin/ --build-arg NODE_ENV="test" + + unit_test_admin: + name: Unit Tests - Admin Interface + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Admin Interface | Unit tests + run: | + cd admin && yarn && yarn run test + cp -r ./coverage ../ + + - name: Admin Interface | Coverage check + uses: webcraftmedia/coverage-check-action@master + with: + report_name: Coverage Admin Interface + type: lcov + result_path: ./admin/coverage/lcov.info + min_coverage: 97 + token: ${{ github.token }} + + lint_admin: + name: Lint - Admin Interface + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Admin Interface | Lint + run: cd admin && yarn && yarn run lint + + stylelint_admin: + name: Stylelint - Admin Interface + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Admin Interface | Stylelint + run: cd admin && yarn && yarn run stylelint + + locales_admin: + name: Locales - Admin Interface + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Admin Interface | Locales + run: cd admin && yarn && yarn run locales diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index badb47e87..722bef1c1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,9 @@ name: gradido test CI -on: push +on: + push: + branches: + - separate-admin-interface-workflow jobs: ############################################################################## @@ -29,31 +32,6 @@ jobs: name: docker-frontend-test path: /tmp/frontend.tar - ############################################################################## - # JOB: DOCKER BUILD TEST ADMIN INTERFACE ##################################### - ############################################################################## - build_test_admin: - name: Docker Build Test - Admin Interface - runs-on: ubuntu-latest - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # ADMIN INTERFACE ######################################################## - ########################################################################## - - name: Admin | Build `test` image - run: | - docker build --target test -t "gradido/admin:test" admin/ --build-arg NODE_ENV="test" - docker save "gradido/admin:test" > /tmp/admin.tar - - name: Upload Artifact - uses: actions/upload-artifact@v3 - with: - name: docker-admin-test - path: /tmp/admin.tar - ############################################################################## # JOB: DOCKER BUILD TEST BACKEND ############################################# ############################################################################## @@ -211,60 +189,6 @@ jobs: - name: Frontend | Stylelint run: cd frontend && yarn && yarn run stylelint - ############################################################################## - # JOB: LINT ADMIN INTERFACE ################################################## - ############################################################################## - lint_admin: - name: Lint - Admin Interface - runs-on: ubuntu-latest - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # LINT ADMIN INTERFACE ################################################### - ########################################################################## - - name: Admin Interface | Lint - run: cd admin && yarn && yarn run lint - - ############################################################################## - # JOB: STYLELINT ADMIN INTERFACE ############################################# - ############################################################################## - stylelint_admin: - name: Stylelint - Admin Interface - runs-on: ubuntu-latest - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # STYLELINT ADMIN INTERFACE ############################################## - ########################################################################## - - name: Admin Interface | Stylelint - run: cd admin && yarn && yarn run stylelint - - ############################################################################## - # JOB: LOCALES ADMIN ######################################################### - ############################################################################## - locales_admin: - name: Locales - Admin Interface - runs-on: ubuntu-latest - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # LOCALES FRONTEND ####################################################### - ########################################################################## - - name: Admin | Locales - run: cd admin && yarn && yarn run locales - ############################################################################## # JOB: LINT BACKEND ########################################################## ############################################################################## @@ -349,37 +273,6 @@ jobs: result_path: ./frontend/coverage/lcov.info min_coverage: 95 token: ${{ github.token }} - - ############################################################################## - # JOB: UNIT TEST ADMIN INTERFACE ############################################# - ############################################################################## - unit_test_admin: - name: Unit tests - Admin Interface - runs-on: ubuntu-latest - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v3 - ########################################################################## - # UNIT TESTS ADMIN INTERFACE ############################################# - ########################################################################## - - name: Admin Interface | Unit tests - run: | - cd admin && yarn && yarn run test - cp -r ./coverage ../ - ########################################################################## - # COVERAGE CHECK ADMIN INTERFACE ######################################### - ########################################################################## - - name: Admin Interface | Coverage check - uses: webcraftmedia/coverage-check-action@master - with: - report_name: Coverage Admin Interface - type: lcov - result_path: ./admin/coverage/lcov.info - min_coverage: 97 - token: ${{ github.token }} ############################################################################## # JOB: UNIT TEST BACKEND #################################################### @@ -459,7 +352,7 @@ jobs: end-to-end-tests: name: End-to-End Tests runs-on: ubuntu-latest - needs: [build_test_mariadb, build_test_database_up, build_test_admin, build_test_frontend, build_test_nginx] + needs: [build_test_mariadb, build_test_database_up, build_test_frontend, build_test_nginx] steps: ########################################################################## # CHECKOUT CODE ########################################################## @@ -490,13 +383,6 @@ jobs: path: /tmp - name: Load Docker Image (Frontend) run: docker load < /tmp/frontend.tar - - name: Download Docker Image (Admin Interface) - uses: actions/download-artifact@v3 - with: - name: docker-admin-test - path: /tmp - - name: Load Docker Image (Admin Interface) - run: docker load < /tmp/admin.tar - name: Download Docker Image (Nginx) uses: actions/download-artifact@v3 with: From 80a059b94d3cfaf0d33796e36e4f6d4b5b21e1ac Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 17 Feb 2023 11:49:26 +0100 Subject: [PATCH 010/181] properly import entities --- database/entity/0061-event_refactoring/Event.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/database/entity/0061-event_refactoring/Event.ts b/database/entity/0061-event_refactoring/Event.ts index 62f517aba..ca2ab58da 100644 --- a/database/entity/0061-event_refactoring/Event.ts +++ b/database/entity/0061-event_refactoring/Event.ts @@ -1,6 +1,6 @@ -import { Contribution } from '@entity/Contribution' -import { ContributionMessage } from '@entity/ContributionMessage' -import { User } from '@entity/User' +import { Contribution } from '../Contribution' +import { ContributionMessage } from '../ContributionMessage' +import { User } from '../User' import Decimal from 'decimal.js-light' import { BaseEntity, Entity, PrimaryGeneratedColumn, Column, Transaction } from 'typeorm' import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' From 6d8b11aeb8f3f15ce627e8a5d8c6bcc193c614f7 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 17 Feb 2023 14:47:31 +0100 Subject: [PATCH 011/181] finished up Table definition and migration --- .../entity/0061-event_refactoring/Event.ts | 24 +++-------- database/migrations/0061-event_refactoring.ts | 43 ++++++++++++++----- 2 files changed, 39 insertions(+), 28 deletions(-) diff --git a/database/entity/0061-event_refactoring/Event.ts b/database/entity/0061-event_refactoring/Event.ts index ca2ab58da..80b4238bb 100644 --- a/database/entity/0061-event_refactoring/Event.ts +++ b/database/entity/0061-event_refactoring/Event.ts @@ -1,12 +1,12 @@ import { Contribution } from '../Contribution' import { ContributionMessage } from '../ContributionMessage' import { User } from '../User' +import { Transaction } from '../Transaction' import Decimal from 'decimal.js-light' -import { BaseEntity, Entity, PrimaryGeneratedColumn, Column, Transaction } from 'typeorm' +import { BaseEntity, Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, ManyToOne, JoinColumn } from 'typeorm' import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' -@Entity('event') -// TODO tablename event_protocol +@Entity('events') export class Event extends BaseEntity { @PrimaryGeneratedColumn('increment', { unsigned: true }) id: number @@ -14,28 +14,24 @@ export class Event extends BaseEntity { @Column({ length: 100, nullable: false, collation: 'utf8mb4_unicode_ci' }) type: string - // TODO proper field type - @Column({ name: 'created_at', type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) + @CreateDateColumn({ name: 'created_at', type: 'datetime', default: () => 'CURRENT_TIMESTAMP()' , nullable: false }) createdAt: Date - // TODO field name user_id // @Column({ name: 'affected_user_id', unsigned: true, nullable: false }) // affectedUserId: number @ManyToOne(() => User) @JoinColumn({ name: 'affected_user_id', referencedColumnName: 'id' }) - affectedUser: User | null + affectedUser: User - // TODO new column - // TODO potentially save actingRole aswell + // TODO potentially save actingRole as well // @Column({ name: 'acting_user_id', unsigned: true, nullable: false }) // actingUserId: number @ManyToOne(() => User) @JoinColumn({ name: 'acting_user_id', referencedColumnName: 'id' }) - actingUser: User | null + actingUser: User - // TODO rename column x_user_id // @Column({ name: 'involved_user_id', type: 'int', unsigned: true, nullable: true }) // involvedUserId: number | null @@ -43,9 +39,6 @@ export class Event extends BaseEntity { @JoinColumn({ name: 'involved_user_id', referencedColumnName: 'id' }) involvedUser: User | null - // TODO drop column xCommunityId - - // TODO rename column transaction_id // @Column({ name: 'involved_transaction_id', type: 'int', unsigned: true, nullable: true }) // involvedTransactionId: number | null @@ -53,7 +46,6 @@ export class Event extends BaseEntity { @JoinColumn({ name: 'involved_transaction_id', referencedColumnName: 'id' }) involvedTransaction: Transaction | null - // TODO rename column contribution_id // @Column({ name: 'involved_contribution_id', type: 'int', unsigned: true, nullable: true }) // involvedContributionId: number | null @@ -61,8 +53,6 @@ export class Event extends BaseEntity { @JoinColumn({ name: 'involved_contribution_id', referencedColumnName: 'id' }) involvedContribution: Contribution | null - // TODO move column - // TODO rename column message_id // TEST do we need the Id field definition? // @Column({ name: 'involved_contribution_message_id', type: 'int', unsigned: true, nullable: true }) // involvedContributionMessageId: number | null diff --git a/database/migrations/0061-event_refactoring.ts b/database/migrations/0061-event_refactoring.ts index a5ce50595..88874b15e 100644 --- a/database/migrations/0061-event_refactoring.ts +++ b/database/migrations/0061-event_refactoring.ts @@ -8,26 +8,47 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ export async function upgrade(queryFn: (query: string, values?: any[]) => Promise>) { + await queryFn('RENAME TABLE `event_protocol` TO `events`;') + await queryFn('ALTER TABLE `events` RENAME COLUMN `user_id` TO `affected_user_id`;') + await queryFn( - 'ALTER TABLE `communities` MODIFY COLUMN `last_announced_at` datetime(3) AFTER `end_point`;', + 'ALTER TABLE `events` ADD COLUMN `acting_user_id` int(10) unsigned DEFAULT NULL AFTER `affected_user_id`;', + ) + await queryFn('UPDATE `events` SET `acting_user_id` = `affected_user_id`;') + await queryFn( + 'ALTER TABLE `events` MODIFY COLUMN `acting_user_id` int(10) unsigned NOT NULL AFTER `affected_user_id`;', + ) + + await queryFn('ALTER TABLE `events` RENAME COLUMN `x_user_id` TO `involved_user_id`;') + await queryFn('ALTER TABLE `events` DROP COLUMN `x_community_id`;') + await queryFn('ALTER TABLE `events` RENAME COLUMN `transaction_id` TO `involved_transaction_id`;') + await queryFn( + 'ALTER TABLE `events` RENAME COLUMN `contribution_id` TO `involved_contribution_id`;', ) await queryFn( - 'ALTER TABLE `communities` ADD COLUMN `foreign` tinyint(4) NOT NULL DEFAULT 1 AFTER `id`;', + 'ALTER TABLE `events` MODIFY COLUMN `message_id` int(10) unsigned DEFAULT NULL AFTER `involved_contribution_id`;', ) await queryFn( - 'ALTER TABLE `communities` ADD COLUMN `verified_at` datetime(3) AFTER `last_announced_at`;', - ) - await queryFn( - 'ALTER TABLE `communities` ADD COLUMN `last_error_at` datetime(3) AFTER `verified_at`;', + 'ALTER TABLE `events` RENAME COLUMN `message_id` TO `involved_contribution_message_id`;', ) } export async function downgrade(queryFn: (query: string, values?: any[]) => Promise>) { - // write downgrade logic as parameter of queryFn await queryFn( - 'ALTER TABLE `communities` MODIFY COLUMN `last_announced_at` datetime(3) NOT NULL AFTER `end_point`;', + 'ALTER TABLE `events` RENAME COLUMN `involved_contribution_message_id` TO `message_id`;', ) - await queryFn('ALTER TABLE `communities` DROP COLUMN `foreign`;') - await queryFn('ALTER TABLE `communities` DROP COLUMN `verified_at`;') - await queryFn('ALTER TABLE `communities` DROP COLUMN `last_error_at`;') + await queryFn( + 'ALTER TABLE `events` MODIFY COLUMN `message_id` int(10) unsigned DEFAULT NULL AFTER `amount`;', + ) + await queryFn( + 'ALTER TABLE `events` RENAME COLUMN `involved_contribution_id` TO `contribution_id`;', + ) + await queryFn('ALTER TABLE `events` RENAME COLUMN `involved_transaction_id` TO `transaction_id`;') + await queryFn( + 'ALTER TABLE `events` ADD COLUMN `x_community_id` int(10) unsigned DEFAULT NULL AFTER `involved_user_id`;', + ) + await queryFn('ALTER TABLE `events` RENAME COLUMN `involved_user_id` TO `x_user_id`;') + await queryFn('ALTER TABLE `events` DROP COLUMN `acting_user_id`;') + await queryFn('ALTER TABLE `events` RENAME COLUMN `affected_user_id` TO `user_id`;') + await queryFn('RENAME TABLE `events` TO `event_protocol`;') } From 5aef000520129810dbf5b2e2964c6e970762ac11 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 17 Feb 2023 14:53:07 +0100 Subject: [PATCH 012/181] lint fixes --- database/entity/0061-event_refactoring/Event.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/database/entity/0061-event_refactoring/Event.ts b/database/entity/0061-event_refactoring/Event.ts index 80b4238bb..5a62fcdc2 100644 --- a/database/entity/0061-event_refactoring/Event.ts +++ b/database/entity/0061-event_refactoring/Event.ts @@ -3,7 +3,15 @@ import { ContributionMessage } from '../ContributionMessage' import { User } from '../User' import { Transaction } from '../Transaction' import Decimal from 'decimal.js-light' -import { BaseEntity, Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, ManyToOne, JoinColumn } from 'typeorm' +import { + BaseEntity, + Entity, + PrimaryGeneratedColumn, + Column, + CreateDateColumn, + ManyToOne, + JoinColumn, +} from 'typeorm' import { DecimalTransformer } from '../../src/typeorm/DecimalTransformer' @Entity('events') @@ -14,7 +22,12 @@ export class Event extends BaseEntity { @Column({ length: 100, nullable: false, collation: 'utf8mb4_unicode_ci' }) type: string - @CreateDateColumn({ name: 'created_at', type: 'datetime', default: () => 'CURRENT_TIMESTAMP()' , nullable: false }) + @CreateDateColumn({ + name: 'created_at', + type: 'datetime', + default: () => 'CURRENT_TIMESTAMP()', + nullable: false, + }) createdAt: Date // @Column({ name: 'affected_user_id', unsigned: true, nullable: false }) From d8f2843a55c8079e6268981f03b0229af6c24025 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 18 Feb 2023 00:11:29 +0100 Subject: [PATCH 013/181] fix database version requirement of dht-node & federation --- dht-node/src/config/index.ts | 2 +- federation/src/config/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dht-node/src/config/index.ts b/dht-node/src/config/index.ts index 8210ddfcc..6ba9493ac 100644 --- a/dht-node/src/config/index.ts +++ b/dht-node/src/config/index.ts @@ -3,7 +3,7 @@ import dotenv from 'dotenv' dotenv.config() const constants = { - DB_VERSION: '0060-update_communities_table', + DB_VERSION: '0061-event_refactoring', LOG4JS_CONFIG: 'log4js-config.json', // default log level on production should be info LOG_LEVEL: process.env.LOG_LEVEL || 'info', diff --git a/federation/src/config/index.ts b/federation/src/config/index.ts index c8a841315..6b3bf6424 100644 --- a/federation/src/config/index.ts +++ b/federation/src/config/index.ts @@ -11,7 +11,7 @@ Decimal.set({ */ const constants = { - DB_VERSION: '0060-update_communities_table', + DB_VERSION: '0060-0061-event_refactoring', // DECAY_START_TIME: new Date('2021-05-13 17:46:31-0000'), // GMT+0 LOG4JS_CONFIG: 'log4js-config.json', // default log level on production should be info From fde67c2c32b61e4cfaec449f641d331aa6410a3f Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 18 Feb 2023 00:12:36 +0100 Subject: [PATCH 014/181] todo event data refactoring --- database/migrations/0061-event_refactoring.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/database/migrations/0061-event_refactoring.ts b/database/migrations/0061-event_refactoring.ts index 88874b15e..2fdc7dcef 100644 --- a/database/migrations/0061-event_refactoring.ts +++ b/database/migrations/0061-event_refactoring.ts @@ -31,6 +31,8 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis await queryFn( 'ALTER TABLE `events` RENAME COLUMN `message_id` TO `involved_contribution_message_id`;', ) + + // TODO insert data based on event type } export async function downgrade(queryFn: (query: string, values?: any[]) => Promise>) { From 41569ad0f11b91ff8299dde0a255b0c3af2876b7 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 18 Feb 2023 01:08:06 +0100 Subject: [PATCH 015/181] refactor events - first step to get backend working --- backend/src/config/index.ts | 2 +- backend/src/event/Event.ts | 192 ++++++++++-------- .../resolver/ContributionResolver.test.ts | 22 +- .../graphql/resolver/ContributionResolver.ts | 31 ++- .../resolver/TransactionResolver.test.ts | 6 +- .../graphql/resolver/TransactionResolver.ts | 13 +- .../src/graphql/resolver/UserResolver.test.ts | 20 +- backend/src/graphql/resolver/UserResolver.ts | 35 +++- 8 files changed, 182 insertions(+), 139 deletions(-) diff --git a/backend/src/config/index.ts b/backend/src/config/index.ts index 27b51b47d..961d83219 100644 --- a/backend/src/config/index.ts +++ b/backend/src/config/index.ts @@ -10,7 +10,7 @@ Decimal.set({ }) const constants = { - DB_VERSION: '0060-update_communities_table', + DB_VERSION: '0061-event_refactoring', DECAY_START_TIME: new Date('2021-05-13 17:46:31-0000'), // GMT+0 LOG4JS_CONFIG: 'log4js-config.json', // default log level on production should be info diff --git a/backend/src/event/Event.ts b/backend/src/event/Event.ts index 8e65d85f2..5ba21fe19 100644 --- a/backend/src/event/Event.ts +++ b/backend/src/event/Event.ts @@ -1,212 +1,230 @@ -import { EventProtocol as DbEvent } from '@entity/EventProtocol' +import { Event as DbEvent } from '@entity/Event' +import { User as DbUser } from '@entity/User' +import { ContributionMessage as DbContributionMessage } from '@entity/ContributionMessage' +import { Contribution as DbContribution } from '@entity/Contribution' +import { Transaction as DbTransaction } from '@entity/Transaction' import Decimal from 'decimal.js-light' import { EventProtocolType } from './EventProtocolType' export const Event = ( type: EventProtocolType, - userId: number, - xUserId: number | null = null, - xCommunityId: number | null = null, - transactionId: number | null = null, - contributionId: number | null = null, + affectedUser: DbUser, + actingUser: DbUser, + involvedUser: DbUser | null = null, + involvedTransaction: DbTransaction | null = null, + involvedContribution: DbContribution | null = null, + involvedContributionMessage: DbContributionMessage | null = null, amount: Decimal | null = null, - messageId: number | null = null, ): DbEvent => { const event = new DbEvent() event.type = type - event.userId = userId - event.xUserId = xUserId - event.xCommunityId = xCommunityId - event.transactionId = transactionId - event.contributionId = contributionId + event.affectedUser = affectedUser + event.actingUser = actingUser + event.involvedUser = involvedUser + event.involvedTransaction = involvedTransaction + event.involvedContribution = involvedContribution + event.involvedContributionMessage = involvedContributionMessage event.amount = amount - event.messageId = messageId return event } export const EVENT_CONTRIBUTION_CREATE = async ( - userId: number, - contributionId: number, + user: DbUser, + contribution: DbContribution, amount: Decimal, ): Promise => Event( EventProtocolType.CONTRIBUTION_CREATE, - userId, + user, + user, null, null, + contribution, null, - contributionId, amount, ).save() export const EVENT_CONTRIBUTION_DELETE = async ( - userId: number, - contributionId: number, + user: DbUser, + contribution: DbContribution, amount: Decimal, ): Promise => Event( EventProtocolType.CONTRIBUTION_DELETE, - userId, + user, + user, null, null, + contribution, null, - contributionId, amount, ).save() export const EVENT_CONTRIBUTION_UPDATE = async ( - userId: number, - contributionId: number, + user: DbUser, + contribution: DbContribution, amount: Decimal, ): Promise => Event( EventProtocolType.CONTRIBUTION_UPDATE, - userId, + user, + user, null, null, + contribution, null, - contributionId, amount, ).save() +// TODO what was user_id? affected or moderator user? +// await EVENT_ADMIN_CONTRIBUTION_CREATE(moderator.id, contribution.id, amount) export const EVENT_ADMIN_CONTRIBUTION_CREATE = async ( - userId: number, - contributionId: number, + user: DbUser, + moderator: DbUser, + contribution: DbContribution, amount: Decimal, ): Promise => Event( EventProtocolType.ADMIN_CONTRIBUTION_CREATE, - userId, + user, + moderator, null, null, + contribution, null, - contributionId, amount, ).save() +// TODO await EVENT_ADMIN_CONTRIBUTION_UPDATE(emailContact.user.id, contributionToUpdate.id, amount) export const EVENT_ADMIN_CONTRIBUTION_UPDATE = async ( - userId: number, - contributionId: number, + user: DbUser, + moderator: DbUser, + contribution: DbContribution, amount: Decimal, ): Promise => Event( EventProtocolType.ADMIN_CONTRIBUTION_UPDATE, - userId, + user, + moderator, null, null, + contribution, null, - contributionId, amount, ).save() +// TODO await EVENT_ADMIN_CONTRIBUTION_DELETE(contribution.userId, contribution.id, contribution.amount) export const EVENT_ADMIN_CONTRIBUTION_DELETE = async ( - userId: number, - contributionId: number, + user: DbUser, + moderator: DbUser, + contribution: DbContribution, amount: Decimal, ): Promise => Event( EventProtocolType.ADMIN_CONTRIBUTION_DELETE, - userId, + user, + moderator, null, null, + contribution, null, - contributionId, amount, ).save() +// TODO await EVENT_CONTRIBUTION_CONFIRM(user.id, contribution.id, contribution.amount) export const EVENT_CONTRIBUTION_CONFIRM = async ( - userId: number, - contributionId: number, + user: DbUser, + moderator: DbUser, + contribution: DbContribution, amount: Decimal, ): Promise => Event( EventProtocolType.CONTRIBUTION_CONFIRM, - userId, + user, + moderator, null, null, + contribution, null, - contributionId, amount, ).save() +// TODO await EVENT_ADMIN_CONTRIBUTION_DENY( +// contributionToUpdate.userId, +// moderator.id, +// contributionToUpdate.id, +// contributionToUpdate.amount, +// ) +// x User = moderator export const EVENT_ADMIN_CONTRIBUTION_DENY = async ( - userId: number, - xUserId: number, - contributionId: number, + user: DbUser, + moderator: DbUser, + contribution: DbContribution, amount: Decimal, ): Promise => Event( EventProtocolType.ADMIN_CONTRIBUTION_DENY, - userId, - xUserId, + user, + moderator, null, null, - contributionId, + contribution, + null, amount, ).save() export const EVENT_TRANSACTION_SEND = async ( - userId: number, - xUserId: number, - transactionId: number, + user: DbUser, + involvedUser: DbUser, + transaction: DbTransaction, amount: Decimal, ): Promise => Event( EventProtocolType.TRANSACTION_SEND, - userId, - xUserId, + user, + user, + involvedUser, + transaction, null, - transactionId, null, amount, ).save() +// TODO acting user = involved user export const EVENT_TRANSACTION_RECEIVE = async ( - userId: number, - xUserId: number, - transactionId: number, + user: DbUser, + involvedUser: DbUser, + transaction: DbTransaction, amount: Decimal, ): Promise => Event( EventProtocolType.TRANSACTION_RECEIVE, - userId, - xUserId, + user, + involvedUser, + involvedUser, + transaction, null, - transactionId, null, amount, ).save() -export const EVENT_LOGIN = async (userId: number): Promise => - Event(EventProtocolType.LOGIN, userId, null, null, null, null, null, null).save() +export const EVENT_LOGIN = async (user: DbUser): Promise => + Event(EventProtocolType.LOGIN, user, user).save() -export const EVENT_SEND_ACCOUNT_MULTIREGISTRATION_EMAIL = async ( - userId: number, -): Promise => Event(EventProtocolType.SEND_ACCOUNT_MULTIREGISTRATION_EMAIL, userId).save() +export const EVENT_SEND_ACCOUNT_MULTIREGISTRATION_EMAIL = async (user: DbUser): Promise => + Event(EventProtocolType.SEND_ACCOUNT_MULTIREGISTRATION_EMAIL, user, { id: 0 } as DbUser).save() -export const EVENT_SEND_CONFIRMATION_EMAIL = async (userId: number): Promise => - Event(EventProtocolType.SEND_CONFIRMATION_EMAIL, userId).save() +export const EVENT_SEND_CONFIRMATION_EMAIL = async (user: DbUser): Promise => + Event(EventProtocolType.SEND_CONFIRMATION_EMAIL, user, user).save() -export const EVENT_ADMIN_SEND_CONFIRMATION_EMAIL = async (userId: number): Promise => - Event(EventProtocolType.ADMIN_SEND_CONFIRMATION_EMAIL, userId).save() +export const EVENT_ADMIN_SEND_CONFIRMATION_EMAIL = async ( + user: DbUser, + moderator: DbUser, +): Promise => + Event(EventProtocolType.ADMIN_SEND_CONFIRMATION_EMAIL, user, moderator).save() -/* export const EVENT_REDEEM_REGISTER = async ( - userId: number, - transactionId: number | null = null, - contributionId: number | null = null, -): Promise => - Event( - EventProtocolType.REDEEM_REGISTER, - userId, - null, - null, - transactionId, - contributionId, - ).save() -*/ +export const EVENT_REGISTER = async (user: DbUser): Promise => + Event(EventProtocolType.REGISTER, user, user).save() -export const EVENT_REGISTER = async (userId: number): Promise => - Event(EventProtocolType.REGISTER, userId).save() - -export const EVENT_ACTIVATE_ACCOUNT = async (userId: number): Promise => - Event(EventProtocolType.ACTIVATE_ACCOUNT, userId).save() +export const EVENT_ACTIVATE_ACCOUNT = async (user: DbUser): Promise => + Event(EventProtocolType.ACTIVATE_ACCOUNT, user, user).save() diff --git a/backend/src/graphql/resolver/ContributionResolver.test.ts b/backend/src/graphql/resolver/ContributionResolver.test.ts index b56180c45..8f2ae3981 100644 --- a/backend/src/graphql/resolver/ContributionResolver.test.ts +++ b/backend/src/graphql/resolver/ContributionResolver.test.ts @@ -38,7 +38,7 @@ import { userFactory } from '@/seeds/factory/user' import { creationFactory } from '@/seeds/factory/creation' import { creations } from '@/seeds/creation/index' import { peterLustig } from '@/seeds/users/peter-lustig' -import { EventProtocol } from '@entity/EventProtocol' +import { Event as DbEvent } from '@entity/Event' import { Contribution } from '@entity/Contribution' import { Transaction as DbTransaction } from '@entity/Transaction' import { User } from '@entity/User' @@ -284,7 +284,7 @@ describe('ContributionResolver', () => { }) it('stores the CONTRIBUTION_CREATE event in the database', async () => { - await expect(EventProtocol.find()).resolves.toContainEqual( + await expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.CONTRIBUTION_CREATE, amount: expect.decimalEqual(100), @@ -589,7 +589,7 @@ describe('ContributionResolver', () => { variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' }, }) - await expect(EventProtocol.find()).resolves.toContainEqual( + await expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.CONTRIBUTION_UPDATE, amount: expect.decimalEqual(10), @@ -819,7 +819,7 @@ describe('ContributionResolver', () => { }) it('stores the ADMIN_CONTRIBUTION_DENY event in the database', async () => { - await expect(EventProtocol.find()).resolves.toContainEqual( + await expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.ADMIN_CONTRIBUTION_DENY, userId: bibi.id, @@ -934,7 +934,7 @@ describe('ContributionResolver', () => { }) it('stores the CONTRIBUTION_DELETE event in the database', async () => { - await expect(EventProtocol.find()).resolves.toContainEqual( + await expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.CONTRIBUTION_DELETE, contributionId: contributionToDelete.data.createContribution.id, @@ -2082,7 +2082,7 @@ describe('ContributionResolver', () => { }) it('stores the ADMIN_CONTRIBUTION_CREATE event in the database', async () => { - await expect(EventProtocol.find()).resolves.toContainEqual( + await expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.ADMIN_CONTRIBUTION_CREATE, userId: admin.id, @@ -2353,7 +2353,7 @@ describe('ContributionResolver', () => { }) it('stores the ADMIN_CONTRIBUTION_UPDATE event in the database', async () => { - await expect(EventProtocol.find()).resolves.toContainEqual( + await expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.ADMIN_CONTRIBUTION_UPDATE, userId: admin.id, @@ -2394,7 +2394,7 @@ describe('ContributionResolver', () => { }) it('stores the ADMIN_CONTRIBUTION_UPDATE event in the database', async () => { - await expect(EventProtocol.find()).resolves.toContainEqual( + await expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.ADMIN_CONTRIBUTION_UPDATE, userId: admin.id, @@ -2573,7 +2573,7 @@ describe('ContributionResolver', () => { }) it('stores the ADMIN_CONTRIBUTION_DELETE event in the database', async () => { - await expect(EventProtocol.find()).resolves.toContainEqual( + await expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.ADMIN_CONTRIBUTION_DELETE, userId: admin.id, @@ -2717,7 +2717,7 @@ describe('ContributionResolver', () => { }) it('stores the CONTRIBUTION_CONFIRM event in the database', async () => { - await expect(EventProtocol.find()).resolves.toContainEqual( + await expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.CONTRIBUTION_CONFIRM, }), @@ -2749,7 +2749,7 @@ describe('ContributionResolver', () => { }) it('stores the SEND_CONFIRMATION_EMAIL event in the database', async () => { - await expect(EventProtocol.find()).resolves.toContainEqual( + await expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.SEND_CONFIRMATION_EMAIL, }), diff --git a/backend/src/graphql/resolver/ContributionResolver.ts b/backend/src/graphql/resolver/ContributionResolver.ts index c2f0d7d23..145966f47 100644 --- a/backend/src/graphql/resolver/ContributionResolver.ts +++ b/backend/src/graphql/resolver/ContributionResolver.ts @@ -91,7 +91,7 @@ export class ContributionResolver { logger.trace('contribution to save', contribution) await DbContribution.save(contribution) - await EVENT_CONTRIBUTION_CREATE(user.id, contribution.id, amount) + await EVENT_CONTRIBUTION_CREATE(user, contribution, amount) return new UnconfirmedContribution(contribution, user, creations) } @@ -119,7 +119,7 @@ export class ContributionResolver { contribution.deletedAt = new Date() await contribution.save() - await EVENT_CONTRIBUTION_DELETE(user.id, contribution.id, contribution.amount) + await EVENT_CONTRIBUTION_DELETE(user, contribution, contribution.amount) const res = await contribution.softRemove() return !!res @@ -267,7 +267,7 @@ export class ContributionResolver { contributionToUpdate.updatedAt = new Date() DbContribution.save(contributionToUpdate) - await EVENT_CONTRIBUTION_UPDATE(user.id, contributionId, amount) + await EVENT_CONTRIBUTION_UPDATE(user, contributionToUpdate, amount) return new UnconfirmedContribution(contributionToUpdate, user, creations) } @@ -324,7 +324,7 @@ export class ContributionResolver { await DbContribution.save(contribution) - await EVENT_ADMIN_CONTRIBUTION_CREATE(moderator.id, contribution.id, amount) + await EVENT_ADMIN_CONTRIBUTION_CREATE(emailContact.user, moderator, contribution, amount) return getUserCreation(emailContact.userId, clientTimezoneOffset) } @@ -419,7 +419,12 @@ export class ContributionResolver { result.creation = await getUserCreation(emailContact.user.id, clientTimezoneOffset) - await EVENT_ADMIN_CONTRIBUTION_UPDATE(emailContact.user.id, contributionToUpdate.id, amount) + await EVENT_ADMIN_CONTRIBUTION_UPDATE( + emailContact.user, + moderator, + contributionToUpdate, + amount, + ) return result } @@ -490,7 +495,13 @@ export class ContributionResolver { await contribution.save() const res = await contribution.softRemove() - await EVENT_ADMIN_CONTRIBUTION_DELETE(contribution.userId, contribution.id, contribution.amount) + // TODO allow to query the user with relation + await EVENT_ADMIN_CONTRIBUTION_DELETE( + { id: contribution.userId } as DbUser, + moderator, + contribution, + contribution.amount, + ) sendContributionDeletedEmail({ firstName: user.firstName, @@ -603,7 +614,7 @@ export class ContributionResolver { await queryRunner.release() } - await EVENT_CONTRIBUTION_CONFIRM(user.id, contribution.id, contribution.amount) + await EVENT_CONTRIBUTION_CONFIRM(user, moderatorUser, contribution, contribution.amount) } finally { releaseLock() } @@ -694,9 +705,9 @@ export class ContributionResolver { const res = await contributionToUpdate.save() await EVENT_ADMIN_CONTRIBUTION_DENY( - contributionToUpdate.userId, - moderator.id, - contributionToUpdate.id, + user, + moderator, + contributionToUpdate, contributionToUpdate.amount, ) diff --git a/backend/src/graphql/resolver/TransactionResolver.test.ts b/backend/src/graphql/resolver/TransactionResolver.test.ts index 6751aa6ad..fd4f839b6 100644 --- a/backend/src/graphql/resolver/TransactionResolver.test.ts +++ b/backend/src/graphql/resolver/TransactionResolver.test.ts @@ -14,7 +14,7 @@ import { bobBaumeister } from '@/seeds/users/bob-baumeister' import { garrickOllivander } from '@/seeds/users/garrick-ollivander' import { peterLustig } from '@/seeds/users/peter-lustig' import { stephenHawking } from '@/seeds/users/stephen-hawking' -import { EventProtocol } from '@entity/EventProtocol' +import { Event as DbEvent } from '@entity/Event' import { Transaction } from '@entity/Transaction' import { User } from '@entity/User' import { cleanDB, testEnvironment } from '@test/helpers' @@ -337,7 +337,7 @@ describe('send coins', () => { memo: 'unrepeatable memo', }) - expect(EventProtocol.find()).resolves.toContainEqual( + expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.TRANSACTION_SEND, userId: user[1].id, @@ -354,7 +354,7 @@ describe('send coins', () => { memo: 'unrepeatable memo', }) - expect(EventProtocol.find()).resolves.toContainEqual( + expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.TRANSACTION_RECEIVE, userId: user[0].id, diff --git a/backend/src/graphql/resolver/TransactionResolver.ts b/backend/src/graphql/resolver/TransactionResolver.ts index 9d5a1d38c..f0527ee61 100644 --- a/backend/src/graphql/resolver/TransactionResolver.ts +++ b/backend/src/graphql/resolver/TransactionResolver.ts @@ -138,16 +138,17 @@ export const executeTransaction = async ( logger.info(`commit Transaction successful...`) await EVENT_TRANSACTION_SEND( - transactionSend.userId, - transactionSend.linkedUserId, - transactionSend.id, + sender, + recipient, + transactionSend, + // TODO why mul -1? transactionSend.amount.mul(-1), ) await EVENT_TRANSACTION_RECEIVE( - transactionReceive.userId, - transactionReceive.linkedUserId, - transactionReceive.id, + recipient, + sender, + transactionReceive, transactionReceive.amount, ) } catch (e) { diff --git a/backend/src/graphql/resolver/UserResolver.test.ts b/backend/src/graphql/resolver/UserResolver.test.ts index 19eb04b34..a2dd08ea4 100644 --- a/backend/src/graphql/resolver/UserResolver.test.ts +++ b/backend/src/graphql/resolver/UserResolver.test.ts @@ -35,7 +35,7 @@ import { transactionLinkFactory } from '@/seeds/factory/transactionLink' import { ContributionLink } from '@model/ContributionLink' import { TransactionLink } from '@entity/TransactionLink' import { EventProtocolType } from '@/event/EventProtocolType' -import { EventProtocol } from '@entity/EventProtocol' +import { Event as DbEvent } from '@entity/Event' import { validate as validateUUID, version as versionUUID } from 'uuid' import { peterLustig } from '@/seeds/users/peter-lustig' import { UserContact } from '@entity/UserContact' @@ -182,7 +182,7 @@ describe('UserResolver', () => { { email: 'peter@lustig.de' }, { relations: ['user'] }, ) - expect(EventProtocol.find()).resolves.toContainEqual( + expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.REGISTER, userId: userConatct.user.id, @@ -211,7 +211,7 @@ describe('UserResolver', () => { }) it('stores the SEND_CONFIRMATION_EMAIL event in the database', () => { - expect(EventProtocol.find()).resolves.toContainEqual( + expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.SEND_CONFIRMATION_EMAIL, userId: user[0].id, @@ -256,7 +256,7 @@ describe('UserResolver', () => { { email: 'peter@lustig.de' }, { relations: ['user'] }, ) - expect(EventProtocol.find()).resolves.toContainEqual( + expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.SEND_ACCOUNT_MULTIREGISTRATION_EMAIL, userId: userConatct.user.id, @@ -356,7 +356,7 @@ describe('UserResolver', () => { }) it('stores the ACTIVATE_ACCOUNT event in the database', () => { - expect(EventProtocol.find()).resolves.toContainEqual( + expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.ACTIVATE_ACCOUNT, userId: user[0].id, @@ -365,7 +365,7 @@ describe('UserResolver', () => { }) it('stores the REDEEM_REGISTER event in the database', () => { - expect(EventProtocol.find()).resolves.toContainEqual( + expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.REDEEM_REGISTER, userId: result.data.createUser.id, @@ -449,7 +449,7 @@ describe('UserResolver', () => { }) it('stores the REDEEM_REGISTER event in the database', async () => { - await expect(EventProtocol.find()).resolves.toContainEqual( + await expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.REDEEM_REGISTER, userId: newUser.data.createUser.id, @@ -680,7 +680,7 @@ describe('UserResolver', () => { { email: 'bibi@bloxberg.de' }, { relations: ['user'] }, ) - expect(EventProtocol.find()).resolves.toContainEqual( + expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.LOGIN, userId: userConatct.user.id, @@ -928,7 +928,7 @@ describe('UserResolver', () => { }) it('stores the LOGIN event in the database', () => { - expect(EventProtocol.find()).resolves.toContainEqual( + expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.LOGIN, userId: user[0].id, @@ -1847,7 +1847,7 @@ describe('UserResolver', () => { { email: 'bibi@bloxberg.de' }, { relations: ['user'] }, ) - expect(EventProtocol.find()).resolves.toContainEqual( + expect(DbEvent.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..435ca3c82 100644 --- a/backend/src/graphql/resolver/UserResolver.ts +++ b/backend/src/graphql/resolver/UserResolver.ts @@ -16,7 +16,9 @@ import { getConnection, getCustomRepository, IsNull, Not } from '@dbTools/typeor import { User as DbUser } from '@entity/User' import { UserContact as DbUserContact } from '@entity/UserContact' import { TransactionLink as DbTransactionLink } from '@entity/TransactionLink' +import { Transaction as DbTransaction } from '@entity/Transaction' import { ContributionLink as DbContributionLink } from '@entity/ContributionLink' +import { Contribution as DbContribution } from '@entity/Contribution' import { UserRepository } from '@repository/User' import { User } from '@model/User' @@ -178,7 +180,7 @@ export class UserResolver { value: encode(dbUser.gradidoID), }) - await EVENT_LOGIN(user.id) + await EVENT_LOGIN(dbUser) logger.info(`successful Login: ${JSON.stringify(user, null, 2)}`) return user } @@ -248,7 +250,7 @@ export class UserResolver { language: foundUser.language, // use language of the emails owner for sending }) - await EVENT_SEND_ACCOUNT_MULTIREGISTRATION_EMAIL(foundUser.id) + await EVENT_SEND_ACCOUNT_MULTIREGISTRATION_EMAIL(foundUser) logger.info( `sendAccountMultiRegistrationEmail by ${firstName} ${lastName} to ${foundUser.firstName} ${foundUser.lastName} <${email}>`, @@ -266,7 +268,11 @@ export class UserResolver { const gradidoID = await newGradidoID() - const eventRegisterRedeem = Event(EventProtocolType.REDEEM_REGISTER, 0) + const eventRegisterRedeem = Event( + EventProtocolType.REDEEM_REGISTER, + { id: 0 } as DbUser, + { id: 0 } as DbUser, + ) let dbUser = new DbUser() dbUser.gradidoID = gradidoID dbUser.firstName = firstName @@ -283,14 +289,16 @@ export class UserResolver { logger.info('redeemCode found contributionLink=' + contributionLink) if (contributionLink) { dbUser.contributionLinkId = contributionLink.id - eventRegisterRedeem.contributionId = contributionLink.id + // TODO this is so wrong + eventRegisterRedeem.involvedContribution = { id: contributionLink.id } as DbContribution } } else { const transactionLink = await DbTransactionLink.findOne({ code: redeemCode }) logger.info('redeemCode found transactionLink=' + transactionLink) if (transactionLink) { dbUser.referrerId = transactionLink.userId - eventRegisterRedeem.transactionId = transactionLink.id + // TODO this is so wrong + eventRegisterRedeem.involvedTransaction = { id: transactionLink.id } as DbTransaction } } } @@ -329,7 +337,7 @@ export class UserResolver { }) logger.info(`sendAccountActivationEmail of ${firstName}.${lastName} to ${email}`) - await EVENT_SEND_CONFIRMATION_EMAIL(dbUser.id) + await EVENT_SEND_CONFIRMATION_EMAIL(dbUser) if (!emailSent) { logger.debug(`Account confirmation link: ${activationLink}`) @@ -346,10 +354,11 @@ export class UserResolver { logger.info('createUser() successful...') if (redeemCode) { - eventRegisterRedeem.userId = dbUser.id + eventRegisterRedeem.affectedUser = dbUser + eventRegisterRedeem.actingUser = dbUser await eventRegisterRedeem.save() } else { - await EVENT_REGISTER(dbUser.id) + await EVENT_REGISTER(dbUser) } return new User(dbUser) @@ -465,7 +474,7 @@ export class UserResolver { await queryRunner.commitTransaction() logger.info('User and UserContact data written successfully...') - await EVENT_ACTIVATE_ACCOUNT(user.id) + await EVENT_ACTIVATE_ACCOUNT(user) } catch (e) { await queryRunner.rollbackTransaction() throw new LogError('Error on writing User and User Contact data', e) @@ -775,9 +784,13 @@ export class UserResolver { return null } + // TODO this is an admin function - needs refactor @Authorized([RIGHTS.SEND_ACTIVATION_EMAIL]) @Mutation(() => Boolean) - async sendActivationEmail(@Arg('email') email: string): Promise { + async sendActivationEmail( + @Arg('email') email: string, + @Ctx() context: Context, + ): Promise { email = email.trim().toLowerCase() // const user = await dbUser.findOne({ id: emailContact.userId }) const user = await findUserByEmail(email) @@ -802,7 +815,7 @@ export class UserResolver { if (!emailSent) { logger.info(`Account confirmation link: ${activationLink}`) } else { - await EVENT_ADMIN_SEND_CONFIRMATION_EMAIL(user.id) + await EVENT_ADMIN_SEND_CONFIRMATION_EMAIL(user, getUser(context)) } return true From 4e55acebeb0fec2e92a010b109a307e4b26fddd3 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 18 Feb 2023 01:24:48 +0100 Subject: [PATCH 016/181] have explicit reference id columns due to missing foreign keys --- .../entity/0061-event_refactoring/Event.ts | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/database/entity/0061-event_refactoring/Event.ts b/database/entity/0061-event_refactoring/Event.ts index 5a62fcdc2..219861834 100644 --- a/database/entity/0061-event_refactoring/Event.ts +++ b/database/entity/0061-event_refactoring/Event.ts @@ -30,45 +30,46 @@ export class Event extends BaseEntity { }) createdAt: Date - // @Column({ name: 'affected_user_id', unsigned: true, nullable: false }) - // affectedUserId: number + @Column({ name: 'affected_user_id', unsigned: true, nullable: false }) + affectedUserId: number @ManyToOne(() => User) @JoinColumn({ name: 'affected_user_id', referencedColumnName: 'id' }) affectedUser: User // TODO potentially save actingRole as well - // @Column({ name: 'acting_user_id', unsigned: true, nullable: false }) - // actingUserId: number + @Column({ name: 'acting_user_id', unsigned: true, nullable: false }) + actingUserId: number @ManyToOne(() => User) @JoinColumn({ name: 'acting_user_id', referencedColumnName: 'id' }) actingUser: User - // @Column({ name: 'involved_user_id', type: 'int', unsigned: true, nullable: true }) - // involvedUserId: number | null + @Column({ name: 'involved_user_id', type: 'int', unsigned: true, nullable: true }) + involvedUserId: number | null @ManyToOne(() => User) @JoinColumn({ name: 'involved_user_id', referencedColumnName: 'id' }) involvedUser: User | null - // @Column({ name: 'involved_transaction_id', type: 'int', unsigned: true, nullable: true }) - // involvedTransactionId: number | null + @Column({ name: 'involved_transaction_id', type: 'int', unsigned: true, nullable: true }) + involvedTransactionId: number | null @ManyToOne(() => Transaction) @JoinColumn({ name: 'involved_transaction_id', referencedColumnName: 'id' }) involvedTransaction: Transaction | null - // @Column({ name: 'involved_contribution_id', type: 'int', unsigned: true, nullable: true }) - // involvedContributionId: number | null + @Column({ name: 'involved_contribution_id', type: 'int', unsigned: true, nullable: true }) + involvedContributionId: number | null @ManyToOne(() => Contribution) @JoinColumn({ name: 'involved_contribution_id', referencedColumnName: 'id' }) involvedContribution: Contribution | null // TEST do we need the Id field definition? - // @Column({ name: 'involved_contribution_message_id', type: 'int', unsigned: true, nullable: true }) - // involvedContributionMessageId: number | null + // TODO we need proper foreign keys to have things working without the explicit column + @Column({ name: 'involved_contribution_message_id', type: 'int', unsigned: true, nullable: true }) + involvedContributionMessageId: number | null @ManyToOne(() => ContributionMessage) @JoinColumn({ name: 'involved_contribution_message_id', referencedColumnName: 'id' }) From e73c26a1cd045a28c55c9954e63e8346dcc4b983 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 18 Feb 2023 01:31:29 +0100 Subject: [PATCH 017/181] fix transactionResolver tests --- .../graphql/resolver/TransactionResolver.test.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/backend/src/graphql/resolver/TransactionResolver.test.ts b/backend/src/graphql/resolver/TransactionResolver.test.ts index fd4f839b6..6ddbb8191 100644 --- a/backend/src/graphql/resolver/TransactionResolver.test.ts +++ b/backend/src/graphql/resolver/TransactionResolver.test.ts @@ -340,9 +340,10 @@ describe('send coins', () => { expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.TRANSACTION_SEND, - userId: user[1].id, - transactionId: transaction[0].id, - xUserId: user[0].id, + affectedUserId: user[1].id, + actingUserId: user[1].id, + involvedUserId: user[0].id, + involvedTransactionId: transaction[0].id, }), ) }) @@ -357,9 +358,10 @@ describe('send coins', () => { expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.TRANSACTION_RECEIVE, - userId: user[0].id, - transactionId: transaction[0].id, - xUserId: user[1].id, + affectedUserId: user[0].id, + actingUserId: user[1].id, + involvedUserId: user[1].id, + involvedTransactionId: transaction[0].id, }), ) }) From 08ad0fb1bbe457a6e97836cfa9ead0d9e746af27 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 18 Feb 2023 01:43:27 +0100 Subject: [PATCH 018/181] fix userResolver tests --- .../src/graphql/resolver/UserResolver.test.ts | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/backend/src/graphql/resolver/UserResolver.test.ts b/backend/src/graphql/resolver/UserResolver.test.ts index a2dd08ea4..e627f4f0f 100644 --- a/backend/src/graphql/resolver/UserResolver.test.ts +++ b/backend/src/graphql/resolver/UserResolver.test.ts @@ -185,7 +185,8 @@ describe('UserResolver', () => { expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.REGISTER, - userId: userConatct.user.id, + affectedUserId: userConatct.user.id, + actingUserId: userConatct.user.id, }), ) }) @@ -214,7 +215,8 @@ describe('UserResolver', () => { expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.SEND_CONFIRMATION_EMAIL, - userId: user[0].id, + affectedUserId: user[0].id, + actingUserId: user[0].id, }), ) }) @@ -259,7 +261,8 @@ describe('UserResolver', () => { expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.SEND_ACCOUNT_MULTIREGISTRATION_EMAIL, - userId: userConatct.user.id, + affectedUserId: userConatct.user.id, + actingUserId: 0, }), ) }) @@ -359,7 +362,8 @@ describe('UserResolver', () => { expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.ACTIVATE_ACCOUNT, - userId: user[0].id, + affectedUserId: user[0].id, + actingUserId: user[0].id, }), ) }) @@ -368,8 +372,9 @@ describe('UserResolver', () => { expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.REDEEM_REGISTER, - userId: result.data.createUser.id, - contributionId: link.id, + affectedUserId: result.data.createUser.id, + actingUserId: result.data.createUser.id, + involvedContributionId: link.id, }), ) }) @@ -452,7 +457,9 @@ describe('UserResolver', () => { await expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.REDEEM_REGISTER, - userId: newUser.data.createUser.id, + affectedUserId: newUser.data.createUser.id, + actingUserId: newUser.data.createUser.id, + involvedTransactionId: transactionLink.id, }), ) }) @@ -683,7 +690,8 @@ describe('UserResolver', () => { expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.LOGIN, - userId: userConatct.user.id, + affectedUserId: userConatct.user.id, + actingUserId: userConatct.user.id, }), ) }) @@ -931,7 +939,8 @@ describe('UserResolver', () => { expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.LOGIN, - userId: user[0].id, + affectedUserId: user[0].id, + actingUserId: user[0].id, }), ) }) @@ -1850,7 +1859,8 @@ describe('UserResolver', () => { expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.ADMIN_SEND_CONFIRMATION_EMAIL, - userId: userConatct.user.id, + affectedUserId: userConatct.user.id, + actingUserId: admin.id, }), ) }) From 8744ff919e21bcdd4757453a71c6db9e23e2af03 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 18 Feb 2023 02:01:31 +0100 Subject: [PATCH 019/181] fix contributionResolver tests --- .../resolver/ContributionResolver.test.ts | 40 +++++++++++-------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/backend/src/graphql/resolver/ContributionResolver.test.ts b/backend/src/graphql/resolver/ContributionResolver.test.ts index 8f2ae3981..540285c53 100644 --- a/backend/src/graphql/resolver/ContributionResolver.test.ts +++ b/backend/src/graphql/resolver/ContributionResolver.test.ts @@ -287,9 +287,10 @@ describe('ContributionResolver', () => { await expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.CONTRIBUTION_CREATE, + affectedUserId: bibi.id, + actingUserId: bibi.id, + involvedContributionId: pendingContribution.data.createContribution.id, amount: expect.decimalEqual(100), - contributionId: pendingContribution.data.createContribution.id, - userId: bibi.id, }), ) }) @@ -592,9 +593,10 @@ describe('ContributionResolver', () => { await expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.CONTRIBUTION_UPDATE, + affectedUserId: bibi.id, + actingUserId: bibi.id, + involvedContributionId: pendingContribution.data.createContribution.id, amount: expect.decimalEqual(10), - contributionId: pendingContribution.data.createContribution.id, - userId: bibi.id, }), ) }) @@ -822,9 +824,9 @@ describe('ContributionResolver', () => { await expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.ADMIN_CONTRIBUTION_DENY, - userId: bibi.id, - xUserId: admin.id, - contributionId: contributionToDeny.data.createContribution.id, + affectedUserId: bibi.id, + actingUserId: admin.id, + involvedContributionId: contributionToDeny.data.createContribution.id, amount: expect.decimalEqual(100), }), ) @@ -937,9 +939,10 @@ describe('ContributionResolver', () => { await expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.CONTRIBUTION_DELETE, - contributionId: contributionToDelete.data.createContribution.id, + affectedUserId: bibi.id, + actingUserId: bibi.id, + involvedContributionId: contributionToDelete.data.createContribution.id, amount: expect.decimalEqual(100), - userId: bibi.id, }), ) }) @@ -2085,7 +2088,8 @@ describe('ContributionResolver', () => { await expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.ADMIN_CONTRIBUTION_CREATE, - userId: admin.id, + affectedUserId: bibi.id, + actingUserId: admin.id, amount: expect.decimalEqual(200), }), ) @@ -2329,7 +2333,7 @@ describe('ContributionResolver', () => { mutate({ mutation: adminUpdateContribution, variables: { - id: creation ? creation.id : -1, + id: creation?.id, email: 'peter@lustig.de', amount: new Decimal(300), memo: 'Danke Peter!', @@ -2356,7 +2360,8 @@ describe('ContributionResolver', () => { await expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.ADMIN_CONTRIBUTION_UPDATE, - userId: admin.id, + affectedUserId: creation?.userId, + actingUserId: admin.id, amount: 300, }), ) @@ -2370,7 +2375,7 @@ describe('ContributionResolver', () => { mutate({ mutation: adminUpdateContribution, variables: { - id: creation ? creation.id : -1, + id: creation?.id, email: 'peter@lustig.de', amount: new Decimal(200), memo: 'Das war leider zu Viel!', @@ -2397,7 +2402,8 @@ describe('ContributionResolver', () => { await expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.ADMIN_CONTRIBUTION_UPDATE, - userId: admin.id, + affectedUserId: creation?.userId, + actingUserId: admin.id, amount: expect.decimalEqual(200), }), ) @@ -2562,7 +2568,7 @@ describe('ContributionResolver', () => { mutate({ mutation: adminDeleteContribution, variables: { - id: creation ? creation.id : -1, + id: creation?.id, }, }), ).resolves.toEqual( @@ -2576,7 +2582,9 @@ describe('ContributionResolver', () => { await expect(DbEvent.find()).resolves.toContainEqual( expect.objectContaining({ type: EventProtocolType.ADMIN_CONTRIBUTION_DELETE, - userId: admin.id, + affectedUserId: creation?.userId, + actingUserId: admin.id, + involvedContributionId: creation?.id, amount: expect.decimalEqual(200), }), ) From 89435409aff1da7c498d52cfc07e579e38335fa1 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 18 Feb 2023 02:11:03 +0100 Subject: [PATCH 020/181] fix typo --- federation/src/config/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/federation/src/config/index.ts b/federation/src/config/index.ts index 6b3bf6424..52c73ef0a 100644 --- a/federation/src/config/index.ts +++ b/federation/src/config/index.ts @@ -11,7 +11,7 @@ Decimal.set({ */ const constants = { - DB_VERSION: '0060-0061-event_refactoring', + DB_VERSION: '0061-event_refactoring', // DECAY_START_TIME: new Date('2021-05-13 17:46:31-0000'), // GMT+0 LOG4JS_CONFIG: 'log4js-config.json', // default log level on production should be info From d411ca76821756295647a69ab27da6871af40863 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 21 Feb 2023 10:42:47 +0100 Subject: [PATCH 021/181] add file change check to test admin workflow --- .github/file-filters.yml | 4 ++++ .github/workflows/test-admin-interface.yml | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 .github/file-filters.yml diff --git a/.github/file-filters.yml b/.github/file-filters.yml new file mode 100644 index 000000000..526cb0c7f --- /dev/null +++ b/.github/file-filters.yml @@ -0,0 +1,4 @@ +# These file filter patterns are used by the action https://github.com/dorny/paths-filter + +admin_locales: &admin_locales + - 'admin/src/locales/**' \ No newline at end of file diff --git a/.github/workflows/test-admin-interface.yml b/.github/workflows/test-admin-interface.yml index d126a9075..cfb888ff7 100644 --- a/.github/workflows/test-admin-interface.yml +++ b/.github/workflows/test-admin-interface.yml @@ -6,6 +6,23 @@ on: - separate-admin-interface-workflow jobs: + # + files-changed: + name: Detect File Changes - Admin Interface + runs-on: ubuntu-latest + outputs: + admin_locales: ${{ steps.changes.outputs.admin_locales }} + steps: + - uses: actions/checkout@v3.3.0 + + - name: Check for admin interface file changes + uses: dorny/paths-filter@v2.11.1 + id: changes + with: + token: ${{ github.token }} + filters: .github/file-filters.yml + list-files: shell + build_test_admin: name: Docker Build Test - Admin Interface runs-on: ubuntu-latest @@ -59,7 +76,9 @@ jobs: run: cd admin && yarn && yarn run stylelint locales_admin: + if: needs.files-changed.outputs.admin_locales == 'true' name: Locales - Admin Interface + needs: files-changed runs-on: ubuntu-latest steps: - name: Checkout code From ef9ad7e4a8f97094429c3aba953dd7b431ba96d5 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 21 Feb 2023 11:17:36 +0100 Subject: [PATCH 022/181] add file change check for stylelinting to test admin workflow --- .github/file-filters.yml | 6 +++++- .github/workflows/test-admin-interface.yml | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/file-filters.yml b/.github/file-filters.yml index 526cb0c7f..d835f778f 100644 --- a/.github/file-filters.yml +++ b/.github/file-filters.yml @@ -1,4 +1,8 @@ # These file filter patterns are used by the action https://github.com/dorny/paths-filter admin_locales: &admin_locales - - 'admin/src/locales/**' \ No newline at end of file + - 'admin/src/locales/**' + +admin_stylelinting: &admin_stylelinting + - 'admin/{components,layouts,pages}/**/*.{scss,vue}' + - 'admin/.stylelintrc.js' diff --git a/.github/workflows/test-admin-interface.yml b/.github/workflows/test-admin-interface.yml index cfb888ff7..a0e81747b 100644 --- a/.github/workflows/test-admin-interface.yml +++ b/.github/workflows/test-admin-interface.yml @@ -12,6 +12,7 @@ jobs: runs-on: ubuntu-latest outputs: admin_locales: ${{ steps.changes.outputs.admin_locales }} + admin_stylelinting: ${{ steps.changes.outputs.admin_stylelinting }} steps: - uses: actions/checkout@v3.3.0 @@ -66,7 +67,9 @@ jobs: run: cd admin && yarn && yarn run lint stylelint_admin: + if: needs.files-changed.outputs.admin_stylelinting == 'true' name: Stylelint - Admin Interface + needs: admin_stylelinting runs-on: ubuntu-latest steps: - name: Checkout code From 84515a51132b35d4cb48885b0b0832fe92ca7c91 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 21 Feb 2023 11:19:49 +0100 Subject: [PATCH 023/181] fix typo --- .github/workflows/test-admin-interface.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-admin-interface.yml b/.github/workflows/test-admin-interface.yml index a0e81747b..0fcb1f549 100644 --- a/.github/workflows/test-admin-interface.yml +++ b/.github/workflows/test-admin-interface.yml @@ -69,7 +69,7 @@ jobs: stylelint_admin: if: needs.files-changed.outputs.admin_stylelinting == 'true' name: Stylelint - Admin Interface - needs: admin_stylelinting + needs: files-changed runs-on: ubuntu-latest steps: - name: Checkout code From 56485d2d75fba0ae6e9749b5a77ac4f55b71d0e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus-Peter=20H=C3=BCbner?= Date: Wed, 22 Feb 2023 20:43:19 +0100 Subject: [PATCH 024/181] start adding federation to deployment scripts --- deployment/bare_metal/.env.dist | 2 ++ deployment/bare_metal/start.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/deployment/bare_metal/.env.dist b/deployment/bare_metal/.env.dist index 9c9c7ac82..80c1b36a1 100644 --- a/deployment/bare_metal/.env.dist +++ b/deployment/bare_metal/.env.dist @@ -61,6 +61,8 @@ WEBHOOK_ELOPAGE_SECRET=secret # on an hash created from this topic # FEDERATION_DHT_TOPIC=GRADIDO_HUB # FEDERATION_DHT_SEED=64ebcb0e3ad547848fef4197c6e2332f +FEDERATION_CONFIG_VERSION=v1.2023-01-09 +FEDERATION_API=1_0 # database DATABASE_CONFIG_VERSION=v1.2022-03-18 diff --git a/deployment/bare_metal/start.sh b/deployment/bare_metal/start.sh index 95b89241f..ae98c7e87 100755 --- a/deployment/bare_metal/start.sh +++ b/deployment/bare_metal/start.sh @@ -1,5 +1,18 @@ #!/bin/bash +echo "Before getopt" +for i +do + echo $i +done +args=`getopt b:p: $*` +set -- $args +echo "After getopt" +for i +do + echo "-->$i" +done + # Find current directory & configure paths set -o allexport SCRIPT_PATH=$(realpath $0) @@ -93,10 +106,12 @@ cp -f $PROJECT_ROOT/database/.env $PROJECT_ROOT/database/.env.bak cp -f $PROJECT_ROOT/backend/.env $PROJECT_ROOT/backend/.env.bak cp -f $PROJECT_ROOT/frontend/.env $PROJECT_ROOT/frontend/.env.bak cp -f $PROJECT_ROOT/admin/.env $PROJECT_ROOT/admin/.env.bak +cp -f $PROJECT_ROOT/federation/.env $PROJECT_ROOT/federation/.env.bak envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < $PROJECT_ROOT/database/.env.template > $PROJECT_ROOT/database/.env envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < $PROJECT_ROOT/backend/.env.template > $PROJECT_ROOT/backend/.env envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < $PROJECT_ROOT/frontend/.env.template > $PROJECT_ROOT/frontend/.env envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < $PROJECT_ROOT/admin/.env.template > $PROJECT_ROOT/admin/.env +envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < $PROJECT_ROOT/federation/.env.template > $PROJECT_ROOT/federation/.env # Install & build database echo 'Updating database' >> $UPDATE_HTML @@ -152,6 +167,19 @@ pm2 delete gradido-admin pm2 start --name gradido-admin "yarn --cwd $PROJECT_ROOT/admin start" -l $GRADIDO_LOG_PATH/pm2.admin.$TODAY.log --log-date-format 'YYYY-MM-DD HH:mm:ss.SSS' pm2 save +# Install & build federation +echo 'Updating federation' >> $UPDATE_HTML +cd $PROJECT_ROOT/federation +# TODO maybe handle this differently? +unset NODE_ENV +yarn install +yarn build +# TODO maybe handle this differently? +export NODE_ENV=production +pm2 delete gradido-federation +pm2 start --name gradido-federation "yarn --cwd $PROJECT_ROOT/federation start" -l $GRADIDO_LOG_PATH/pm2.federation.$TODAY.log --log-date-format 'YYYY-MM-DD HH:mm:ss.SSS' +pm2 save + # let nginx showing gradido echo 'Configuring nginx to serve gradido again' >> $UPDATE_HTML ln -s /etc/nginx/sites-available/gradido.conf /etc/nginx/sites-enabled/ From c9df716eb38bde05f60a9a2115ceb07e5fc85fe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus-Peter=20H=C3=BCbner?= Date: Wed, 22 Feb 2023 22:42:18 +0100 Subject: [PATCH 025/181] add federation-module to deployment script --- deployment/bare_metal/start.sh | 39 +++++++++++++++++++++++----------- federation/src/config/index.ts | 2 +- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/deployment/bare_metal/start.sh b/deployment/bare_metal/start.sh index ae98c7e87..8ec4cfc48 100755 --- a/deployment/bare_metal/start.sh +++ b/deployment/bare_metal/start.sh @@ -1,18 +1,25 @@ #!/bin/bash -echo "Before getopt" -for i -do - echo $i -done -args=`getopt b:p: $*` -set -- $args -echo "After getopt" -for i -do - echo "-->$i" +while [ "$#" -gt 0 ]; do + case "$1" in + -a) ARG_API="${2:-1_0}"; shift 2;; + -b) ARG_BRANCH="${2:-master}"; shift 2;; + + --api-version=*) ARG_API="${1#*=}"; shift 1;; + --branch=*) ARG_BRANCH="${1#*=}"; shift 1;; + --api-version|--branch) echo "$1 requires an argument" >&2; exit 1;; + + -*) echo "unknown option: $1" >&2; exit 1;; + *) handle_argument "$1"; shift 1;; + esac done +echo "==================================================" +echo "Arguments:" +echo " -api-version = $ARG_API" +echo " -branch = $ARG_BRANCH" +echo "==================================================" + # Find current directory & configure paths set -o allexport SCRIPT_PATH=$(realpath $0) @@ -76,7 +83,8 @@ echo 'Stopping all Gradido services' >> $UPDATE_HTML pm2 stop all # git -BRANCH=${1:-master} +# BRANCH=${1:-master} +BRANCH=$ARG_BRANCH echo "Starting with git pull - branch:$BRANCH" >> $UPDATE_HTML cd $PROJECT_ROOT # TODO: this overfetches alot, but ensures we can use start.sh with tags @@ -177,6 +185,13 @@ yarn build # TODO maybe handle this differently? export NODE_ENV=production pm2 delete gradido-federation +# set FEDERATION_PORT from ARG_API +port=${ARG_API//_/} +FEDERATION_PORT=$(($FEDERATION_PORT + $port)) +export FEDERATION_PORT +echo "====================================================" +echo " start federation listening on port=$FEDERATION_PORT +echo "====================================================" pm2 start --name gradido-federation "yarn --cwd $PROJECT_ROOT/federation start" -l $GRADIDO_LOG_PATH/pm2.federation.$TODAY.log --log-date-format 'YYYY-MM-DD HH:mm:ss.SSS' pm2 save diff --git a/federation/src/config/index.ts b/federation/src/config/index.ts index c8a841315..82011a6bc 100644 --- a/federation/src/config/index.ts +++ b/federation/src/config/index.ts @@ -73,7 +73,7 @@ if ( const federation = { // FEDERATION_DHT_TOPIC: process.env.FEDERATION_DHT_TOPIC || null, // FEDERATION_DHT_SEED: process.env.FEDERATION_DHT_SEED || null, - FEDERATION_PORT: process.env.FEDERATION_PORT || 5010, + FEDERATION_PORT: process.env.FEDERATION_PORT || 5000, FEDERATION_API: process.env.FEDERATION_API || '1_0', FEDERATION_COMMUNITY_URL: process.env.FEDERATION_COMMUNITY_URL || null, } From 8ab39765420a14a0487cba153d49e460e07dff3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus-Peter=20H=C3=BCbner?= Date: Wed, 22 Feb 2023 22:57:10 +0100 Subject: [PATCH 026/181] pm2 delete handle case of error as optional --- deployment/bare_metal/start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/bare_metal/start.sh b/deployment/bare_metal/start.sh index 8ec4cfc48..746701206 100755 --- a/deployment/bare_metal/start.sh +++ b/deployment/bare_metal/start.sh @@ -184,7 +184,7 @@ yarn install yarn build # TODO maybe handle this differently? export NODE_ENV=production -pm2 delete gradido-federation +pm2 delete gradido-federation || : # set FEDERATION_PORT from ARG_API port=${ARG_API//_/} FEDERATION_PORT=$(($FEDERATION_PORT + $port)) From 3d7d3ffdeef4b7e3af7f2e4e5f9bd41b4dd763f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus-Peter=20H=C3=BCbner?= Date: Wed, 22 Feb 2023 23:03:29 +0100 Subject: [PATCH 027/181] next try for pm2 delete handling error --- deployment/bare_metal/start.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/deployment/bare_metal/start.sh b/deployment/bare_metal/start.sh index 746701206..a7ffbd036 100755 --- a/deployment/bare_metal/start.sh +++ b/deployment/bare_metal/start.sh @@ -184,7 +184,6 @@ yarn install yarn build # TODO maybe handle this differently? export NODE_ENV=production -pm2 delete gradido-federation || : # set FEDERATION_PORT from ARG_API port=${ARG_API//_/} FEDERATION_PORT=$(($FEDERATION_PORT + $port)) @@ -192,7 +191,7 @@ export FEDERATION_PORT echo "====================================================" echo " start federation listening on port=$FEDERATION_PORT echo "====================================================" -pm2 start --name gradido-federation "yarn --cwd $PROJECT_ROOT/federation start" -l $GRADIDO_LOG_PATH/pm2.federation.$TODAY.log --log-date-format 'YYYY-MM-DD HH:mm:ss.SSS' +pm2 delete gradido-federation || : && pm2 start --name gradido-federation "yarn --cwd $PROJECT_ROOT/federation start" -l $GRADIDO_LOG_PATH/pm2.federation.$TODAY.log --log-date-format 'YYYY-MM-DD HH:mm:ss.SSS' pm2 save # let nginx showing gradido From 3425e5998a84aa35c8e2b0848bf2e6f99bba6359 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus-Peter=20H=C3=BCbner?= Date: Wed, 22 Feb 2023 23:16:07 +0100 Subject: [PATCH 028/181] change federation port settings --- deployment/bare_metal/.env.dist | 1 + deployment/bare_metal/start.sh | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/deployment/bare_metal/.env.dist b/deployment/bare_metal/.env.dist index 80c1b36a1..0e3f2d995 100644 --- a/deployment/bare_metal/.env.dist +++ b/deployment/bare_metal/.env.dist @@ -62,6 +62,7 @@ WEBHOOK_ELOPAGE_SECRET=secret # FEDERATION_DHT_TOPIC=GRADIDO_HUB # FEDERATION_DHT_SEED=64ebcb0e3ad547848fef4197c6e2332f FEDERATION_CONFIG_VERSION=v1.2023-01-09 +FEDERATION_PORT=5000 FEDERATION_API=1_0 # database diff --git a/deployment/bare_metal/start.sh b/deployment/bare_metal/start.sh index a7ffbd036..19d1d8852 100755 --- a/deployment/bare_metal/start.sh +++ b/deployment/bare_metal/start.sh @@ -184,14 +184,16 @@ yarn install yarn build # TODO maybe handle this differently? export NODE_ENV=production +pm2 delete gradido-federation # set FEDERATION_PORT from ARG_API port=${ARG_API//_/} +FEDERATION_PORT=${FEDERATION_PORT:-5000} FEDERATION_PORT=$(($FEDERATION_PORT + $port)) export FEDERATION_PORT echo "====================================================" -echo " start federation listening on port=$FEDERATION_PORT +echo " start federation listening on port=$FEDERATION_PORT" echo "====================================================" -pm2 delete gradido-federation || : && pm2 start --name gradido-federation "yarn --cwd $PROJECT_ROOT/federation start" -l $GRADIDO_LOG_PATH/pm2.federation.$TODAY.log --log-date-format 'YYYY-MM-DD HH:mm:ss.SSS' +pm2 start --name gradido-federation "yarn --cwd $PROJECT_ROOT/federation start" -l $GRADIDO_LOG_PATH/pm2.federation.$TODAY.log --log-date-format 'YYYY-MM-DD HH:mm:ss.SSS' pm2 save # let nginx showing gradido From cc4acd4378fe539106ac0810cebd05a4928ae0b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus-Peter=20H=C3=BCbner?= Date: Wed, 22 Feb 2023 23:52:18 +0100 Subject: [PATCH 029/181] change commandline arg handling --- deployment/bare_metal/start.sh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/deployment/bare_metal/start.sh b/deployment/bare_metal/start.sh index 19d1d8852..2a2f7b4ea 100755 --- a/deployment/bare_metal/start.sh +++ b/deployment/bare_metal/start.sh @@ -1,9 +1,16 @@ #!/bin/bash +#================================================== +# Commandline Arguments: +# -a value short arg: api-version (default=1_0) +# -b value short arg: branch (default=master) +# --api-version=value arg: api-version (default=1_0) +# --branch=value arg: branch (default=master) +#================================================== while [ "$#" -gt 0 ]; do case "$1" in - -a) ARG_API="${2:-1_0}"; shift 2;; - -b) ARG_BRANCH="${2:-master}"; shift 2;; + -a) ARG_API="$2"; shift 2;; + -b) ARG_BRANCH="$2"; shift 2;; --api-version=*) ARG_API="${1#*=}"; shift 1;; --branch=*) ARG_BRANCH="${1#*=}"; shift 1;; @@ -13,7 +20,13 @@ while [ "$#" -gt 0 ]; do *) handle_argument "$1"; shift 1;; esac done - +if [ -z $ARG_API ]; then + ARG_API="1_0" +fi +if [ -z $ARG_BRANCH ]; then + ARG_BRANCH="master" +fi + echo "==================================================" echo "Arguments:" echo " -api-version = $ARG_API" From fd37107da3da67b565f845b2e9e8073a07ef904e Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 23 Feb 2023 08:36:29 +0100 Subject: [PATCH 030/181] set allother test workflows tonot run while working in this branch --- .github/workflows/test.yml | 2 +- .github/workflows/test_dht-node.yml | 6 ++++-- .github/workflows/test_federation.yml | 5 ++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 722bef1c1..a435c7425 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,7 +3,7 @@ name: gradido test CI on: push: branches: - - separate-admin-interface-workflow + - none jobs: ############################################################################## diff --git a/.github/workflows/test_dht-node.yml b/.github/workflows/test_dht-node.yml index 5b3a65a70..35d9bca7d 100644 --- a/.github/workflows/test_dht-node.yml +++ b/.github/workflows/test_dht-node.yml @@ -1,7 +1,9 @@ name: gradido test_dht-node CI -on: push - +on: + push: + branches: + - none jobs: ############################################################################## # JOB: DOCKER BUILD TEST ##################################################### diff --git a/.github/workflows/test_federation.yml b/.github/workflows/test_federation.yml index 2da78758e..b49473af2 100644 --- a/.github/workflows/test_federation.yml +++ b/.github/workflows/test_federation.yml @@ -1,6 +1,9 @@ name: gradido test_federation CI -on: push +on: + push: + branches: + - none jobs: ############################################################################## From 287659af0695fb06ae3254603c6dfb87f951f329 Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 23 Feb 2023 08:54:33 +0100 Subject: [PATCH 031/181] add file change check for linting to test admin workflow --- .github/file-filters.yml | 6 ++++++ .github/workflows/test-admin-interface.yml | 3 +++ 2 files changed, 9 insertions(+) diff --git a/.github/file-filters.yml b/.github/file-filters.yml index d835f778f..81f44a157 100644 --- a/.github/file-filters.yml +++ b/.github/file-filters.yml @@ -6,3 +6,9 @@ admin_locales: &admin_locales admin_stylelinting: &admin_stylelinting - 'admin/{components,layouts,pages}/**/*.{scss,vue}' - 'admin/.stylelintrc.js' + +admin_linting: &admin_linting + - 'admin/.eslint*' + - 'admin/babel.config.js' + - 'admin/package.json' + - 'admin/**/*.{js,vue}' \ No newline at end of file diff --git a/.github/workflows/test-admin-interface.yml b/.github/workflows/test-admin-interface.yml index 0fcb1f549..4faa60550 100644 --- a/.github/workflows/test-admin-interface.yml +++ b/.github/workflows/test-admin-interface.yml @@ -11,6 +11,7 @@ jobs: name: Detect File Changes - Admin Interface runs-on: ubuntu-latest outputs: + admin_linting: ${{ steps.changes.outputs.admin_linting }} admin_locales: ${{ steps.changes.outputs.admin_locales }} admin_stylelinting: ${{ steps.changes.outputs.admin_stylelinting }} steps: @@ -57,7 +58,9 @@ jobs: token: ${{ github.token }} lint_admin: + if: needs.files-changed.outputs.admin_linting == 'true' name: Lint - Admin Interface + needs:files-changed runs-on: ubuntu-latest steps: - name: Checkout code From 6b4579454d5e7b5e660da09a5f19e0613395d582 Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 23 Feb 2023 08:56:34 +0100 Subject: [PATCH 032/181] add sortscriptsto admin locales file filter --- .github/file-filters.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/file-filters.yml b/.github/file-filters.yml index 81f44a157..99cc32d3e 100644 --- a/.github/file-filters.yml +++ b/.github/file-filters.yml @@ -2,6 +2,7 @@ admin_locales: &admin_locales - 'admin/src/locales/**' + - 'admin/scripts/sort*' admin_stylelinting: &admin_stylelinting - 'admin/{components,layouts,pages}/**/*.{scss,vue}' From af6b08bfd7c4aabeb49d74c8dcdee5d8ad194a35 Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 23 Feb 2023 08:58:27 +0100 Subject: [PATCH 033/181] fix typo --- .github/workflows/test-admin-interface.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-admin-interface.yml b/.github/workflows/test-admin-interface.yml index 4faa60550..a721be8fd 100644 --- a/.github/workflows/test-admin-interface.yml +++ b/.github/workflows/test-admin-interface.yml @@ -60,7 +60,7 @@ jobs: lint_admin: if: needs.files-changed.outputs.admin_linting == 'true' name: Lint - Admin Interface - needs:files-changed + needs: files-changed runs-on: ubuntu-latest steps: - name: Checkout code From 964bdebbda36085f75340a9556c42e291765fae5 Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 23 Feb 2023 09:54:13 +0100 Subject: [PATCH 034/181] add locales filter to linting filter --- .github/file-filters.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/file-filters.yml b/.github/file-filters.yml index 99cc32d3e..b55174526 100644 --- a/.github/file-filters.yml +++ b/.github/file-filters.yml @@ -11,5 +11,10 @@ admin_stylelinting: &admin_stylelinting admin_linting: &admin_linting - 'admin/.eslint*' - 'admin/babel.config.js' + - 'admin/package.json' + - 'admin/**/*.{js,vue}' + - *admin_locales + +admin_unit_testing: &admin_unit_testing - 'admin/package.json' - 'admin/**/*.{js,vue}' \ No newline at end of file From 72511fb14e83acca3547cfec01ccaabffcb336dd Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 23 Feb 2023 10:44:49 +0100 Subject: [PATCH 035/181] add file change check for unit tests to test admin workflow --- .github/file-filters.yml | 3 ++- .github/workflows/test-admin-interface.yml | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/file-filters.yml b/.github/file-filters.yml index b55174526..96bcbd7c8 100644 --- a/.github/file-filters.yml +++ b/.github/file-filters.yml @@ -17,4 +17,5 @@ admin_linting: &admin_linting admin_unit_testing: &admin_unit_testing - 'admin/package.json' - - 'admin/**/*.{js,vue}' \ No newline at end of file + - 'admin/{jest,vue}.config.js' + - 'admin/{public,run,src,test}/**/*' diff --git a/.github/workflows/test-admin-interface.yml b/.github/workflows/test-admin-interface.yml index a721be8fd..4809059cd 100644 --- a/.github/workflows/test-admin-interface.yml +++ b/.github/workflows/test-admin-interface.yml @@ -14,6 +14,7 @@ jobs: admin_linting: ${{ steps.changes.outputs.admin_linting }} admin_locales: ${{ steps.changes.outputs.admin_locales }} admin_stylelinting: ${{ steps.changes.outputs.admin_stylelinting }} + admin_unit_testing: ${{ steps.changes.outputs.admin_unit_testing }} steps: - uses: actions/checkout@v3.3.0 @@ -37,7 +38,9 @@ jobs: run: docker build --target test -t "gradido/admin:test" admin/ --build-arg NODE_ENV="test" unit_test_admin: + if: needs.files-changed.outputs.admin_unit_testing == 'true' name: Unit Tests - Admin Interface + needs: files-changed runs-on: ubuntu-latest steps: - name: Checkout code From 4d6854463ad9f235d74a3e171239c9f02f3424df Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 23 Feb 2023 11:10:48 +0100 Subject: [PATCH 036/181] add file change check for building test to test admin workflow --- .github/file-filters.yml | 5 +++++ .github/workflows/test-admin-interface.yml | 3 +++ 2 files changed, 8 insertions(+) diff --git a/.github/file-filters.yml b/.github/file-filters.yml index 96bcbd7c8..fa00c33fb 100644 --- a/.github/file-filters.yml +++ b/.github/file-filters.yml @@ -19,3 +19,8 @@ admin_unit_testing: &admin_unit_testing - 'admin/package.json' - 'admin/{jest,vue}.config.js' - 'admin/{public,run,src,test}/**/*' + +admin_docker_building: &admin_docker_building + - 'admin/.dockerignore' + - 'admin/Dockerfile' + - *admin_unit_testing \ No newline at end of file diff --git a/.github/workflows/test-admin-interface.yml b/.github/workflows/test-admin-interface.yml index 4809059cd..44316040b 100644 --- a/.github/workflows/test-admin-interface.yml +++ b/.github/workflows/test-admin-interface.yml @@ -11,6 +11,7 @@ jobs: name: Detect File Changes - Admin Interface runs-on: ubuntu-latest outputs: + admin_docker_building: ${{ steps.changes.outputs.admin_docker_building }} admin_linting: ${{ steps.changes.outputs.admin_linting }} admin_locales: ${{ steps.changes.outputs.admin_locales }} admin_stylelinting: ${{ steps.changes.outputs.admin_stylelinting }} @@ -27,7 +28,9 @@ jobs: list-files: shell build_test_admin: + if: needs.files-changed.outputs.admin_docker_building == 'true' name: Docker Build Test - Admin Interface + needs: files-changed runs-on: ubuntu-latest steps: From 10bbf6dfbd487552c07a4b490032b78ee2c4b8b1 Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 23 Feb 2023 11:16:33 +0100 Subject: [PATCH 037/181] add file change check for building test to test admin workflow --- .github/workflows/test-admin-interface.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-admin-interface.yml b/.github/workflows/test-admin-interface.yml index 44316040b..60e22b5cd 100644 --- a/.github/workflows/test-admin-interface.yml +++ b/.github/workflows/test-admin-interface.yml @@ -28,7 +28,7 @@ jobs: list-files: shell build_test_admin: - if: needs.files-changed.outputs.admin_docker_building == 'true' + if: needs.files-changed.outputs.admin_docker_building == 'true' name: Docker Build Test - Admin Interface needs: files-changed runs-on: ubuntu-latest From c7d467759895ece24ca260c01fc1b84a3053f7b0 Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 23 Feb 2023 11:18:46 +0100 Subject: [PATCH 038/181] test change in locaes --- admin/src/locales/de.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/src/locales/de.json b/admin/src/locales/de.json index 00eef1812..14088fe92 100644 --- a/admin/src/locales/de.json +++ b/admin/src/locales/de.json @@ -13,7 +13,7 @@ "deleted": "Automatische Schöpfung gelöscht!", "deleteNow": "Automatische Creations '{name}' wirklich löschen?", "maxPerCycle": "Wiederholungen", - "memo": "Nachricht", + "memo": "NachrichtTEST", "name": "Name", "newContributionLink": "Neuer Beitragslink", "noContributionLinks": "Es sind keine Beitragslinks angelegt.", From fdb975fe4f78543b1650672e39d5184d6c86042b Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 23 Feb 2023 11:26:57 +0100 Subject: [PATCH 039/181] exclude locales files from filter for unit tests --- .github/file-filters.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/file-filters.yml b/.github/file-filters.yml index fa00c33fb..9f6ab116a 100644 --- a/.github/file-filters.yml +++ b/.github/file-filters.yml @@ -18,7 +18,7 @@ admin_linting: &admin_linting admin_unit_testing: &admin_unit_testing - 'admin/package.json' - 'admin/{jest,vue}.config.js' - - 'admin/{public,run,src,test}/**/*' + - 'admin/{public,run,src!(locales),test}/**/*' admin_docker_building: &admin_docker_building - 'admin/.dockerignore' From 06174a8082ff8f19f2bacc970b2836642ef61f87 Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 23 Feb 2023 11:26:57 +0100 Subject: [PATCH 040/181] exclude locales files from filter for unit tests --- .github/file-filters.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/file-filters.yml b/.github/file-filters.yml index 9f6ab116a..ff8451785 100644 --- a/.github/file-filters.yml +++ b/.github/file-filters.yml @@ -18,7 +18,8 @@ admin_linting: &admin_linting admin_unit_testing: &admin_unit_testing - 'admin/package.json' - 'admin/{jest,vue}.config.js' - - 'admin/{public,run,src!(locales),test}/**/*' + - 'admin/{public,run,test}/**/*' + - 'admin/src/!(locales)/**/*' admin_docker_building: &admin_docker_building - 'admin/.dockerignore' From 83491184033e2b6848599da8bbbf1fa73628728f Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 23 Feb 2023 11:52:11 +0100 Subject: [PATCH 041/181] test changes --- admin/Dockerfile | 2 +- admin/src/locales/de.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/Dockerfile b/admin/Dockerfile index ed0623a63..6b2e4d9d9 100644 --- a/admin/Dockerfile +++ b/admin/Dockerfile @@ -1,5 +1,5 @@ ################################################################################## -# BASE ########################################################################### +# BASE #######################################################################TEST ################################################################################## FROM node:14.17.0-alpine3.10 as base diff --git a/admin/src/locales/de.json b/admin/src/locales/de.json index 14088fe92..00eef1812 100644 --- a/admin/src/locales/de.json +++ b/admin/src/locales/de.json @@ -13,7 +13,7 @@ "deleted": "Automatische Schöpfung gelöscht!", "deleteNow": "Automatische Creations '{name}' wirklich löschen?", "maxPerCycle": "Wiederholungen", - "memo": "NachrichtTEST", + "memo": "Nachricht", "name": "Name", "newContributionLink": "Neuer Beitragslink", "noContributionLinks": "Es sind keine Beitragslinks angelegt.", From 1181c4b85d73899a36066915c57f05e9de776e8a Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 23 Feb 2023 11:58:33 +0100 Subject: [PATCH 042/181] test changes --- admin/Dockerfile | 2 +- admin/src/graphql/adminCreateContribution.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/admin/Dockerfile b/admin/Dockerfile index 6b2e4d9d9..ed0623a63 100644 --- a/admin/Dockerfile +++ b/admin/Dockerfile @@ -1,5 +1,5 @@ ################################################################################## -# BASE #######################################################################TEST +# BASE ########################################################################### ################################################################################## FROM node:14.17.0-alpine3.10 as base diff --git a/admin/src/graphql/adminCreateContribution.js b/admin/src/graphql/adminCreateContribution.js index 5ee409c67..1c40f3ff1 100644 --- a/admin/src/graphql/adminCreateContribution.js +++ b/admin/src/graphql/adminCreateContribution.js @@ -1,5 +1,6 @@ import gql from 'graphql-tag' +// TEST export const adminCreateContribution = gql` mutation ($email: String!, $amount: Decimal!, $memo: String!, $creationDate: String!) { adminCreateContribution( From e326e874b8d1d745d31e3ddf44f1f2c29922507d Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 23 Feb 2023 12:17:29 +0100 Subject: [PATCH 043/181] undo test changes --- admin/src/graphql/adminCreateContribution.js | 1 - 1 file changed, 1 deletion(-) diff --git a/admin/src/graphql/adminCreateContribution.js b/admin/src/graphql/adminCreateContribution.js index 1c40f3ff1..5ee409c67 100644 --- a/admin/src/graphql/adminCreateContribution.js +++ b/admin/src/graphql/adminCreateContribution.js @@ -1,6 +1,5 @@ import gql from 'graphql-tag' -// TEST export const adminCreateContribution = gql` mutation ($email: String!, $amount: Decimal!, $memo: String!, $creationDate: String!) { adminCreateContribution( From 949887fe009657db0af9c58df7ba14c0fc714c0b Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 23 Feb 2023 13:49:41 +0100 Subject: [PATCH 044/181] set test.yml to be triggered by push to this current branch --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a435c7425..722bef1c1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,7 +3,7 @@ name: gradido test CI on: push: branches: - - none + - separate-admin-interface-workflow jobs: ############################################################################## From c7559b8606dffc73ad51a550a8b138908d5b6311 Mon Sep 17 00:00:00 2001 From: mahula Date: Thu, 23 Feb 2023 13:56:05 +0100 Subject: [PATCH 045/181] add shortdocumentation to filechange job --- .github/workflows/test-admin-interface.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-admin-interface.yml b/.github/workflows/test-admin-interface.yml index 60e22b5cd..9f589efce 100644 --- a/.github/workflows/test-admin-interface.yml +++ b/.github/workflows/test-admin-interface.yml @@ -6,7 +6,8 @@ on: - separate-admin-interface-workflow jobs: - # + # only (but most important) job from this workflow required for pull requests + # check results serve as run conditions for all other jobs here files-changed: name: Detect File Changes - Admin Interface runs-on: ubuntu-latest From 28c4abc7e9bc2838bda73f26464f02ba9b88ad87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus-Peter=20H=C3=BCbner?= Date: Fri, 24 Feb 2023 00:54:57 +0100 Subject: [PATCH 046/181] start several federation moduls base on FEDERATION_COMMUNITY_APIS --- deployment/bare_metal/.env.dist | 7 ++-- deployment/bare_metal/start.sh | 69 +++++++++++---------------------- federation/src/config/index.ts | 4 +- federation/src/index.ts | 2 +- 4 files changed, 30 insertions(+), 52 deletions(-) diff --git a/deployment/bare_metal/.env.dist b/deployment/bare_metal/.env.dist index 7028966bf..0a4a2db4d 100644 --- a/deployment/bare_metal/.env.dist +++ b/deployment/bare_metal/.env.dist @@ -61,14 +61,13 @@ FEDERATION_DHT_CONFIG_VERSION=v2.2023-02-07 # if you set the value of FEDERATION_DHT_TOPIC, the DHT hyperswarm will start to announce and listen on an hash created from this topic # FEDERATION_DHT_TOPIC=GRADIDO_HUB # FEDERATION_DHT_SEED=64ebcb0e3ad547848fef4197c6e2332f - -FEDERATION_CONFIG_VERSION=v1.2023-01-09 -FEDERATION_PORT=5000 -FEDERATION_API=1_0 FEDERATION_COMMUNITY_URL=http://stage1.gradido.net # the api port is the baseport, which will be added with the api-version, e.g. 1_0 = 5010 FEDERATION_COMMUNITY_API_PORT=5000 +FEDERATION_CONFIG_VERSION=v1.2023-01-09 +FEDERATION_COMMUNITY_APIS=1_0,1_1,2_0 + # database DATABASE_CONFIG_VERSION=v1.2022-03-18 diff --git a/deployment/bare_metal/start.sh b/deployment/bare_metal/start.sh index 39491d699..63c912b55 100755 --- a/deployment/bare_metal/start.sh +++ b/deployment/bare_metal/start.sh @@ -1,38 +1,5 @@ #!/bin/bash -#================================================== -# Commandline Arguments: -# -a value short arg: api-version (default=1_0) -# -b value short arg: branch (default=master) -# --api-version=value arg: api-version (default=1_0) -# --branch=value arg: branch (default=master) -#================================================== -while [ "$#" -gt 0 ]; do - case "$1" in - -a) ARG_API="$2"; shift 2;; - -b) ARG_BRANCH="$2"; shift 2;; - - --api-version=*) ARG_API="${1#*=}"; shift 1;; - --branch=*) ARG_BRANCH="${1#*=}"; shift 1;; - --api-version|--branch) echo "$1 requires an argument" >&2; exit 1;; - - -*) echo "unknown option: $1" >&2; exit 1;; - *) handle_argument "$1"; shift 1;; - esac -done -if [ -z $ARG_API ]; then - ARG_API="1_0" -fi -if [ -z $ARG_BRANCH ]; then - ARG_BRANCH="master" -fi - -echo "==================================================" -echo "Arguments:" -echo " -api-version = $ARG_API" -echo " -branch = $ARG_BRANCH" -echo "==================================================" - # Find current directory & configure paths set -o allexport SCRIPT_PATH=$(realpath $0) @@ -96,8 +63,7 @@ echo 'Stopping all Gradido services' >> $UPDATE_HTML pm2 stop all # git -# BRANCH=${1:-master} -BRANCH=$ARG_BRANCH +BRANCH=${1:-master} echo "Starting with git pull - branch:$BRANCH" >> $UPDATE_HTML cd $PROJECT_ROOT # TODO: this overfetches alot, but ensures we can use start.sh with tags @@ -219,17 +185,28 @@ yarn install yarn build # TODO maybe handle this differently? export NODE_ENV=production -pm2 delete gradido-federation -# set FEDERATION_PORT from ARG_API -port=${ARG_API//_/} -FEDERATION_PORT=${FEDERATION_PORT:-5000} -FEDERATION_PORT=$(($FEDERATION_PORT + $port)) -export FEDERATION_PORT -echo "====================================================" -echo " start federation listening on port=$FEDERATION_PORT" -echo "====================================================" -pm2 start --name gradido-federation "yarn --cwd $PROJECT_ROOT/federation start" -l $GRADIDO_LOG_PATH/pm2.federation.$TODAY.log --log-date-format 'YYYY-MM-DD HH:mm:ss.SSS' -pm2 save +# set FEDERATION_PORT from FEDERATION_COMMUNITY_APIS +IFS="," read -a API_ARRAY <<< $FEDERATION_COMMUNITY_APIS +for api in "${API_ARRAY[@]}" +do + FEDERATION_API=$api + export FEDERATION_API + modulname=gradido-federation-$api + # calculate port by remove '_' and add value of api to baseport + port=${api//_/} + FEDERATION_PORT=${FEDERATION_COMMUNITY_API_PORT:-5000} + FEDERATION_PORT=$(($FEDERATION_PORT + $port)) + export FEDERATION_PORT + echo "====================================================" + echo " start $modulename listening on port=$FEDERATION_PORT" + echo "====================================================" + pm2 delete $modulename + pm2 start --name $modulename "yarn --cwd $PROJECT_ROOT/federation start" -l $GRADIDO_LOG_PATH/pm2.$modulename.$TODAY.log --log-date-format 'YYYY-MM-DD HH:mm:ss.SSS' + pm2 save +done + + + # let nginx showing gradido echo 'Configuring nginx to serve gradido again' >> $UPDATE_HTML diff --git a/federation/src/config/index.ts b/federation/src/config/index.ts index 82011a6bc..de474f517 100644 --- a/federation/src/config/index.ts +++ b/federation/src/config/index.ts @@ -73,8 +73,10 @@ if ( const federation = { // FEDERATION_DHT_TOPIC: process.env.FEDERATION_DHT_TOPIC || null, // FEDERATION_DHT_SEED: process.env.FEDERATION_DHT_SEED || null, - FEDERATION_PORT: process.env.FEDERATION_PORT || 5000, + FEDERATION_COMMUNITY_API_PORT: + process.env.FEDERATION_COMMUNITY_API_PORT || 5000, FEDERATION_API: process.env.FEDERATION_API || '1_0', + FEDERATION_PORT: process.env.FEDERATION_PORT || 5010, FEDERATION_COMMUNITY_URL: process.env.FEDERATION_COMMUNITY_URL || null, } diff --git a/federation/src/index.ts b/federation/src/index.ts index 9096cb260..daf9bfa56 100644 --- a/federation/src/index.ts +++ b/federation/src/index.ts @@ -20,7 +20,7 @@ async function main() { if (CONFIG.GRAPHIQL) { // eslint-disable-next-line no-console console.log( - `GraphIQL available at http://localhost:${CONFIG.FEDERATION_PORT}` + `GraphIQL available at ${CONFIG.FEDERATION_COMMUNITY_URL}:${CONFIG.FEDERATION_PORT}/api` ) } }) From ed010a50f94102f985105c91c11bf220ba8aa9b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus-Peter=20H=C3=BCbner?= Date: Fri, 24 Feb 2023 01:08:02 +0100 Subject: [PATCH 047/181] =?UTF-8?q?correct=20modul-name=C3=ADng=20in=20loo?= =?UTF-8?q?p?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deployment/bare_metal/start.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deployment/bare_metal/start.sh b/deployment/bare_metal/start.sh index 63c912b55..1db9daf4a 100755 --- a/deployment/bare_metal/start.sh +++ b/deployment/bare_metal/start.sh @@ -189,9 +189,9 @@ export NODE_ENV=production IFS="," read -a API_ARRAY <<< $FEDERATION_COMMUNITY_APIS for api in "${API_ARRAY[@]}" do - FEDERATION_API=$api + FEDERATION_API="$api" export FEDERATION_API - modulname=gradido-federation-$api + modulname="gradido-federation-$api" # calculate port by remove '_' and add value of api to baseport port=${api//_/} FEDERATION_PORT=${FEDERATION_COMMUNITY_API_PORT:-5000} From f570c8416857d47028ca85283d8827216d2043a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus-Peter=20H=C3=BCbner?= Date: Fri, 24 Feb 2023 01:17:37 +0100 Subject: [PATCH 048/181] next try to correct modulname in loop --- deployment/bare_metal/start.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/deployment/bare_metal/start.sh b/deployment/bare_metal/start.sh index 1db9daf4a..a86e1be3e 100755 --- a/deployment/bare_metal/start.sh +++ b/deployment/bare_metal/start.sh @@ -189,19 +189,20 @@ export NODE_ENV=production IFS="," read -a API_ARRAY <<< $FEDERATION_COMMUNITY_APIS for api in "${API_ARRAY[@]}" do - FEDERATION_API="$api" - export FEDERATION_API - modulname="gradido-federation-$api" + export FEDERATION_API=$api + echo "FEDERATION_API=$FEDERATION_API" + export MODULENAME=gradido-federation-$api + echo "MODULENAME=$MODULENAME" # calculate port by remove '_' and add value of api to baseport port=${api//_/} FEDERATION_PORT=${FEDERATION_COMMUNITY_API_PORT:-5000} FEDERATION_PORT=$(($FEDERATION_PORT + $port)) export FEDERATION_PORT echo "====================================================" - echo " start $modulename listening on port=$FEDERATION_PORT" + echo " start $MODULENAME listening on port=$FEDERATION_PORT" echo "====================================================" - pm2 delete $modulename - pm2 start --name $modulename "yarn --cwd $PROJECT_ROOT/federation start" -l $GRADIDO_LOG_PATH/pm2.$modulename.$TODAY.log --log-date-format 'YYYY-MM-DD HH:mm:ss.SSS' + pm2 delete $MODULENAME + pm2 start --name $MODULENAME "yarn --cwd $PROJECT_ROOT/federation start" -l $GRADIDO_LOG_PATH/pm2.$MODULENAME.$TODAY.log --log-date-format 'YYYY-MM-DD HH:mm:ss.SSS' pm2 save done From 132f92956b7e5662c925a8510b9ac84c2458b0f6 Mon Sep 17 00:00:00 2001 From: mahula Date: Fri, 24 Feb 2023 08:23:18 +0100 Subject: [PATCH 049/181] set file change filter for admin test workflow to main directory --- .github/file-filters.yml | 5 ++++- .github/workflows/test-admin-interface.yml | 16 ++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/file-filters.yml b/.github/file-filters.yml index ff8451785..12832aaca 100644 --- a/.github/file-filters.yml +++ b/.github/file-filters.yml @@ -24,4 +24,7 @@ admin_unit_testing: &admin_unit_testing admin_docker_building: &admin_docker_building - 'admin/.dockerignore' - 'admin/Dockerfile' - - *admin_unit_testing \ No newline at end of file + - *admin_unit_testing + +admin_main: &admin_main + - 'admin/**/*' \ No newline at end of file diff --git a/.github/workflows/test-admin-interface.yml b/.github/workflows/test-admin-interface.yml index 9f589efce..7bdfa84cf 100644 --- a/.github/workflows/test-admin-interface.yml +++ b/.github/workflows/test-admin-interface.yml @@ -12,11 +12,7 @@ jobs: name: Detect File Changes - Admin Interface runs-on: ubuntu-latest outputs: - admin_docker_building: ${{ steps.changes.outputs.admin_docker_building }} - admin_linting: ${{ steps.changes.outputs.admin_linting }} - admin_locales: ${{ steps.changes.outputs.admin_locales }} - admin_stylelinting: ${{ steps.changes.outputs.admin_stylelinting }} - admin_unit_testing: ${{ steps.changes.outputs.admin_unit_testing }} + admin_main: ${{ steps.changes.outputs.admin_main }} steps: - uses: actions/checkout@v3.3.0 @@ -29,7 +25,7 @@ jobs: list-files: shell build_test_admin: - if: needs.files-changed.outputs.admin_docker_building == 'true' + if: needs.files-changed.outputs.admin_main == 'true' name: Docker Build Test - Admin Interface needs: files-changed runs-on: ubuntu-latest @@ -42,7 +38,7 @@ jobs: run: docker build --target test -t "gradido/admin:test" admin/ --build-arg NODE_ENV="test" unit_test_admin: - if: needs.files-changed.outputs.admin_unit_testing == 'true' + if: needs.files-changed.outputs.admin_main == 'true' name: Unit Tests - Admin Interface needs: files-changed runs-on: ubuntu-latest @@ -65,7 +61,7 @@ jobs: token: ${{ github.token }} lint_admin: - if: needs.files-changed.outputs.admin_linting == 'true' + if: needs.files-changed.outputs.admin_main == 'true' name: Lint - Admin Interface needs: files-changed runs-on: ubuntu-latest @@ -77,7 +73,7 @@ jobs: run: cd admin && yarn && yarn run lint stylelint_admin: - if: needs.files-changed.outputs.admin_stylelinting == 'true' + if: needs.files-changed.outputs.admin_main == 'true' name: Stylelint - Admin Interface needs: files-changed runs-on: ubuntu-latest @@ -89,7 +85,7 @@ jobs: run: cd admin && yarn && yarn run stylelint locales_admin: - if: needs.files-changed.outputs.admin_locales == 'true' + if: needs.files-changed.outputs.admin_main == 'true' name: Locales - Admin Interface needs: files-changed runs-on: ubuntu-latest From adea7c1c155c3d35cc26cfe8db8f4870baf0ac39 Mon Sep 17 00:00:00 2001 From: mahula Date: Fri, 24 Feb 2023 12:22:53 +0100 Subject: [PATCH 050/181] rename admit test workflow jobs --- .github/workflows/test-admin-interface.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-admin-interface.yml b/.github/workflows/test-admin-interface.yml index 7bdfa84cf..53bd85ca5 100644 --- a/.github/workflows/test-admin-interface.yml +++ b/.github/workflows/test-admin-interface.yml @@ -24,7 +24,7 @@ jobs: filters: .github/file-filters.yml list-files: shell - build_test_admin: + build_test: if: needs.files-changed.outputs.admin_main == 'true' name: Docker Build Test - Admin Interface needs: files-changed @@ -37,7 +37,7 @@ jobs: - name: Admin Interface | Build 'test' image run: docker build --target test -t "gradido/admin:test" admin/ --build-arg NODE_ENV="test" - unit_test_admin: + unit_test: if: needs.files-changed.outputs.admin_main == 'true' name: Unit Tests - Admin Interface needs: files-changed @@ -60,7 +60,7 @@ jobs: min_coverage: 97 token: ${{ github.token }} - lint_admin: + lint: if: needs.files-changed.outputs.admin_main == 'true' name: Lint - Admin Interface needs: files-changed @@ -72,7 +72,7 @@ jobs: - name: Admin Interface | Lint run: cd admin && yarn && yarn run lint - stylelint_admin: + stylelint: if: needs.files-changed.outputs.admin_main == 'true' name: Stylelint - Admin Interface needs: files-changed @@ -84,7 +84,7 @@ jobs: - name: Admin Interface | Stylelint run: cd admin && yarn && yarn run stylelint - locales_admin: + locales: if: needs.files-changed.outputs.admin_main == 'true' name: Locales - Admin Interface needs: files-changed From 289ed452d1d99bf25dce05dd8163c8585673190b Mon Sep 17 00:00:00 2001 From: mahula Date: Fri, 24 Feb 2023 13:03:04 +0100 Subject: [PATCH 051/181] rename file filter for admin test workflow --- .github/file-filters.yml | 2 +- .github/workflows/test-admin-interface.yml | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/file-filters.yml b/.github/file-filters.yml index 12832aaca..d6c53c0c8 100644 --- a/.github/file-filters.yml +++ b/.github/file-filters.yml @@ -26,5 +26,5 @@ admin_docker_building: &admin_docker_building - 'admin/Dockerfile' - *admin_unit_testing -admin_main: &admin_main +admin: &admin - 'admin/**/*' \ No newline at end of file diff --git a/.github/workflows/test-admin-interface.yml b/.github/workflows/test-admin-interface.yml index 53bd85ca5..1d152a898 100644 --- a/.github/workflows/test-admin-interface.yml +++ b/.github/workflows/test-admin-interface.yml @@ -12,7 +12,7 @@ jobs: name: Detect File Changes - Admin Interface runs-on: ubuntu-latest outputs: - admin_main: ${{ steps.changes.outputs.admin_main }} + admin: ${{ steps.changes.outputs.admin }} steps: - uses: actions/checkout@v3.3.0 @@ -25,7 +25,7 @@ jobs: list-files: shell build_test: - if: needs.files-changed.outputs.admin_main == 'true' + if: needs.files-changed.outputs.admin == 'true' name: Docker Build Test - Admin Interface needs: files-changed runs-on: ubuntu-latest @@ -38,7 +38,7 @@ jobs: run: docker build --target test -t "gradido/admin:test" admin/ --build-arg NODE_ENV="test" unit_test: - if: needs.files-changed.outputs.admin_main == 'true' + if: needs.files-changed.outputs.admin == 'true' name: Unit Tests - Admin Interface needs: files-changed runs-on: ubuntu-latest @@ -61,7 +61,7 @@ jobs: token: ${{ github.token }} lint: - if: needs.files-changed.outputs.admin_main == 'true' + if: needs.files-changed.outputs.admin == 'true' name: Lint - Admin Interface needs: files-changed runs-on: ubuntu-latest @@ -73,7 +73,7 @@ jobs: run: cd admin && yarn && yarn run lint stylelint: - if: needs.files-changed.outputs.admin_main == 'true' + if: needs.files-changed.outputs.admin == 'true' name: Stylelint - Admin Interface needs: files-changed runs-on: ubuntu-latest @@ -85,7 +85,7 @@ jobs: run: cd admin && yarn && yarn run stylelint locales: - if: needs.files-changed.outputs.admin_main == 'true' + if: needs.files-changed.outputs.admin == 'true' name: Locales - Admin Interface needs: files-changed runs-on: ubuntu-latest From 1473e01331df6089786491acb2409360b8931df6 Mon Sep 17 00:00:00 2001 From: mahula Date: Fri, 24 Feb 2023 13:16:14 +0100 Subject: [PATCH 052/181] test admin file filter with change to admin/Dockerfile --- admin/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/Dockerfile b/admin/Dockerfile index ed0623a63..6b2e4d9d9 100644 --- a/admin/Dockerfile +++ b/admin/Dockerfile @@ -1,5 +1,5 @@ ################################################################################## -# BASE ########################################################################### +# BASE #######################################################################TEST ################################################################################## FROM node:14.17.0-alpine3.10 as base From 2d51d6b581fca47ee3bb78b22b03c05cccae9050 Mon Sep 17 00:00:00 2001 From: mahula Date: Fri, 24 Feb 2023 13:26:52 +0100 Subject: [PATCH 053/181] test admin file filter with change to admin/public --- admin/Dockerfile | 2 +- admin/{public => public_TEST}/favicon.png | Bin .../img/brand/gradido_logo_w.png | Bin admin/{public => public_TEST}/img/brand/green.png | Bin .../{public => public_TEST}/img/elopage_favicon.png | Bin admin/{public => public_TEST}/img/gdd-coin.png | Bin admin/{public => public_TEST}/index.html | 0 7 files changed, 1 insertion(+), 1 deletion(-) rename admin/{public => public_TEST}/favicon.png (100%) rename admin/{public => public_TEST}/img/brand/gradido_logo_w.png (100%) rename admin/{public => public_TEST}/img/brand/green.png (100%) rename admin/{public => public_TEST}/img/elopage_favicon.png (100%) rename admin/{public => public_TEST}/img/gdd-coin.png (100%) rename admin/{public => public_TEST}/index.html (100%) diff --git a/admin/Dockerfile b/admin/Dockerfile index 6b2e4d9d9..ed0623a63 100644 --- a/admin/Dockerfile +++ b/admin/Dockerfile @@ -1,5 +1,5 @@ ################################################################################## -# BASE #######################################################################TEST +# BASE ########################################################################### ################################################################################## FROM node:14.17.0-alpine3.10 as base diff --git a/admin/public/favicon.png b/admin/public_TEST/favicon.png similarity index 100% rename from admin/public/favicon.png rename to admin/public_TEST/favicon.png diff --git a/admin/public/img/brand/gradido_logo_w.png b/admin/public_TEST/img/brand/gradido_logo_w.png similarity index 100% rename from admin/public/img/brand/gradido_logo_w.png rename to admin/public_TEST/img/brand/gradido_logo_w.png diff --git a/admin/public/img/brand/green.png b/admin/public_TEST/img/brand/green.png similarity index 100% rename from admin/public/img/brand/green.png rename to admin/public_TEST/img/brand/green.png diff --git a/admin/public/img/elopage_favicon.png b/admin/public_TEST/img/elopage_favicon.png similarity index 100% rename from admin/public/img/elopage_favicon.png rename to admin/public_TEST/img/elopage_favicon.png diff --git a/admin/public/img/gdd-coin.png b/admin/public_TEST/img/gdd-coin.png similarity index 100% rename from admin/public/img/gdd-coin.png rename to admin/public_TEST/img/gdd-coin.png diff --git a/admin/public/index.html b/admin/public_TEST/index.html similarity index 100% rename from admin/public/index.html rename to admin/public_TEST/index.html From d8a786c55b49afad4471d45b9a7fca1bf064ad46 Mon Sep 17 00:00:00 2001 From: mahula Date: Fri, 24 Feb 2023 13:37:31 +0100 Subject: [PATCH 054/181] undo change to admin/public --- admin/{public_TEST => public}/favicon.png | Bin .../img/brand/gradido_logo_w.png | Bin admin/{public_TEST => public}/img/brand/green.png | Bin .../{public_TEST => public}/img/elopage_favicon.png | Bin admin/{public_TEST => public}/img/gdd-coin.png | Bin admin/{public_TEST => public}/index.html | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename admin/{public_TEST => public}/favicon.png (100%) rename admin/{public_TEST => public}/img/brand/gradido_logo_w.png (100%) rename admin/{public_TEST => public}/img/brand/green.png (100%) rename admin/{public_TEST => public}/img/elopage_favicon.png (100%) rename admin/{public_TEST => public}/img/gdd-coin.png (100%) rename admin/{public_TEST => public}/index.html (100%) diff --git a/admin/public_TEST/favicon.png b/admin/public/favicon.png similarity index 100% rename from admin/public_TEST/favicon.png rename to admin/public/favicon.png diff --git a/admin/public_TEST/img/brand/gradido_logo_w.png b/admin/public/img/brand/gradido_logo_w.png similarity index 100% rename from admin/public_TEST/img/brand/gradido_logo_w.png rename to admin/public/img/brand/gradido_logo_w.png diff --git a/admin/public_TEST/img/brand/green.png b/admin/public/img/brand/green.png similarity index 100% rename from admin/public_TEST/img/brand/green.png rename to admin/public/img/brand/green.png diff --git a/admin/public_TEST/img/elopage_favicon.png b/admin/public/img/elopage_favicon.png similarity index 100% rename from admin/public_TEST/img/elopage_favicon.png rename to admin/public/img/elopage_favicon.png diff --git a/admin/public_TEST/img/gdd-coin.png b/admin/public/img/gdd-coin.png similarity index 100% rename from admin/public_TEST/img/gdd-coin.png rename to admin/public/img/gdd-coin.png diff --git a/admin/public_TEST/index.html b/admin/public/index.html similarity index 100% rename from admin/public_TEST/index.html rename to admin/public/index.html From 1f98fa562147eaa5e84995ecd13d0480d4bd9dd4 Mon Sep 17 00:00:00 2001 From: mahula Date: Fri, 24 Feb 2023 13:39:08 +0100 Subject: [PATCH 055/181] test admin file filter with change to admin/src/components/ContributionMessages/slots/ContributionMessagesListItem.vue --- .../slots/ContributionMessagesListItem.vue | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/admin/src/components/ContributionMessages/slots/ContributionMessagesListItem.vue b/admin/src/components/ContributionMessages/slots/ContributionMessagesListItem.vue index 53006cff5..20cdfd5e6 100644 --- a/admin/src/components/ContributionMessages/slots/ContributionMessagesListItem.vue +++ b/admin/src/components/ContributionMessages/slots/ContributionMessagesListItem.vue @@ -1,15 +1,17 @@