implement suggested changes

This commit is contained in:
einhornimmond 2024-02-15 23:29:22 +01:00
parent a665745284
commit b587a51ee8
6 changed files with 16 additions and 10 deletions

View File

@ -15,8 +15,8 @@
<b-row v-if="details" class="details">
<b-col colspan="5">
<b-list-group>
<b-list-group-item v-if="item.communityUuid">
{{ $t('federation.communityUuid') }}&nbsp;{{ item.communityUuid }}
<b-list-group-item v-if="item.uuid">
{{ $t('federation.communityUuid') }}&nbsp;{{ item.uuid }}
</b-list-group-item>
<b-list-group-item v-if="item.authenticatedAt">
{{ $t('federation.authenticatedAt') }}&nbsp;{{ item.authenticatedAt }}
@ -144,7 +144,7 @@ export default {
.mutate({
mutation: updateHomeCommunity,
variables: {
uuid: this.item.communityUuid,
uuid: this.item.uuid,
gmsApiKey: gmsApiKey,
},
})

View File

@ -6,7 +6,7 @@ export const allCommunities = gql`
foreign
url
publicKey
communityUuid
uuid
authenticatedAt
name
description

View File

@ -31,7 +31,6 @@ export class Community {
if (dbCom.publicKey && dbCom.publicKey.length === 32) {
this.publicKey = dbCom.publicKey.toString('hex')
}
this.communityUuid = dbCom.communityUuid
this.creationDate = dbCom.creationDate
this.createdAt = dbCom.createdAt
this.updatedAt = dbCom.updatedAt
@ -61,9 +60,6 @@ export class Community {
@Field(() => String)
publicKey: string
@Field(() => String, { nullable: true })
communityUuid: string | null
@Field(() => Date, { nullable: true })
creationDate: Date | null

View File

@ -165,6 +165,7 @@ describe('CommunityResolver', () => {
foreign: homeCom3.foreign,
publicKey: expect.stringMatching(ed25519KeyPairStaticHex[2].public),
endPoint: expect.stringMatching('http://localhost/api/'),
apiVersion: '2_0',
lastAnnouncedAt: null,
verifiedAt: null,
lastErrorAt: null,
@ -176,6 +177,7 @@ describe('CommunityResolver', () => {
foreign: homeCom2.foreign,
publicKey: expect.stringMatching(ed25519KeyPairStaticHex[1].public),
endPoint: expect.stringMatching('http://localhost/api/'),
apiVersion: '1_1',
lastAnnouncedAt: null,
verifiedAt: null,
lastErrorAt: null,
@ -187,6 +189,7 @@ describe('CommunityResolver', () => {
foreign: homeCom1.foreign,
publicKey: expect.stringMatching(ed25519KeyPairStaticHex[0].public),
endPoint: expect.stringMatching('http://localhost/api/'),
apiVersion: '1_0',
lastAnnouncedAt: null,
verifiedAt: null,
lastErrorAt: null,
@ -222,7 +225,7 @@ describe('CommunityResolver', () => {
foreignCom3 = DbFederatedCommunity.create()
foreignCom3.foreign = true
foreignCom3.publicKey = Buffer.from(ed25519KeyPairStaticHex[5].public, 'hex')
foreignCom3.apiVersion = '1_2'
foreignCom3.apiVersion = '2_0'
foreignCom3.endPoint = 'http://remotehost/api'
foreignCom3.createdAt = new Date()
await DbFederatedCommunity.insert(foreignCom3)
@ -237,6 +240,7 @@ describe('CommunityResolver', () => {
foreign: homeCom3.foreign,
publicKey: expect.stringMatching(ed25519KeyPairStaticHex[2].public),
endPoint: expect.stringMatching('http://localhost/api/'),
apiVersion: '2_0',
lastAnnouncedAt: null,
verifiedAt: null,
lastErrorAt: null,
@ -248,6 +252,7 @@ describe('CommunityResolver', () => {
foreign: homeCom2.foreign,
publicKey: expect.stringMatching(ed25519KeyPairStaticHex[1].public),
endPoint: expect.stringMatching('http://localhost/api/'),
apiVersion: '1_1',
lastAnnouncedAt: null,
verifiedAt: null,
lastErrorAt: null,
@ -259,6 +264,7 @@ describe('CommunityResolver', () => {
foreign: homeCom1.foreign,
publicKey: expect.stringMatching(ed25519KeyPairStaticHex[0].public),
endPoint: expect.stringMatching('http://localhost/api/'),
apiVersion: '1_0',
lastAnnouncedAt: null,
verifiedAt: null,
lastErrorAt: null,
@ -270,6 +276,7 @@ describe('CommunityResolver', () => {
foreign: foreignCom3.foreign,
publicKey: expect.stringMatching(ed25519KeyPairStaticHex[5].public),
endPoint: expect.stringMatching('http://remotehost/api/'),
apiVersion: '2_0',
lastAnnouncedAt: null,
verifiedAt: null,
lastErrorAt: null,
@ -281,6 +288,7 @@ describe('CommunityResolver', () => {
foreign: foreignCom2.foreign,
publicKey: expect.stringMatching(ed25519KeyPairStaticHex[4].public),
endPoint: expect.stringMatching('http://remotehost/api/'),
apiVersion: '1_1',
lastAnnouncedAt: null,
verifiedAt: null,
lastErrorAt: null,
@ -292,6 +300,7 @@ describe('CommunityResolver', () => {
foreign: foreignCom1.foreign,
publicKey: expect.stringMatching(ed25519KeyPairStaticHex[3].public),
endPoint: expect.stringMatching('http://remotehost/api/'),
apiVersion: '1_0',
lastAnnouncedAt: null,
verifiedAt: null,
lastErrorAt: null,

View File

@ -157,6 +157,7 @@ export const getCommunities = gql`
foreign
publicKey
endPoint
apiVersion
lastAnnouncedAt
verifiedAt
lastErrorAt

View File

@ -52,7 +52,7 @@ export class FederatedCommunity extends BaseEntity {
})
updatedAt: Date | null
@ManyToOne(() => Community, (community) => community.federatedCommunities) // Assuming you have a User entity with 'accounts' relation
@ManyToOne(() => Community, (community) => community.federatedCommunities)
@JoinColumn({ name: 'public_key', referencedColumnName: 'publicKey' })
community?: Community
}