diff --git a/backend/src/graphql/model/Community.ts b/backend/src/graphql/model/Community.ts index 3163b886d..e5ccad59b 100644 --- a/backend/src/graphql/model/Community.ts +++ b/backend/src/graphql/model/Community.ts @@ -12,7 +12,6 @@ export class Community { this.creationDate = dbCom.creationDate this.uuid = dbCom.communityUuid this.authenticatedAt = dbCom.authenticatedAt - // this.gmsApiKey = dbCom.gmsApiKey // this.hieroTopicId = dbCom.hieroTopicId } @@ -40,10 +39,6 @@ export class Community { @Field(() => Date, { nullable: true }) authenticatedAt: Date | null - // gms api key should only seen by admins, they can use AdminCommunityView - // @Field(() => String, { nullable: true }) - // gmsApiKey: string | null - @Field(() => String, { nullable: true }) hieroTopicId: string | null } diff --git a/backend/src/graphql/resolver/CommunityResolver.test.ts b/backend/src/graphql/resolver/CommunityResolver.test.ts index 5e7d929e2..c952baf1b 100644 --- a/backend/src/graphql/resolver/CommunityResolver.test.ts +++ b/backend/src/graphql/resolver/CommunityResolver.test.ts @@ -227,6 +227,14 @@ describe('CommunityResolver', () => { let foreignCom4: DbFederatedCommunity beforeEach(async () => { +<<<<<<< HEAD +======= + jest.clearAllMocks() + await userFactory(testEnv, peterLustig) + // login as admin + await mutate({ mutation: login, variables: peterLoginData }) + +>>>>>>> refactor_community_auth comHomeCom1 = DbCommunity.create() comHomeCom1.foreign = false comHomeCom1.url = 'http://localhost' diff --git a/backend/src/graphql/resolver/CommunityResolver.ts b/backend/src/graphql/resolver/CommunityResolver.ts index c3604812e..cd199900a 100644 --- a/backend/src/graphql/resolver/CommunityResolver.ts +++ b/backend/src/graphql/resolver/CommunityResolver.ts @@ -24,6 +24,24 @@ import { CONFIG } from '@/config' @Resolver() export class CommunityResolver { +<<<<<<< HEAD +======= + @Authorized([RIGHTS.COMMUNITIES]) + @Query(() => [FederatedCommunity]) + async getCommunities(): Promise { + const dbFederatedCommunities: DbFederatedCommunity[] = await DbFederatedCommunity.find({ + order: { + foreign: 'ASC', + createdAt: 'DESC', + lastAnnouncedAt: 'DESC', + }, + }) + return dbFederatedCommunities.map( + (dbCom: DbFederatedCommunity) => new FederatedCommunity(dbCom), + ) + } + +>>>>>>> refactor_community_auth @Authorized([RIGHTS.COMMUNITY_WITH_API_KEYS]) @Query(() => [AdminCommunityView]) async allCommunities(@Args() paginated: Paginated): Promise { @@ -95,7 +113,10 @@ export class CommunityResolver { } await DbCommunity.save(homeCom) } +<<<<<<< HEAD +======= +>>>>>>> refactor_community_auth return new AdminCommunityView(homeCom) } }