mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
separate graphiql from graphql interface disabled api calls for user & group - we are not yet that far ignore .env, adjust .env.dist accordingly
24 lines
684 B
TypeScript
24 lines
684 B
TypeScript
import { Resolver, Query, Mutation, Arg } from 'type-graphql'
|
|
import { Group } from '../models/Group'
|
|
import { loginAPI, NetworkInfosResult } from '../../apis/loginAPI'
|
|
@Resolver()
|
|
export class GroupResolver {
|
|
@Query(() => [Group])
|
|
async groups(): Promise<Group[]> {
|
|
const result: NetworkInfosResult = await loginAPI.getNetworkInfos(['groups'])
|
|
const groups: Group[] = []
|
|
|
|
result.data.groups?.forEach((alias: string) => {
|
|
const group = new Group()
|
|
group.alias = alias
|
|
groups.push(group)
|
|
})
|
|
return groups
|
|
}
|
|
|
|
@Query(() => Group)
|
|
group(@Arg('id') id: string): Promise<Group | undefined> {
|
|
return Group.findOne({ where: { id } })
|
|
}
|
|
}
|