Added Formular and Field
This commit is contained in:
@@ -1,6 +1,30 @@
|
||||
import { Controller } from '@nestjs/common';
|
||||
import { Controller, Get, Inject, Param } from '@nestjs/common';
|
||||
import { FormularService } from './formular.service';
|
||||
import { Query } from '@nestjs/graphql';
|
||||
import { Formular, MyField } from 'src/dto/formular.dto';
|
||||
import { FormularEntity } from './formular.entity';
|
||||
import { FieldEntity } from './fields.entity';
|
||||
|
||||
@Controller('/api/formulare')
|
||||
export class FormularController {
|
||||
constructor(
|
||||
@Inject()
|
||||
private readonly formularService: FormularService
|
||||
){}
|
||||
|
||||
@Get("/")
|
||||
@Query(()=>[FormularEntity])
|
||||
async formulare(): Promise<Formular[]>{
|
||||
return await this.formularService.getFormulare();
|
||||
}
|
||||
|
||||
@Get("/:formularid")
|
||||
@Query(()=>[FieldEntity])
|
||||
async fields(
|
||||
@Param("formularid")
|
||||
formularid:number
|
||||
): Promise<MyField[]>{
|
||||
return await this.formularService.getFields(formularid);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user