mirror of
https://github.com/n8n-io/n8n.git
synced 2026-06-03 10:17:00 +02:00
expose endpoints
This commit is contained in:
parent
973c1c9e65
commit
cf6df7406a
|
|
@ -1,10 +1,14 @@
|
|||
import {
|
||||
AddDataStoreColumnDto,
|
||||
CreateDataStoreDto,
|
||||
DeleteDataStoreColumnDto,
|
||||
ListDataStoreQueryDto,
|
||||
RenameDataStoreDto,
|
||||
} from '@n8n/api-types';
|
||||
import { AuthenticatedRequest } from '@n8n/db';
|
||||
import { Body, Get, Param, Post, ProjectScope, Query, RestController } from '@n8n/decorators';
|
||||
|
||||
import { DataStoreService } from './data-store.service';
|
||||
import { CreateDataStoreDto, ListDataStoreQueryDto } from '@n8n/api-types';
|
||||
import { DataStoreEntity } from './data-store.entity';
|
||||
|
||||
@RestController('/data-store')
|
||||
export class DataStoreController {
|
||||
constructor(private readonly dataStoreService: DataStoreService) {}
|
||||
|
|
@ -14,15 +18,54 @@ export class DataStoreController {
|
|||
return await this.dataStoreService.createDataStore(dto);
|
||||
}
|
||||
|
||||
@Get('/')
|
||||
@Get('/', { skipAuth: true })
|
||||
@ProjectScope('dataStore:list')
|
||||
async listDataStores(
|
||||
req: AuthenticatedRequest,
|
||||
res: Response,
|
||||
_req: AuthenticatedRequest,
|
||||
_res: Response,
|
||||
@Query payload: ListDataStoreQueryDto,
|
||||
) {
|
||||
const [data, count] = await this.dataStoreService.getManyAndCount(payload);
|
||||
|
||||
return { count, data };
|
||||
}
|
||||
|
||||
@Post('/:dataStoreId/add-column', { skipAuth: true })
|
||||
async addColumn(
|
||||
_req: AuthenticatedRequest,
|
||||
_res: Response,
|
||||
@Param('dataStoreId') dataStoreId: string,
|
||||
@Body dto: AddDataStoreColumnDto,
|
||||
) {
|
||||
return await this.dataStoreService.addColumn(dataStoreId, dto);
|
||||
}
|
||||
|
||||
@Post('/:dataStoreId/delete-column', { skipAuth: true })
|
||||
async deleteColumn(
|
||||
_req: AuthenticatedRequest,
|
||||
_res: Response,
|
||||
@Param('dataStoreId') dataStoreId: string,
|
||||
@Body dto: DeleteDataStoreColumnDto,
|
||||
) {
|
||||
return await this.dataStoreService.deleteColumn(dataStoreId, dto);
|
||||
}
|
||||
|
||||
@Post('/:dataStoreId/rename', { skipAuth: true })
|
||||
async renameDataStore(
|
||||
_req: AuthenticatedRequest,
|
||||
_res: Response,
|
||||
@Param('dataStoreId') dataStoreId: string,
|
||||
@Body dto: RenameDataStoreDto,
|
||||
) {
|
||||
return await this.dataStoreService.renameDataStore(dataStoreId, dto);
|
||||
}
|
||||
|
||||
@Post('/:dataStoreId/delete', { skipAuth: true })
|
||||
async deleteDataStore(
|
||||
_req: AuthenticatedRequest,
|
||||
_res: Response,
|
||||
@Param('dataStoreId') dataStoreId: string,
|
||||
) {
|
||||
return await this.dataStoreService.deleteDataStore(dataStoreId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user