mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 19:11:13 +00:00
chore(core): Rename Data Store module to Data Table (no-changelog) (#18675)
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import type { ListDataStoreQueryDto } from '@n8n/api-types';
|
||||
import { Logger } from '@n8n/backend-common';
|
||||
import { User } from '@n8n/db';
|
||||
import { Service } from '@n8n/di';
|
||||
|
||||
import { ProjectService } from '@/services/project.service.ee';
|
||||
|
||||
import { DataStoreRepository } from './data-store.repository';
|
||||
|
||||
@Service()
|
||||
export class DataStoreAggregateService {
|
||||
constructor(
|
||||
private readonly dataStoreRepository: DataStoreRepository,
|
||||
private readonly projectService: ProjectService,
|
||||
private readonly logger: Logger,
|
||||
) {
|
||||
this.logger = this.logger.scoped('data-table');
|
||||
}
|
||||
async start() {}
|
||||
async shutdown() {}
|
||||
|
||||
async getManyAndCount(user: User, options: ListDataStoreQueryDto) {
|
||||
const projects = await this.projectService.getProjectRelationsForUser(user);
|
||||
let projectIds = projects.map((x) => x.projectId);
|
||||
if (options.filter?.projectId) {
|
||||
const mask = [options.filter?.projectId].flat();
|
||||
projectIds = projectIds.filter((x) => mask.includes(x));
|
||||
}
|
||||
|
||||
if (projectIds.length === 0) {
|
||||
return { count: 0, data: [] };
|
||||
}
|
||||
|
||||
return await this.dataStoreRepository.getManyAndCount({
|
||||
...options,
|
||||
filter: {
|
||||
...options.filter,
|
||||
projectId: projectIds,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user