From 13a1903c634602d3d8308855de147fa49d5dac31 Mon Sep 17 00:00:00 2001 From: einhorn_b Date: Tue, 5 Sep 2023 19:46:14 +0200 Subject: [PATCH 1/3] make community switch looking similar to other inputs --- frontend/src/components/CommunitySwitch.vue | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/frontend/src/components/CommunitySwitch.vue b/frontend/src/components/CommunitySwitch.vue index dd4b159aa..cd18cee94 100644 --- a/frontend/src/components/CommunitySwitch.vue +++ b/frontend/src/components/CommunitySwitch.vue @@ -56,3 +56,23 @@ export default { }, } + From fa78961da33246305aea467fccdbab96b33220b5 Mon Sep 17 00:00:00 2001 From: Claus-Peter Huebner Date: Tue, 5 Sep 2023 21:19:38 +0200 Subject: [PATCH 2/3] add communities filter on community_uuid --- backend/src/graphql/resolver/CommunityResolver.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/src/graphql/resolver/CommunityResolver.ts b/backend/src/graphql/resolver/CommunityResolver.ts index 09553bf24..026871780 100644 --- a/backend/src/graphql/resolver/CommunityResolver.ts +++ b/backend/src/graphql/resolver/CommunityResolver.ts @@ -1,3 +1,4 @@ +import { IsNull, Not } from '@dbTools/typeorm' import { Community as DbCommunity } from '@entity/Community' import { FederatedCommunity as DbFederatedCommunity } from '@entity/FederatedCommunity' import { Resolver, Query, Authorized } from 'type-graphql' @@ -28,6 +29,7 @@ export class CommunityResolver { @Query(() => [Community]) async communities(): Promise { const dbCommunities: DbCommunity[] = await DbCommunity.find({ + where: { communityUuid: Not(IsNull()) }, //, authenticatedAt: Not(IsNull()) }, order: { name: 'ASC', }, From ab0d67e6a208f4a8f70607490e497b720ce06f02 Mon Sep 17 00:00:00 2001 From: Claus-Peter Huebner Date: Tue, 5 Sep 2023 21:26:46 +0200 Subject: [PATCH 3/3] modify test on filtered communities request --- backend/src/graphql/resolver/CommunityResolver.test.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/backend/src/graphql/resolver/CommunityResolver.test.ts b/backend/src/graphql/resolver/CommunityResolver.test.ts index 0ded14405..011670e87 100644 --- a/backend/src/graphql/resolver/CommunityResolver.test.ts +++ b/backend/src/graphql/resolver/CommunityResolver.test.ts @@ -294,7 +294,7 @@ describe('CommunityResolver', () => { }) }) - describe('with several community entries', () => { + describe('returns 2 filtered communities even with 3 existing entries', () => { beforeEach(async () => { await cleanDB() jest.clearAllMocks() @@ -316,8 +316,8 @@ describe('CommunityResolver', () => { foreignCom1.url = 'http://stage-2.gradido.net/api' foreignCom1.publicKey = Buffer.from('publicKey-stage-2_Community') foreignCom1.privateKey = Buffer.from('privateKey-stage-2_Community') - foreignCom1.communityUuid = 'Stage2-Com-UUID' - foreignCom1.authenticatedAt = new Date() + // foreignCom1.communityUuid = 'Stage2-Com-UUID' + // foreignCom1.authenticatedAt = new Date() foreignCom1.name = 'Stage-2_Community-name' foreignCom1.description = 'Stage-2_Community-description' foreignCom1.creationDate = new Date() @@ -336,7 +336,7 @@ describe('CommunityResolver', () => { await DbCommunity.insert(foreignCom2) }) - it('returns 3 community entries', async () => { + it('returns 2 community entries', async () => { await expect(query({ query: communities })).resolves.toMatchObject({ data: { communities: [ @@ -350,6 +350,7 @@ describe('CommunityResolver', () => { uuid: homeCom1.communityUuid, authenticatedAt: homeCom1.authenticatedAt?.toISOString(), }, + /* { id: expect.any(Number), foreign: foreignCom1.foreign, @@ -360,6 +361,7 @@ describe('CommunityResolver', () => { uuid: foreignCom1.communityUuid, authenticatedAt: foreignCom1.authenticatedAt?.toISOString(), }, + */ { id: expect.any(Number), foreign: foreignCom2.foreign,