diff --git a/admin/src/components/Federation/CommunityVisualizeItem.vue b/admin/src/components/Federation/CommunityVisualizeItem.vue index ecb4b79a0..72801426d 100644 --- a/admin/src/components/Federation/CommunityVisualizeItem.vue +++ b/admin/src/components/Federation/CommunityVisualizeItem.vue @@ -28,6 +28,9 @@ {{ $t('federation.publicKey') }} {{ item.publicKey }} + + {{ $t('federation.hieroTopicId') }} {{ item.hieroTopicId }} + {{ $t('federation.gmsApiKey') }} 

{{ gmsApiKey }} +
+

{{ $t('federation.hieroTopicId') }} 

+ {{ hieroTopicId }} +
{{ $t('federation.coordinates') }} @@ -57,6 +64,11 @@ :label="$t('federation.gmsApiKey')" id-name="home-community-api-key" /> +
@@ -111,9 +123,11 @@ const { toastSuccess, toastError } = useAppToast() const details = ref(false) const gmsApiKey = ref(item.value.gmsApiKey) +const hieroTopicId = ref(item.value.hieroTopicId) const location = ref(item.value.location) const originalGmsApiKey = ref(item.value.gmsApiKey) const originalLocation = ref(item.value.location) +const originalHieroTopicId = ref(item.value.hieroTopicId) const { mutate: updateHomeCommunityMutation } = useMutation(updateHomeCommunity) @@ -164,6 +178,7 @@ const createdAt = computed(() => { const isLocationChanged = computed(() => originalLocation.value !== location.value) const isGMSApiKeyChanged = computed(() => originalGmsApiKey.value !== gmsApiKey.value) +const isHieroTopicIdChanged = computed(() => originalHieroTopicId.value !== hieroTopicId.value) const isValidLocation = computed( () => location.value && location.value.latitude && location.value.longitude, ) @@ -178,6 +193,7 @@ const handleUpdateHomeCommunity = async () => { uuid: item.value.uuid, gmsApiKey: gmsApiKey.value, location: location.value, + hieroTopicId: hieroTopicId.value, }) if (isLocationChanged.value && isGMSApiKeyChanged.value) { @@ -187,8 +203,12 @@ const handleUpdateHomeCommunity = async () => { } else if (isLocationChanged.value) { toastSuccess(t('federation.toast_gmsLocationUpdated')) } + if (isHieroTopicIdChanged.value) { + toastSuccess(t('federation.toast_hieroTopicIdUpdated')) + } originalLocation.value = location.value originalGmsApiKey.value = gmsApiKey.value + originalHieroTopicId.value = hieroTopicId.value } catch (error) { toastError(error.message) } @@ -197,5 +217,6 @@ const handleUpdateHomeCommunity = async () => { const resetHomeCommunityEditable = () => { location.value = originalLocation.value gmsApiKey.value = originalGmsApiKey.value + hieroTopicId.value = originalHieroTopicId.value } diff --git a/admin/src/graphql/allCommunities.js b/admin/src/graphql/allCommunities.js index c2ccdd15e..5e320dd75 100644 --- a/admin/src/graphql/allCommunities.js +++ b/admin/src/graphql/allCommunities.js @@ -15,6 +15,7 @@ export const allCommunities = gql` creationDate createdAt updatedAt + hieroTopicId federatedCommunities { id apiVersion diff --git a/admin/src/graphql/updateHomeCommunity.js b/admin/src/graphql/updateHomeCommunity.js index a05cb7fd8..19bfb7396 100644 --- a/admin/src/graphql/updateHomeCommunity.js +++ b/admin/src/graphql/updateHomeCommunity.js @@ -1,8 +1,13 @@ import gql from 'graphql-tag' export const updateHomeCommunity = gql` - mutation ($uuid: String!, $gmsApiKey: String, $location: Location) { - updateHomeCommunity(uuid: $uuid, gmsApiKey: $gmsApiKey, location: $location) { + mutation ($uuid: String!, $gmsApiKey: String, $location: Location, $hieroTopicId: String) { + updateHomeCommunity( + uuid: $uuid + gmsApiKey: $gmsApiKey + location: $location + hieroTopicId: $hieroTopicId + ) { id } } diff --git a/admin/src/locales/de.json b/admin/src/locales/de.json index 51e7c351b..d1622fb8d 100644 --- a/admin/src/locales/de.json +++ b/admin/src/locales/de.json @@ -96,9 +96,11 @@ "coordinates": "Koordinaten:", "createdAt": "Erstellt am", "gmsApiKey": "GMS API Key:", + "hieroTopicId": "Hiero Topic ID:", "toast_gmsApiKeyAndLocationUpdated": "Der GMS Api Key und die Location wurden erfolgreich aktualisiert!", "toast_gmsApiKeyUpdated": "Der GMS Api Key wurde erfolgreich aktualisiert!", "toast_gmsLocationUpdated": "Die GMS Location wurde erfolgreich aktualisiert!", + "toast_hieroTopicIdUpdated": "Die Hiero Topic ID wurde erfolgreich aktualisiert!", "gradidoInstances": "Gradido Instanzen", "lastAnnouncedAt": "letzte Bekanntgabe", "lastErrorAt": "Letzer Fehler am", diff --git a/admin/src/locales/en.json b/admin/src/locales/en.json index 070c2fc20..6119ffc41 100644 --- a/admin/src/locales/en.json +++ b/admin/src/locales/en.json @@ -96,9 +96,11 @@ "coordinates": "Coordinates:", "createdAt": "Created At ", "gmsApiKey": "GMS API Key:", + "hieroTopicId": "Hiero Topic ID:", "toast_gmsApiKeyAndLocationUpdated": "The GMS Api Key and the location have been successfully updated!", "toast_gmsApiKeyUpdated": "The GMS Api Key has been successfully updated!", "toast_gmsLocationUpdated": "The GMS location has been successfully updated!", + "toast_hieroTopicIdUpdated": "The Hiero Topic ID has been successfully updated!", "gradidoInstances": "Gradido Instances", "lastAnnouncedAt": "Last Announced", "lastErrorAt": "last error at", diff --git a/backend/src/graphql/input/EditCommunityInput.ts b/backend/src/graphql/input/EditCommunityInput.ts index 487221920..f81425aae 100644 --- a/backend/src/graphql/input/EditCommunityInput.ts +++ b/backend/src/graphql/input/EditCommunityInput.ts @@ -18,4 +18,8 @@ export class EditCommunityInput { @Field(() => Location, { nullable: true }) @isValidLocation() location?: Location | null + + @Field(() => String, { nullable: true }) + @IsString() + hieroTopicId?: string | null } diff --git a/backend/src/graphql/model/AdminCommunityView.ts b/backend/src/graphql/model/AdminCommunityView.ts index aac50e0ed..50cee146a 100644 --- a/backend/src/graphql/model/AdminCommunityView.ts +++ b/backend/src/graphql/model/AdminCommunityView.ts @@ -39,6 +39,7 @@ export class AdminCommunityView { this.uuid = dbCom.communityUuid this.authenticatedAt = dbCom.authenticatedAt this.gmsApiKey = dbCom.gmsApiKey + this.hieroTopicId = dbCom.hieroTopicId if (dbCom.location) { this.location = Point2Location(dbCom.location as Point) } @@ -71,6 +72,9 @@ export class AdminCommunityView { @Field(() => Location, { nullable: true }) location: Location | null + @Field(() => String, { nullable: true }) + hieroTopicId: string | null + @Field(() => Date, { nullable: true }) creationDate: Date | null diff --git a/backend/src/graphql/model/Community.ts b/backend/src/graphql/model/Community.ts index 22dd915ad..62cec9cf7 100644 --- a/backend/src/graphql/model/Community.ts +++ b/backend/src/graphql/model/Community.ts @@ -13,6 +13,7 @@ export class Community { this.uuid = dbCom.communityUuid this.authenticatedAt = dbCom.authenticatedAt this.gmsApiKey = dbCom.gmsApiKey + this.hieroTopicId = dbCom.hieroTopicId } @Field(() => Int) @@ -41,4 +42,7 @@ export class Community { @Field(() => String, { nullable: true }) gmsApiKey: string | null + + @Field(() => String, { nullable: true }) + hieroTopicId: string | null } diff --git a/backend/src/graphql/resolver/CommunityResolver.ts b/backend/src/graphql/resolver/CommunityResolver.ts index 16130f5d4..a46e30144 100644 --- a/backend/src/graphql/resolver/CommunityResolver.ts +++ b/backend/src/graphql/resolver/CommunityResolver.ts @@ -80,7 +80,7 @@ export class CommunityResolver { @Authorized([RIGHTS.COMMUNITY_UPDATE]) @Mutation(() => Community) async updateHomeCommunity( - @Args() { uuid, gmsApiKey, location }: EditCommunityInput, + @Args() { uuid, gmsApiKey, location, hieroTopicId }: EditCommunityInput, ): Promise { const homeCom = await getCommunityByUuid(uuid) if (!homeCom) { @@ -89,11 +89,16 @@ export class CommunityResolver { if (homeCom.foreign) { throw new LogError('Error: Only the HomeCommunity could be modified!') } - if (homeCom.gmsApiKey !== gmsApiKey || homeCom.location !== location) { + if ( + homeCom.gmsApiKey !== gmsApiKey || + homeCom.location !== location || + homeCom.hieroTopicId !== hieroTopicId + ) { homeCom.gmsApiKey = gmsApiKey ?? null if (location) { homeCom.location = Location2Point(location) } + homeCom.hieroTopicId = hieroTopicId ?? null await DbCommunity.save(homeCom) } return new Community(homeCom) diff --git a/config-schema/src/commonSchema.ts b/config-schema/src/commonSchema.ts index 12946fdae..250ea3182 100644 --- a/config-schema/src/commonSchema.ts +++ b/config-schema/src/commonSchema.ts @@ -92,7 +92,7 @@ export const GMS_ACTIVE = Joi.boolean() .required() export const GDT_ACTIVE = Joi.boolean() - .description('Flag to indicate if the GMS (Geographic Member Search) service is used.') + .description('Flag to indicate if the GDT (Gradido Transform) service is used.') .default(false) .required() diff --git a/database/migration/migrations/0092-add_hiero-topic-id_in_community_table.ts b/database/migration/migrations/0092-add_hiero-topic-id_in_community_table.ts new file mode 100644 index 000000000..d921bdd5e --- /dev/null +++ b/database/migration/migrations/0092-add_hiero-topic-id_in_community_table.ts @@ -0,0 +1,14 @@ +/* MIGRATION TO ADD hiero topic id IN COMMUNITY TABLE + * + * This migration adds fields for the hiero topic id in the community.table + */ + +export async function upgrade(queryFn: (query: string, values?: any[]) => Promise>) { + await queryFn( + 'ALTER TABLE `communities` ADD COLUMN `hiero_topic_id` varchar(512) DEFAULT NULL AFTER `location`;', + ) +} + +export async function downgrade(queryFn: (query: string, values?: any[]) => Promise>) { + await queryFn('ALTER TABLE `communities` DROP COLUMN `hiero_topic_id`;') +} diff --git a/database/src/entity/Community.ts b/database/src/entity/Community.ts index bee4d5fa8..f6597306a 100644 --- a/database/src/entity/Community.ts +++ b/database/src/entity/Community.ts @@ -73,6 +73,9 @@ export class Community extends BaseEntity { }) location: Geometry | null + @Column({ name: 'hiero_topic_id', type: 'varchar', length: 255, nullable: true }) + hieroTopicId: string | null + @CreateDateColumn({ name: 'created_at', type: 'datetime',