fix: apply feedbacks

This commit is contained in:
yassinedorbozgithub
2025-01-10 15:16:27 +01:00
parent 542a02ac05
commit 008e6e43db
3 changed files with 15 additions and 15 deletions

View File

@@ -91,7 +91,7 @@ export class NlpSampleController extends BaseController<
);
const entities = await this.nlpEntityService.findAllAndPopulate();
const helper = await this.helperService.getDefaultNluHelper();
const result = await helper.format?.(samples, entities);
const result = await helper.format(samples, entities);
// Sending the JSON data as a file
const buffer = Buffer.from(JSON.stringify(result));
@@ -129,11 +129,6 @@ export class NlpSampleController extends BaseController<
): Promise<NlpSampleFull> {
const language = await this.languageService.getLanguageByCode(languageCode);
if (!language)
throw new NotFoundException(
`Language with code ${languageCode} not found`,
);
const nlpSample = await this.nlpSampleService.create({
...createNlpSampleDto,
language: language.id,
@@ -303,13 +298,6 @@ export class NlpSampleController extends BaseController<
): Promise<NlpSampleFull> {
const language = await this.languageService.getLanguageByCode(languageCode);
if (!language) {
this.logger.warn(`Unable to Language by languageCode ${languageCode}`);
throw new NotFoundException(
`Language with languageCode ${languageCode} not found`,
);
}
const sample = await this.nlpSampleService.updateOne(id, {
...sampleAttrs,
language: language.id,