mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
wip: Rebase after renaming DB entity
This commit is contained in:
parent
7718cdac73
commit
9be4e50b9a
|
@ -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' },
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue