modified: backend/src/config/dynamicSwagger.ts
modified: backend/src/controllers/endpointController.ts new file: backend/src/migrations/009_add_response_schema.sql modified: backend/src/types/index.ts modified: frontend/src/pages/EndpointEditor.tsx modified: frontend/src/types/index.ts
This commit is contained in:
@@ -88,6 +88,7 @@ export const createEndpoint = async (req: AuthRequest, res: Response) => {
|
||||
aql_body,
|
||||
aql_query_params,
|
||||
detailed_response,
|
||||
response_schema,
|
||||
} = req.body;
|
||||
|
||||
if (!name || !method || !path) {
|
||||
@@ -122,9 +123,9 @@ export const createEndpoint = async (req: AuthRequest, res: Response) => {
|
||||
name, description, method, path, database_id, sql_query, parameters,
|
||||
folder_id, user_id, is_public, enable_logging,
|
||||
execution_type, script_language, script_code, script_queries,
|
||||
aql_method, aql_endpoint, aql_body, aql_query_params, detailed_response
|
||||
aql_method, aql_endpoint, aql_body, aql_query_params, detailed_response, response_schema
|
||||
)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21)
|
||||
RETURNING *`,
|
||||
[
|
||||
name,
|
||||
@@ -147,6 +148,7 @@ export const createEndpoint = async (req: AuthRequest, res: Response) => {
|
||||
aql_body || null,
|
||||
JSON.stringify(aql_query_params || {}),
|
||||
detailed_response || false,
|
||||
response_schema ? JSON.stringify(response_schema) : null,
|
||||
]
|
||||
);
|
||||
|
||||
@@ -183,6 +185,7 @@ export const updateEndpoint = async (req: AuthRequest, res: Response) => {
|
||||
aql_body,
|
||||
aql_query_params,
|
||||
detailed_response,
|
||||
response_schema,
|
||||
} = req.body;
|
||||
|
||||
const result = await mainPool.query(
|
||||
@@ -206,8 +209,9 @@ export const updateEndpoint = async (req: AuthRequest, res: Response) => {
|
||||
aql_body = $17,
|
||||
aql_query_params = $18,
|
||||
detailed_response = $19,
|
||||
response_schema = $20,
|
||||
updated_at = CURRENT_TIMESTAMP
|
||||
WHERE id = $20
|
||||
WHERE id = $21
|
||||
RETURNING *`,
|
||||
[
|
||||
name,
|
||||
@@ -229,6 +233,7 @@ export const updateEndpoint = async (req: AuthRequest, res: Response) => {
|
||||
aql_body || null,
|
||||
aql_query_params ? JSON.stringify(aql_query_params) : null,
|
||||
detailed_response || false,
|
||||
response_schema ? JSON.stringify(response_schema) : null,
|
||||
id,
|
||||
]
|
||||
);
|
||||
@@ -488,6 +493,7 @@ export const exportEndpoint = async (req: AuthRequest, res: Response) => {
|
||||
is_public: endpoint.is_public || false,
|
||||
enable_logging: endpoint.enable_logging || false,
|
||||
detailed_response: endpoint.detailed_response || false,
|
||||
response_schema: endpoint.response_schema || null,
|
||||
folder_name: folderName,
|
||||
};
|
||||
|
||||
@@ -700,9 +706,9 @@ export const importEndpoint = async (req: AuthRequest, res: Response) => {
|
||||
name, description, method, path, database_id, sql_query, parameters,
|
||||
folder_id, user_id, is_public, enable_logging,
|
||||
execution_type, script_language, script_code, script_queries,
|
||||
aql_method, aql_endpoint, aql_body, aql_query_params, detailed_response
|
||||
aql_method, aql_endpoint, aql_body, aql_query_params, detailed_response, response_schema
|
||||
)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21)
|
||||
RETURNING *`,
|
||||
[
|
||||
exportData.name,
|
||||
@@ -725,6 +731,7 @@ export const importEndpoint = async (req: AuthRequest, res: Response) => {
|
||||
exportData.aql_body || null,
|
||||
JSON.stringify(exportData.aql_query_params || {}),
|
||||
exportData.detailed_response || false,
|
||||
exportData.response_schema ? JSON.stringify(exportData.response_schema) : null,
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user