Skip to content

Commit

Permalink
Merge pull request #205 from UN-OCHA/HPC-8663-create-software-version…
Browse files Browse the repository at this point in the history
…-query

HPC-8663: add software info query
  • Loading branch information
Pl217 authored Sep 11, 2023
2 parents f09c495 + 9678d81 commit 27e41fe
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/domain-services/software-info/graphql/resolver.ts
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();
}
}
13 changes: 13 additions & 0 deletions src/domain-services/software-info/graphql/types.ts
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 src/domain-services/software-info/software-info-service.ts
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,
},
];
}
}

0 comments on commit 27e41fe

Please sign in to comment.