Added Formular and Field
This commit is contained in:
@@ -1,4 +1,26 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { FormularEntity } from './formular.entity';
|
||||
import { Repository } from 'typeorm';
|
||||
import { Formular, MyField } from 'src/dto/formular.dto';
|
||||
import { FieldEntity } from './fields.entity';
|
||||
|
||||
@Injectable()
|
||||
export class FormularService {}
|
||||
export class FormularService {
|
||||
constructor(
|
||||
@InjectRepository(FormularEntity)
|
||||
private readonly formularRepository: Repository<FormularEntity>,
|
||||
@InjectRepository(FieldEntity)
|
||||
private readonly fieldRepository: Repository<FieldEntity>
|
||||
){}
|
||||
|
||||
async getFormulare(): Promise<Formular[]>{
|
||||
return await this.formularRepository.find({relations: ['fields']});
|
||||
}
|
||||
async getFields(
|
||||
formularid:number
|
||||
): Promise<MyField[]>{
|
||||
return await this.fieldRepository.findBy({formular: formularid});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user