diff --git a/backend/.env.dist b/backend/.env.dist index 150269632..3ac50ac9b 100644 --- a/backend/.env.dist +++ b/backend/.env.dist @@ -14,4 +14,8 @@ DB_DATABASE=gradido_community #KLICKTIPP_PASSWORD= #KLICKTIPP_APIKEY_DE= #KLICKTIPP_APIKEY_EN= -#KLICKTIPP=true \ No newline at end of file +#KLICKTIPP=true +COMMUNITY_NAME= +COMMUNITY_URL= +COMMUNITY_REGISTER_URL= +COMMUNITY_DESCRIPTION= \ No newline at end of file diff --git a/backend/src/config/index.ts b/backend/src/config/index.ts index 424d90185..a580c7d4b 100644 --- a/backend/src/config/index.ts +++ b/backend/src/config/index.ts @@ -32,7 +32,7 @@ const klicktipp = { const community = { COMMUNITY_NAME: process.env.COMMUNITY_NAME || 'Gradido Entwicklung', - COMMUNITY_URL: process.env.COMMUNITY_URL || 'http://localhost:3000/vue/', + COMMUNITY_URL: process.env.COMMUNITY_URL || 'https://gradido.net/', COMMUNITY_REGISTER_URL: process.env.COMMUNITY_REGISTER_URL || 'http://localhost:3000/vue/register', COMMUNITY_DESCRIPTION: diff --git a/backend/src/graphql/model/Community.ts b/backend/src/graphql/model/Community.ts index 2dd41fad6..466028d00 100644 --- a/backend/src/graphql/model/Community.ts +++ b/backend/src/graphql/model/Community.ts @@ -4,12 +4,14 @@ import { ObjectType, Field } from 'type-graphql' @ObjectType() export class Community { - constructor(json: any) { - this.id = Number(json.id) - this.name = json.name - this.url = json.url - this.description = json.description - this.registerUrl = json.registerUrl + constructor(json?: any) { + if (json) { + this.id = Number(json.id) + this.name = json.name + this.url = json.url + this.description = json.description + this.registerUrl = json.registerUrl + } } @Field(() => Number) diff --git a/backend/src/graphql/resolver/CommunityResolver.ts b/backend/src/graphql/resolver/CommunityResolver.ts index 97bfecfa6..60eae87d5 100644 --- a/backend/src/graphql/resolver/CommunityResolver.ts +++ b/backend/src/graphql/resolver/CommunityResolver.ts @@ -3,48 +3,47 @@ import { Resolver, Query } from 'type-graphql' import CONFIG from '../../config' -import { Community } from '../models/Community' +import { Community } from '../model/Community' @Resolver() export class CommunityResolver { - @Query(() => [Community]) - async communities(): Promise { - const communities = [ - { - id: 1, - name: 'Gradido Entwicklung', - url: 'http://localhost:3000/vue/', - description: 'Die lokale Entwicklungsumgebung von Gradido.', - registerUrl: 'http://localhost:3000/vue/register', - }, - { - id: 2, - name: 'Gradido Staging', - url: 'https://stage1.gradido.net/vue/', - description: 'Der Testserver der Gradido Akademie.', - registerUrl: 'https://stage1.gradido.net/vue/register', - }, - { - id: 3, - name: 'Gradido-Akademie', - url: 'https://gdd1.gradido.com/vue/', - description: 'Freies Institut für Wirtschaftsbionik.', - registerUrl: 'https://gdd1.gradido.com/vue/register', - }, - ] - return communities.map((el: any) => { - return new Community(el) + @Query(() => Community) + async getCommunityInfo(): Promise { + return new Community({ + name: CONFIG.COMMUNITY_NAME, + description: CONFIG.COMMUNITY_DESCRIPTION, + url: CONFIG.COMMUNITY_URL, + registerUrl: CONFIG.COMMUNITY_REGISTER_URL, }) } - @Query(() => Community) - async serverInformation(): Promise { - const community = { - name: CONFIG.COMMUNITY_NAME, - url: CONFIG.COMMUNITY_URL, - description: CONFIG.COMMUNITY_DESCRIPTION, - registerUrl: CONFIG.COMMUNITY_REGISTER_URL, - } - return new Community(community) + @Query(() => [Community]) + async communities(): Promise { + const communities: Community[] = [] + + communities.push( + new Community({ + id: 1, + name: 'Gradido Entwicklung', + description: 'Die lokale Entwicklungsumgebung von Gradido.', + url: 'http://localhost:3000/vue/', + registerUrl: 'http://localhost:3000/vue/register-community', + }), + new Community({ + id: 2, + name: 'Gradido Staging', + description: 'Der Testserver der Gradido Akademie.', + url: 'https://stage1.gradido.net/vue/', + registerUrl: 'https://stage1.gradido.net/vue/register-community', + }), + new Community({ + id: 3, + name: 'Gradido-Akademie', + description: 'Freies Institut für Wirtschaftsbionik.', + url: 'https://gradido.net/', + registerUrl: 'https://gdd1.gradido.com/vue/register-community', + }), + ) + return communities } }