diff --git a/src/domain-services/software-info/graphql/resolver.ts b/src/domain-services/software-info/graphql/resolver.ts new file mode 100644 index 00000000..409f46fa --- /dev/null +++ b/src/domain-services/software-info/graphql/resolver.ts @@ -0,0 +1,15 @@ +import SoftwareInfo from './types'; +import { Service } from 'typedi'; +import { Query, Resolver } from 'type-graphql'; +import { SoftwareInfoService } from '../software-info-service'; + +@Service() +@Resolver(SoftwareInfo) +export default class SoftwareInfoResolver { + constructor(private softwareInfoService: SoftwareInfoService) {} + + @Query(() => [SoftwareInfo]) + softwareInfo(): SoftwareInfo[] { + return this.softwareInfoService.getSoftwareInfo(); + } +} diff --git a/src/domain-services/software-info/graphql/types.ts b/src/domain-services/software-info/graphql/types.ts new file mode 100644 index 00000000..e22e9b45 --- /dev/null +++ b/src/domain-services/software-info/graphql/types.ts @@ -0,0 +1,13 @@ +import { Field, ObjectType } from 'type-graphql'; + +@ObjectType() +export default class SoftwareInfo { + @Field({ nullable: false }) + title: string; + + @Field({ nullable: false }) + status: string; + + @Field({ nullable: false }) + version: string; +} diff --git a/src/domain-services/software-info/software-info-service.ts b/src/domain-services/software-info/software-info-service.ts new file mode 100644 index 00000000..f6ce1ad0 --- /dev/null +++ b/src/domain-services/software-info/software-info-service.ts @@ -0,0 +1,16 @@ +import { Service } from 'typedi'; +import SoftwareInfo from './graphql/types'; +import { version } from '../../../package.json'; + +@Service() +export class SoftwareInfoService { + getSoftwareInfo(): SoftwareInfo[] { + return [ + { + title: 'HPC GraphQL API', + status: 'Stable', + version, + }, + ]; + } +}