mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
Apply suggestions from code review
Co-authored-by: Tomi Turtiainen <10324676+tomi@users.noreply.github.com>
This commit is contained in:
parent
eee51ebe92
commit
66c189ea00
|
@ -10,7 +10,7 @@ import { TestDefinitionsRequest } from './test-definitions.types.ee';
|
||||||
|
|
||||||
@RestController('/evaluation/test-definitions')
|
@RestController('/evaluation/test-definitions')
|
||||||
export class TestDefinitionsController {
|
export class TestDefinitionsController {
|
||||||
constructor(private readonly testsService: TestDefinitionsService) {}
|
constructor(private readonly testDefinitionsService: TestDefinitionsService) {}
|
||||||
|
|
||||||
@Get('/', { middlewares: listQueryMiddleware })
|
@Get('/', { middlewares: listQueryMiddleware })
|
||||||
async getMany(req: TestDefinitionsRequest.GetMany) {
|
async getMany(req: TestDefinitionsRequest.GetMany) {
|
||||||
|
@ -29,7 +29,7 @@ export class TestDefinitionsController {
|
||||||
|
|
||||||
const testDefinition = await this.testsService.findOne(Number(req.params.id), workflowIds);
|
const testDefinition = await this.testsService.findOne(Number(req.params.id), workflowIds);
|
||||||
|
|
||||||
if (!testDefinition) throw new NotFoundError('Test not found');
|
if (!testDefinition) throw new NotFoundError('Test definition not found');
|
||||||
|
|
||||||
return testDefinition;
|
return testDefinition;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ export class TestDefinitionsController {
|
||||||
|
|
||||||
const workflowIds = await getSharedWorkflowIds(req.user, ['workflow:read']);
|
const workflowIds = await getSharedWorkflowIds(req.user, ['workflow:read']);
|
||||||
|
|
||||||
if (workflowIds.length === 0) throw new NotFoundError('Test not found');
|
if (workflowIds.length === 0) throw new NotFoundError('Test definition not found');
|
||||||
|
|
||||||
await this.testsService.delete(Number(req.params.id), workflowIds);
|
await this.testsService.delete(Number(req.params.id), workflowIds);
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ type TestDefinitionLike = Omit<
|
||||||
@Service()
|
@Service()
|
||||||
export class TestDefinitionsService {
|
export class TestDefinitionsService {
|
||||||
constructor(
|
constructor(
|
||||||
private testRepository: TestDefinitionRepository,
|
private testDefinitionRepository: TestDefinitionRepository,
|
||||||
private annotationTagRepository: AnnotationTagRepository,
|
private annotationTagRepository: AnnotationTagRepository,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue