Skip to content
Snippets Groups Projects
Commit 1141a463 authored by stevereis's avatar stevereis
Browse files

Added schema definition for variable, group and domain

parent 2df83aaf
No related branches found
No related tags found
No related merge requests found
......@@ -2,13 +2,23 @@ import { Inject } from '@nestjs/common';
import { Query, Resolver } from '@nestjs/graphql';
import { ENGINE_SERVICE } from './engine.constants';
import { IEngineService } from './engine.interfaces';
import { Domain } from './models/domain.model';
@Resolver()
export class EngineResolver {
constructor(@Inject(ENGINE_SERVICE) private readonly engineService: IEngineService) { }
@Query(() => String)
@Query(() => Domain)
async hello() {
return this.engineService.demo();
let dummy : Domain = {
id: "test",
label: "test",
description: "test",
groups:[],
variables: [],
datasets: []
}
return dummy;
}
}
\ No newline at end of file
import { Field, ObjectType } from "@nestjs/graphql";
@ObjectType()
export class Category {
@Field()
id: string
@Field()
label: string;
}
\ No newline at end of file
import { Field, ObjectType } from "@nestjs/graphql";
import { Category } from "./category.model";
import { Group } from "./group.model";
@ObjectType()
export class Domain extends Group{
@Field(type => [Category])
datasets: Category[];
}
\ No newline at end of file
import { Field, ObjectType } from "@nestjs/graphql";
import { Variable } from "./variable.model";
@ObjectType()
export class Group {
@Field()
id: string;
@Field()
label: string;
@Field({ nullable: true})
description?: string;
@Field(type => [Group])
groups: Group[];
@Field(type => [Variable])
variables: Variable[];
}
\ No newline at end of file
import { Field, ObjectType } from "@nestjs/graphql";
import { Category } from "./category.model";
import { Group } from "./group.model";
@ObjectType()
export class Variable {
@Field()
id: string;
@Field({ nullable: true })
label?: string;
@Field()
type: string;
@Field({ nullable: true})
description?: string;
@Field(type => [Category])
categories: Category[];
@Field(type => Boolean)
isCategorical: boolean;
@Field(type => [Group])
groups: Group[];
}
\ No newline at end of file
......@@ -2,6 +2,38 @@
# THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY)
# ------------------------------------------------------
type Category {
id: String!
label: String!
}
type Variable {
id: String!
label: String
type: String!
description: String
categories: [Category!]!
isCategorical: Boolean!
groups: [Group!]!
}
type Group {
id: String!
label: String!
description: String
groups: [Group!]!
variables: [Variable!]!
}
type Domain {
id: String!
label: String!
description: String
groups: [Group!]!
variables: [Variable!]!
datasets: [Category!]!
}
type Query {
hello: String!
hello: Domain!
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment