Community changes.

This commit is contained in:
elweyn 2021-10-05 10:19:11 +02:00
parent 06b7778f11
commit 6232810337
4 changed files with 50 additions and 45 deletions

View File

@ -14,4 +14,8 @@ DB_DATABASE=gradido_community
#KLICKTIPP_PASSWORD=
#KLICKTIPP_APIKEY_DE=
#KLICKTIPP_APIKEY_EN=
#KLICKTIPP=true
#KLICKTIPP=true
COMMUNITY_NAME=
COMMUNITY_URL=
COMMUNITY_REGISTER_URL=
COMMUNITY_DESCRIPTION=

View File

@ -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:

View File

@ -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)

View File

@ -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<Community[]> {
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<Community> {
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<Community> {
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<Community[]> {
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
}
}