mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
13 lines
503 B
TypeScript
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
|
|
}
|
|
} |