-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…-query HPC-8663: add software info query
- Loading branch information
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
16 changes: 16 additions & 0 deletions
16
src/domain-services/software-info/software-info-service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
}, | ||
]; | ||
} | ||
} |