gradido/core/src/logic/Community.logic.ts
2025-10-13 10:11:27 +02:00

13 lines
503 B
TypeScript

import { Community as DbCommunity, FederatedCommunity as DbFederatedCommunity } from 'database'
export class CommunityLogic {
public constructor(private self: DbCommunity) {}
public getFederatedCommunityWithApiOrFail(apiVersion: string): DbFederatedCommunity {
const fedCom = this.self.federatedCommunities?.find((fedCom) => fedCom.apiVersion === apiVersion)
if (!fedCom) {
throw new Error(`Missing federated community with api version ${apiVersion}`)
}
return fedCom
}
}