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