+
+
+
+
+
+ {{ $t('edit') }}
+
+
+
+
+ {{ $t('save') }}
+
+
+ {{ $t('close') }}
+
+
+
+
+
+
diff --git a/admin/src/graphql/allCommunities.js b/admin/src/graphql/allCommunities.js
index 6379086c7..c2ccdd15e 100644
--- a/admin/src/graphql/allCommunities.js
+++ b/admin/src/graphql/allCommunities.js
@@ -11,6 +11,7 @@ export const allCommunities = gql`
name
description
gmsApiKey
+ location
creationDate
createdAt
updatedAt
diff --git a/admin/src/graphql/updateHomeCommunity.js b/admin/src/graphql/updateHomeCommunity.js
index a43d6edd2..a33e7164c 100644
--- a/admin/src/graphql/updateHomeCommunity.js
+++ b/admin/src/graphql/updateHomeCommunity.js
@@ -1,8 +1,8 @@
import gql from 'graphql-tag'
export const updateHomeCommunity = gql`
- mutation ($uuid: String!, $gmsApiKey: String!) {
- updateHomeCommunity(uuid: $uuid, gmsApiKey: $gmsApiKey) {
+ mutation ($uuid: String!, $gmsApiKey: String!, $location: Point!) {
+ updateHomeCommunity(uuid: $uuid, gmsApiKey: $gmsApiKey, location: $location) {
id
}
}
diff --git a/admin/src/locales/de.json b/admin/src/locales/de.json
index 9f808f70c..aa8f51983 100644
--- a/admin/src/locales/de.json
+++ b/admin/src/locales/de.json
@@ -1,14 +1,15 @@
{
"GDD": "GDD",
"all_emails": "Alle Nutzer",
+ "edit": "bearbeiten",
"back": "zurück",
"change_user_role": "Nutzerrolle ändern",
"chat": "Chat",
+ "close": "Schließen",
"contributionLink": {
"amount": "Betrag",
"changeSaved": "Änderungen gespeichert",
"clear": "Löschen",
- "close": "Schließen",
"contributionLinks": "Beitragslinks",
"create": "Anlegen",
"cycle": "Zyklus",
@@ -76,6 +77,7 @@
"apiVersion": "API Version",
"authenticatedAt": "Verifiziert am:",
"communityUuid": "Community UUID:",
+ "coordinates": "Koordinaten:",
"createdAt": "Erstellt am",
"gmsApiKey": "GMS API Key:",
"toast_gmsApiKeyUpdated": "Der GMS Api Key wurde erfolgreich aktualisiert!",
@@ -100,6 +102,13 @@
"form": {
"cancel": "Abbrechen"
},
+ "geo-coordinates": {
+ "both-or-none": "Bitte beide oder keine eingeben!",
+ "label": "Geo-Koordinaten",
+ "latitude": {
+ "describe": "Teilt Koordinaten im Format 'Längengrad, Breitengrad' automatisch in separate Eingabefelder auf. Fügen sie hier einfach z.B. ihre Koordinaten von Google Maps, zum Beispiel: 49.28187664243721, 9.740672183943639, ein."
+ }
+ },
"help": {
"help": "Hilfe",
"transactionlist": {
@@ -113,6 +122,8 @@
"hide_resubmission": "Wiedervorlage verbergen",
"hide_resubmission_tooltip": "Verbirgt alle Schöpfungen für die ein Moderator ein Erinnerungsdatum festgelegt hat.",
"lastname": "Nachname",
+ "latitude": "Breitengrad:",
+ "longitude": "Längengrad:",
"math": {
"equals": "=",
"pipe": "|",
diff --git a/admin/src/locales/en.json b/admin/src/locales/en.json
index b1f020921..258abe891 100644
--- a/admin/src/locales/en.json
+++ b/admin/src/locales/en.json
@@ -1,14 +1,15 @@
{
"GDD": "GDD",
"all_emails": "All users",
+ "edit": "edit",
"back": "back",
"change_user_role": "Change user role",
"chat": "Chat",
+ "close": "Close",
"contributionLink": {
"amount": "Amount",
"changeSaved": "Changes saved",
"clear": "Clear",
- "close": "Close",
"contributionLinks": "Contribution Links",
"create": "Create",
"cycle": "Cycle",
@@ -76,6 +77,7 @@
"apiVersion": "API Version",
"authenticatedAt": "verified at:",
"communityUuid": "Community UUID:",
+ "coordinates": "Coordinates:",
"createdAt": "Created At ",
"gmsApiKey": "GMS API Key:",
"toast_gmsApiKeyUpdated": "The GMS Api Key has been successfully updated!",
@@ -100,6 +102,13 @@
"form": {
"cancel": "Cancel"
},
+ "geo-coordinates": {
+ "both-or-none": "Please enter both or none!",
+ "label": "geo-coordinates",
+ "latitude": {
+ "describe": "Automatically splits coordinates in the format 'longitude, latitude' into separate input fields. Simply enter your coordinates from Google Maps here, for example: 49.28187664243721, 9.740672183943639."
+ }
+ },
"help": {
"help": "Help",
"transactionlist": {
@@ -113,6 +122,8 @@
"hide_resubmission": "Hide resubmission",
"hide_resubmission_tooltip": "Hides all creations for which a moderator has set a reminder date.",
"lastname": "Lastname",
+ "latitude": "Breitengrad:",
+ "longitude": "Längengrad:",
"math": {
"equals": "=",
"pipe": "|",
diff --git a/backend/package.json b/backend/package.json
index 7fcd21000..7c6128a81 100644
--- a/backend/package.json
+++ b/backend/package.json
@@ -33,9 +33,11 @@
"email-templates": "^10.0.1",
"express": "^4.17.1",
"express-slow-down": "^2.0.1",
+ "geojson": "^0.5.0",
"gradido-database": "file:../database",
"graphql": "^15.5.1",
"graphql-request": "5.0.0",
+ "graphql-type-json": "0.3.2",
"helmet": "^5.1.1",
"i18n": "^0.15.1",
"jose": "^4.14.4",
@@ -56,6 +58,7 @@
"@types/email-templates": "^10.0.1",
"@types/express": "^4.17.12",
"@types/faker": "^5.5.9",
+ "@types/geojson": "^7946.0.13",
"@types/i18n": "^0.13.4",
"@types/jest": "^27.0.2",
"@types/lodash.clonedeep": "^4.5.6",
diff --git a/backend/src/config/index.ts b/backend/src/config/index.ts
index 82308a52b..d75730c8e 100644
--- a/backend/src/config/index.ts
+++ b/backend/src/config/index.ts
@@ -12,7 +12,7 @@ Decimal.set({
})
const constants = {
- DB_VERSION: '0084-introduce_humhub_registration',
+ DB_VERSION: '0085-add_community_location',
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/graphql/input/EditCommunityInput.ts b/backend/src/graphql/input/EditCommunityInput.ts
index 8c74f874b..b1bfc20fb 100644
--- a/backend/src/graphql/input/EditCommunityInput.ts
+++ b/backend/src/graphql/input/EditCommunityInput.ts
@@ -1,6 +1,9 @@
import { IsString, IsUUID } from 'class-validator'
import { ArgsType, Field, InputType } from 'type-graphql'
+import { Point } from '@/graphql/model/Point'
+import { isValidPoint } from '@/graphql/validator/Point'
+
@ArgsType()
@InputType()
export class EditCommunityInput {
@@ -11,4 +14,8 @@ export class EditCommunityInput {
@Field(() => String)
@IsString()
gmsApiKey: string
+
+ @Field(() => Point)
+ @isValidPoint()
+ location: Point
}
diff --git a/backend/src/graphql/model/AdminCommunityView.ts b/backend/src/graphql/model/AdminCommunityView.ts
index 95af54bc5..c92a41b90 100644
--- a/backend/src/graphql/model/AdminCommunityView.ts
+++ b/backend/src/graphql/model/AdminCommunityView.ts
@@ -3,6 +3,7 @@ import { FederatedCommunity as DbFederatedCommunity } from '@entity/FederatedCom
import { ObjectType, Field } from 'type-graphql'
import { FederatedCommunity } from './FederatedCommunity'
+import { Point } from './Point'
@ObjectType()
export class AdminCommunityView {
@@ -36,6 +37,7 @@ export class AdminCommunityView {
this.uuid = dbCom.communityUuid
this.authenticatedAt = dbCom.authenticatedAt
this.gmsApiKey = dbCom.gmsApiKey
+ this.location = dbCom.location ? dbCom.location as Point : new Point()
}
@Field(() => Boolean)
@@ -62,6 +64,9 @@ export class AdminCommunityView {
@Field(() => String, { nullable: true })
gmsApiKey: string | null
+ @Field(() => Point)
+ location: Point
+
@Field(() => Date, { nullable: true })
creationDate: Date | null
diff --git a/backend/src/graphql/model/Point.ts b/backend/src/graphql/model/Point.ts
new file mode 100644
index 000000000..bddb50598
--- /dev/null
+++ b/backend/src/graphql/model/Point.ts
@@ -0,0 +1,10 @@
+import { Position, Point as geojsonPoint } from 'geojson'
+
+export class Point implements geojsonPoint {
+ constructor() {
+ this.coordinates = []
+ this.type = 'Point'
+ }
+ type: 'Point'
+ coordinates: Position
+}
diff --git a/backend/src/graphql/resolver/CommunityResolver.ts b/backend/src/graphql/resolver/CommunityResolver.ts
index 2d2323865..0dc844b5c 100644
--- a/backend/src/graphql/resolver/CommunityResolver.ts
+++ b/backend/src/graphql/resolver/CommunityResolver.ts
@@ -78,7 +78,9 @@ export class CommunityResolver {
@Authorized([RIGHTS.COMMUNITY_UPDATE])
@Mutation(() => Community)
- async updateHomeCommunity(@Args() { uuid, gmsApiKey }: EditCommunityInput): Promise