mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
22 lines
613 B
TypeScript
22 lines
613 B
TypeScript
import { Resolver, Query, Authorized } from 'type-graphql'
|
|
|
|
import { Community } from '@model/Community'
|
|
import { Community as DbCommunity } from '@entity/Community'
|
|
|
|
import { RIGHTS } from '@/auth/RIGHTS'
|
|
|
|
@Resolver()
|
|
export class CommunityResolver {
|
|
@Authorized([RIGHTS.COMMUNITIES])
|
|
@Query(() => [Community])
|
|
async getCommunities(): Promise<Community[]> {
|
|
const comList: Community[] = []
|
|
const dbCommunities: DbCommunity[] = await DbCommunity.find()
|
|
dbCommunities.forEach(async function (dbCom) {
|
|
const com = new Community(dbCom)
|
|
comList.push(com)
|
|
})
|
|
return comList
|
|
}
|
|
}
|