mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
chore: Rename Data Store api paths to Data Table (no-changelog) (#18674)
This commit is contained in:
@@ -50,9 +50,9 @@ afterAll(async () => {
|
||||
await testDb.terminate();
|
||||
});
|
||||
|
||||
describe('GET /data-stores-global', () => {
|
||||
describe('GET /data-tables-global', () => {
|
||||
test('should not list data stores when no data stores exist', async () => {
|
||||
const response = await authOwnerAgent.get('/data-stores-global').expect(200);
|
||||
const response = await authOwnerAgent.get('/data-tables-global').expect(200);
|
||||
expect(response.body.data.count).toBe(0);
|
||||
expect(response.body.data.data).toHaveLength(0);
|
||||
});
|
||||
@@ -61,7 +61,7 @@ describe('GET /data-stores-global', () => {
|
||||
const project = await createTeamProject('test project', owner);
|
||||
await createDataStore(project, { name: 'Test Data Store' });
|
||||
|
||||
const response = await authMemberAgent.get('/data-stores-global').expect(200);
|
||||
const response = await authMemberAgent.get('/data-tables-global').expect(200);
|
||||
expect(response.body.data.count).toBe(0);
|
||||
expect(response.body.data.data).toHaveLength(0);
|
||||
});
|
||||
@@ -70,7 +70,7 @@ describe('GET /data-stores-global', () => {
|
||||
const project = await createTeamProject('test project', owner);
|
||||
await createDataStore(project, { name: 'Test Data Store' });
|
||||
|
||||
const response = await authAdminAgent.get('/data-stores-global').expect(200);
|
||||
const response = await authAdminAgent.get('/data-tables-global').expect(200);
|
||||
expect(response.body.data.count).toBe(0);
|
||||
expect(response.body.data.data).toHaveLength(0);
|
||||
});
|
||||
@@ -78,7 +78,7 @@ describe('GET /data-stores-global', () => {
|
||||
test("should not list data stores from another user's personal project", async () => {
|
||||
await createDataStore(ownerProject, { name: 'Personal Data Store' });
|
||||
|
||||
const response = await authAdminAgent.get('/data-stores-global').expect(200);
|
||||
const response = await authAdminAgent.get('/data-tables-global').expect(200);
|
||||
expect(response.body.data.count).toBe(0);
|
||||
expect(response.body.data.data).toHaveLength(0);
|
||||
});
|
||||
@@ -88,7 +88,7 @@ describe('GET /data-stores-global', () => {
|
||||
await linkUserToProject(member, project, 'project:viewer');
|
||||
await createDataStore(project, { name: 'Test Data Store' });
|
||||
|
||||
const response = await authMemberAgent.get('/data-stores-global').expect(200);
|
||||
const response = await authMemberAgent.get('/data-tables-global').expect(200);
|
||||
|
||||
expect(response.body.data.count).toBe(1);
|
||||
expect(response.body.data.data).toHaveLength(1);
|
||||
@@ -99,7 +99,7 @@ describe('GET /data-stores-global', () => {
|
||||
await createDataStore(ownerProject, { name: 'Personal Data Store 1' });
|
||||
await createDataStore(ownerProject, { name: 'Personal Data Store 2' });
|
||||
|
||||
const response = await authOwnerAgent.get('/data-stores-global').expect(200);
|
||||
const response = await authOwnerAgent.get('/data-tables-global').expect(200);
|
||||
|
||||
expect(response.body.data.count).toBe(2);
|
||||
expect(response.body.data.data).toHaveLength(2);
|
||||
@@ -114,7 +114,7 @@ describe('GET /data-stores-global', () => {
|
||||
await createDataStore(memberProject, { name: 'Another Data Store' });
|
||||
|
||||
const response = await authOwnerAgent
|
||||
.get('/data-stores-global')
|
||||
.get('/data-tables-global')
|
||||
.query({ filter: JSON.stringify({ projectId: ownerProject.id }) })
|
||||
.expect(200);
|
||||
|
||||
@@ -131,7 +131,7 @@ describe('GET /data-stores-global', () => {
|
||||
await createDataStore(memberProject, { name: 'Another Data Store' });
|
||||
|
||||
const response = await authMemberAgent
|
||||
.get('/data-stores-global')
|
||||
.get('/data-tables-global')
|
||||
.query({ filter: JSON.stringify({ projectId: ownerProject.id }) })
|
||||
.expect(200);
|
||||
|
||||
@@ -147,7 +147,7 @@ describe('GET /data-stores-global', () => {
|
||||
await createDataStore(project, { name: 'Test Something Else' });
|
||||
|
||||
const response = await authOwnerAgent
|
||||
.get('/data-stores-global')
|
||||
.get('/data-tables-global')
|
||||
.query({ filter: JSON.stringify({ name: 'test' }) })
|
||||
.expect(200);
|
||||
|
||||
@@ -164,7 +164,7 @@ describe('GET /data-stores-global', () => {
|
||||
await createDataStore(ownerProject, { name: 'Data Store 3' });
|
||||
|
||||
const response = await authOwnerAgent
|
||||
.get('/data-stores-global')
|
||||
.get('/data-tables-global')
|
||||
.query({ filter: JSON.stringify({ id: dataStore1.id }) })
|
||||
.expect(200);
|
||||
|
||||
@@ -181,7 +181,7 @@ describe('GET /data-stores-global', () => {
|
||||
await createDataStore(project, { name: 'Another Store' });
|
||||
|
||||
const response = await authOwnerAgent
|
||||
.get('/data-stores-global')
|
||||
.get('/data-tables-global')
|
||||
.query({ filter: JSON.stringify({ name: ['Store', 'Test'] }) })
|
||||
.expect(200);
|
||||
|
||||
@@ -201,7 +201,7 @@ describe('GET /data-stores-global', () => {
|
||||
});
|
||||
}
|
||||
|
||||
const response = await authOwnerAgent.get('/data-stores-global').query({ take: 3 }).expect(200);
|
||||
const response = await authOwnerAgent.get('/data-tables-global').query({ take: 3 }).expect(200);
|
||||
|
||||
expect(response.body.data.count).toBe(5); // Total count should be 5
|
||||
expect(response.body.data.data).toHaveLength(3); // But only 3 returned
|
||||
@@ -223,7 +223,7 @@ describe('GET /data-stores-global', () => {
|
||||
});
|
||||
}
|
||||
|
||||
const response = await authOwnerAgent.get('/data-stores-global').query({ skip: 2 }).expect(200);
|
||||
const response = await authOwnerAgent.get('/data-tables-global').query({ skip: 2 }).expect(200);
|
||||
|
||||
expect(response.body.data.count).toBe(5);
|
||||
expect(response.body.data.data).toHaveLength(3);
|
||||
@@ -246,7 +246,7 @@ describe('GET /data-stores-global', () => {
|
||||
}
|
||||
|
||||
const response = await authOwnerAgent
|
||||
.get('/data-stores-global')
|
||||
.get('/data-tables-global')
|
||||
.query({ skip: 1, take: 2 })
|
||||
.expect(200);
|
||||
|
||||
@@ -264,7 +264,7 @@ describe('GET /data-stores-global', () => {
|
||||
await createDataStore(ownerProject, { name: 'M Data Store' });
|
||||
|
||||
const response = await authOwnerAgent
|
||||
.get('/data-stores-global')
|
||||
.get('/data-tables-global')
|
||||
.query({ sortBy: 'name:asc' })
|
||||
.expect(200);
|
||||
|
||||
@@ -281,7 +281,7 @@ describe('GET /data-stores-global', () => {
|
||||
await createDataStore(ownerProject, { name: 'M Data Store' });
|
||||
|
||||
const response = await authOwnerAgent
|
||||
.get('/data-stores-global')
|
||||
.get('/data-tables-global')
|
||||
.query({ sortBy: 'name:desc' })
|
||||
.expect(200);
|
||||
|
||||
@@ -307,7 +307,7 @@ describe('GET /data-stores-global', () => {
|
||||
});
|
||||
|
||||
const response = await authOwnerAgent
|
||||
.get('/data-stores-global')
|
||||
.get('/data-tables-global')
|
||||
.query({ sortBy: 'updatedAt:desc' })
|
||||
.expect(200);
|
||||
|
||||
@@ -323,7 +323,7 @@ describe('GET /data-stores-global', () => {
|
||||
await createDataStore(ownerProject, { name: 'Another Data Store' });
|
||||
|
||||
const response = await authOwnerAgent
|
||||
.get('/data-stores-global')
|
||||
.get('/data-tables-global')
|
||||
.query({ filter: JSON.stringify({ name: 'data', id: dataStore1.id }), sortBy: 'name:asc' })
|
||||
.expect(200);
|
||||
|
||||
@@ -348,7 +348,7 @@ describe('GET /data-stores-global', () => {
|
||||
});
|
||||
|
||||
const response = await authOwnerAgent
|
||||
.get('/data-stores-global')
|
||||
.get('/data-tables-global')
|
||||
.query({ filter: JSON.stringify({ name: 'test' }) })
|
||||
.expect(200);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@ import { Get, GlobalScope, Query, RestController } from '@n8n/decorators';
|
||||
|
||||
import { DataStoreAggregateService } from './data-store-aggregate.service';
|
||||
|
||||
@RestController('/data-stores-global')
|
||||
@RestController('/data-tables-global')
|
||||
export class DataStoreAggregateController {
|
||||
constructor(private readonly dataStoreAggregateService: DataStoreAggregateService) {}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ import { DataStoreNotFoundError } from './errors/data-store-not-found.error';
|
||||
import { DataStoreValidationError } from './errors/data-store-validation.error';
|
||||
import { DataStoreRowReturn } from 'n8n-workflow';
|
||||
|
||||
@RestController('/projects/:projectId/data-stores')
|
||||
@RestController('/projects/:projectId/data-tables')
|
||||
export class DataStoreController {
|
||||
constructor(private readonly dataStoreService: DataStoreService) {}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: [
|
||||
{
|
||||
path: '/projects/:projectId/data-stores',
|
||||
path: '/projects/:projectId/data-tables',
|
||||
component: { template: '<div></div>' },
|
||||
},
|
||||
{
|
||||
@@ -113,7 +113,7 @@ const TEST_DATA_STORE: DataStoreResource = {
|
||||
describe('DataStoreView', () => {
|
||||
beforeEach(async () => {
|
||||
vi.clearAllMocks();
|
||||
await router.push('/projects/test-project/data-stores');
|
||||
await router.push('/projects/test-project/data-tables');
|
||||
await router.isReady();
|
||||
|
||||
pinia = createTestingPinia({ initialState });
|
||||
|
||||
@@ -29,7 +29,7 @@ describe('dataStore.api', () => {
|
||||
expect(makeRestApiRequest).toHaveBeenCalledWith(
|
||||
expect.anything(),
|
||||
'DELETE',
|
||||
`/projects/${projectId}/data-stores/${dataStoreId}/rows`,
|
||||
`/projects/${projectId}/data-tables/${dataStoreId}/rows`,
|
||||
{
|
||||
ids: '1,2,3',
|
||||
},
|
||||
|
||||
@@ -21,7 +21,7 @@ export const fetchDataStoresApi = async (
|
||||
projectId: string | string[];
|
||||
},
|
||||
) => {
|
||||
const apiEndpoint = projectId ? `/projects/${projectId}/data-stores` : '/data-stores-global';
|
||||
const apiEndpoint = projectId ? `/projects/${projectId}/data-tables` : '/data-tables-global';
|
||||
return await makeRestApiRequest<{ count: number; data: DataStore[] }>(
|
||||
context,
|
||||
'GET',
|
||||
@@ -42,7 +42,7 @@ export const createDataStoreApi = async (
|
||||
return await makeRestApiRequest<DataStore>(
|
||||
context,
|
||||
'POST',
|
||||
`/projects/${projectId}/data-stores`,
|
||||
`/projects/${projectId}/data-tables`,
|
||||
{
|
||||
name,
|
||||
columns: columns ?? [],
|
||||
@@ -58,7 +58,7 @@ export const deleteDataStoreApi = async (
|
||||
return await makeRestApiRequest<boolean>(
|
||||
context,
|
||||
'DELETE',
|
||||
`/projects/${projectId}/data-stores/${dataStoreId}`,
|
||||
`/projects/${projectId}/data-tables/${dataStoreId}`,
|
||||
{
|
||||
dataStoreId,
|
||||
projectId,
|
||||
@@ -75,7 +75,7 @@ export const updateDataStoreApi = async (
|
||||
return await makeRestApiRequest<DataStore>(
|
||||
context,
|
||||
'PATCH',
|
||||
`/projects/${projectId}/data-stores/${dataStoreId}`,
|
||||
`/projects/${projectId}/data-tables/${dataStoreId}`,
|
||||
{
|
||||
name,
|
||||
},
|
||||
@@ -91,7 +91,7 @@ export const addDataStoreColumnApi = async (
|
||||
return await makeRestApiRequest<DataStoreColumn>(
|
||||
context,
|
||||
'POST',
|
||||
`/projects/${projectId}/data-stores/${dataStoreId}/columns`,
|
||||
`/projects/${projectId}/data-tables/${dataStoreId}/columns`,
|
||||
{
|
||||
...column,
|
||||
},
|
||||
@@ -107,7 +107,7 @@ export const deleteDataStoreColumnApi = async (
|
||||
return await makeRestApiRequest<boolean>(
|
||||
context,
|
||||
'DELETE',
|
||||
`/projects/${projectId}/data-stores/${dataStoreId}/columns/${columnId}`,
|
||||
`/projects/${projectId}/data-tables/${dataStoreId}/columns/${columnId}`,
|
||||
);
|
||||
};
|
||||
|
||||
@@ -121,7 +121,7 @@ export const moveDataStoreColumnApi = async (
|
||||
return await makeRestApiRequest<boolean>(
|
||||
context,
|
||||
'PATCH',
|
||||
`/projects/${projectId}/data-stores/${dataStoreId}/columns/${columnId}/move`,
|
||||
`/projects/${projectId}/data-tables/${dataStoreId}/columns/${columnId}/move`,
|
||||
{
|
||||
targetIndex,
|
||||
},
|
||||
@@ -140,7 +140,7 @@ export const getDataStoreRowsApi = async (
|
||||
return await makeRestApiRequest<{
|
||||
count: number;
|
||||
data: DataStoreRow[];
|
||||
}>(context, 'GET', `/projects/${projectId}/data-stores/${dataStoreId}/rows`, {
|
||||
}>(context, 'GET', `/projects/${projectId}/data-tables/${dataStoreId}/rows`, {
|
||||
...(options ?? {}),
|
||||
});
|
||||
};
|
||||
@@ -154,7 +154,7 @@ export const insertDataStoreRowApi = async (
|
||||
return await makeRestApiRequest<Array<{ id: number }>>(
|
||||
context,
|
||||
'POST',
|
||||
`/projects/${projectId}/data-stores/${dataStoreId}/insert`,
|
||||
`/projects/${projectId}/data-tables/${dataStoreId}/insert`,
|
||||
{
|
||||
data: [row],
|
||||
},
|
||||
@@ -171,7 +171,7 @@ export const updateDataStoreRowsApi = async (
|
||||
return await makeRestApiRequest<boolean>(
|
||||
context,
|
||||
'PATCH',
|
||||
`/projects/${projectId}/data-stores/${dataStoreId}/rows`,
|
||||
`/projects/${projectId}/data-tables/${dataStoreId}/rows`,
|
||||
{
|
||||
filter: { id: rowId },
|
||||
data: rowData,
|
||||
@@ -188,7 +188,7 @@ export const deleteDataStoreRowsApi = async (
|
||||
return await makeRestApiRequest<boolean>(
|
||||
context,
|
||||
'DELETE',
|
||||
`/projects/${projectId}/data-stores/${dataStoreId}/rows`,
|
||||
`/projects/${projectId}/data-tables/${dataStoreId}/rows`,
|
||||
{
|
||||
ids: rowIds.join(','),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user