wip: Rebase after renaming DB entity

This commit is contained in:
Eugene Molodkin 2024-11-06 12:28:00 +01:00
parent 7718cdac73
commit 9be4e50b9a
No known key found for this signature in database
2 changed files with 6 additions and 6 deletions

View file

@ -2,26 +2,26 @@ import type { FindManyOptions, FindOptionsWhere } from '@n8n/typeorm';
import { DataSource, In, Repository } from '@n8n/typeorm'; import { DataSource, In, Repository } from '@n8n/typeorm';
import { Service } from 'typedi'; import { Service } from 'typedi';
import { TestEntity } from '@/databases/entities/test-entity'; import { TestDefinition } from '@/databases/entities/test-definition';
import type { ListQuery } from '@/requests'; import type { ListQuery } from '@/requests';
@Service() @Service()
export class TestRepository extends Repository<TestEntity> { export class TestRepository extends Repository<TestDefinition> {
constructor(dataSource: DataSource) { constructor(dataSource: DataSource) {
super(TestEntity, dataSource.manager); super(TestDefinition, dataSource.manager);
} }
async getMany(sharedWorkflowIds: string[], options?: ListQuery.Options) { async getMany(sharedWorkflowIds: string[], options?: ListQuery.Options) {
if (sharedWorkflowIds.length === 0) return { tests: [], count: 0 }; if (sharedWorkflowIds.length === 0) return { tests: [], count: 0 };
const where: FindOptionsWhere<TestEntity> = { const where: FindOptionsWhere<TestDefinition> = {
...options?.filter, ...options?.filter,
workflow: { workflow: {
id: In(sharedWorkflowIds), id: In(sharedWorkflowIds),
}, },
}; };
const findManyOptions: FindManyOptions<TestEntity> = { const findManyOptions: FindManyOptions<TestDefinition> = {
where, where,
relations: ['annotationTag'], relations: ['annotationTag'],
order: { createdAt: 'DESC' }, order: { createdAt: 'DESC' },

View file

@ -47,7 +47,7 @@ export class TestsService {
return await this.testRepository.getOne(id, accessibleWorkflowIds); return await this.testRepository.getOne(id, accessibleWorkflowIds);
} }
async save(test: TestEntity) { async save(test: TestDefinition) {
await validateEntity(test); await validateEntity(test);
return await this.testRepository.save(test); return await this.testRepository.save(test);