Browse Source

feat(sdk): add column get api

pull/4848/head
Wing-Kam Wong 2 years ago
parent
commit
0d84737517
  1. 14
      packages/nocodb/src/lib/meta/api/columnApis.ts
  2. 31
      scripts/sdk/swagger.json

14
packages/nocodb/src/lib/meta/api/columnApis.ts

@ -101,6 +101,10 @@ async function createHmAndBtColumn(
}
}
export async function columnGet(req: Request, res: Response) {
res.json(await Column.get({ colId: req.params.columnId }));
}
export async function columnAdd(
req: Request<any, any, ColumnReqType & { uidt: UITypes }>,
res: Response<TableType>
@ -1811,21 +1815,31 @@ async function createColumnIndex({
}
const router = Router({ mergeParams: true });
router.post(
'/api/v1/db/meta/tables/:tableId/columns/',
metaApiMetrics,
ncMetaAclMw(columnAdd, 'columnAdd')
);
router.patch(
'/api/v1/db/meta/columns/:columnId',
metaApiMetrics,
ncMetaAclMw(columnUpdate, 'columnUpdate')
);
router.delete(
'/api/v1/db/meta/columns/:columnId',
metaApiMetrics,
ncMetaAclMw(columnDelete, 'columnDelete')
);
router.get(
'/api/v1/db/meta/columns/:columnId',
metaApiMetrics,
ncMetaAclMw(columnGet, 'columnGet')
);
router.post(
'/api/v1/db/meta/columns/:columnId/primary',
metaApiMetrics,

31
scripts/sdk/swagger.json

@ -1972,8 +1972,7 @@
"project_id": {
"type": "string"
},
"meta": {
}
"meta": {}
}
}
}
@ -2105,7 +2104,7 @@
]
},
"delete": {
"summary": "",
"summary": "Column Delete",
"operationId": "db-table-column-delete",
"responses": {
"200": {
@ -2115,6 +2114,18 @@
"tags": [
"DB table column"
]
},
"get": {
"summary": "Column Get",
"operationId": "db-table-column-get",
"responses": {
"200": {
"description": "OK"
}
},
"tags": [
"DB Table Column"
]
}
},
"/api/v1/db/meta/columns/{columnId}/primary": {
@ -2194,8 +2205,7 @@
"order": {
"type": "number"
},
"meta": {
},
"meta": {},
"title": {
"type": "string"
},
@ -7492,8 +7502,7 @@
"number"
]
},
"meta": {
}
"meta": {}
},
"required": [
"table_name",
@ -7591,8 +7600,7 @@
"uuid": {
"type": "string"
},
"meta": {
},
"meta": {},
"show_system_fields": {
"type": "boolean"
},
@ -7835,8 +7843,7 @@
"$ref": "#/components/schemas/Column"
}
},
"meta": {
}
"meta": {}
},
"required": [
"table_name",
@ -10042,4 +10049,4 @@
}
}
}
}
}
Loading…
Cancel
Save