mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-22 04:10:01 +00:00
fix(core): Restrict data store access to authorized projects (no-changelog) (#18342)
This commit is contained in:
31
packages/cli/test/integration/shared/db/data-stores.ts
Normal file
31
packages/cli/test/integration/shared/db/data-stores.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import type { CreateDataStoreColumnDto } from '@n8n/api-types';
|
||||
import { randomName } from '@n8n/backend-test-utils';
|
||||
import type { Project } from '@n8n/db';
|
||||
import { Container } from '@n8n/di';
|
||||
|
||||
import { DataStoreRepository } from '@/modules/data-store/data-store.repository';
|
||||
|
||||
export const createDataStore = async (
|
||||
project: Project,
|
||||
options: {
|
||||
name?: string;
|
||||
columns?: CreateDataStoreColumnDto[];
|
||||
updatedAt?: Date;
|
||||
} = {},
|
||||
) => {
|
||||
const dataStoreRepository = Container.get(DataStoreRepository);
|
||||
const dataStore = await dataStoreRepository.createDataStore(
|
||||
project.id,
|
||||
options.name ?? randomName(),
|
||||
options.columns ?? [],
|
||||
);
|
||||
|
||||
if (options.updatedAt) {
|
||||
await dataStoreRepository.update(dataStore.id, {
|
||||
updatedAt: options.updatedAt,
|
||||
});
|
||||
dataStore.updatedAt = options.updatedAt;
|
||||
}
|
||||
|
||||
return dataStore;
|
||||
};
|
||||
Reference in New Issue
Block a user