diff --git a/lib/actions/table/QueryEntities.js b/lib/actions/table/QueryEntities.js new file mode 100644 index 0000000..054e6f3 --- /dev/null +++ b/lib/actions/table/QueryEntities.js @@ -0,0 +1,20 @@ +'use strict'; + +const AzuriteTableResponse = require('./../../model/table/AzuriteTableResponse'), + tableStorageManager = require('./../../core/table/TableStorageManager'); + +class QueryEntities { + constructor() { + } + + process(request, res) { + tableStorageManager.queryEntities(request) + .then((response) => { + res.set(response.httpProps); + // const payload = this._createResponsePayload(response.payload, request.accept); + res.status(200).send(payload); + }); + } +} + +module.exports = new QueryEntities(); \ No newline at end of file diff --git a/lib/core/Constants.js b/lib/core/Constants.js index 23c9c5c..152c63a 100644 --- a/lib/core/Constants.js +++ b/lib/core/Constants.js @@ -109,7 +109,8 @@ const Operations = { INSERT_ENTITY: 'InsertEntity', DELETE_TABLE: 'DeleteTable', DELETE_ENTITY: 'DeleteEntity', - QUERY_TABLE: 'QueryTable' + QUERY_TABLE: 'QueryTable', + QUERY_ENTITY: 'QueryEntity' } } diff --git a/lib/core/table/TableStorageManager.js b/lib/core/table/TableStorageManager.js index dba3f14..679410f 100644 --- a/lib/core/table/TableStorageManager.js +++ b/lib/core/table/TableStorageManager.js @@ -94,6 +94,10 @@ class TableStorageManager { return BbPromise.resolve(new AzuriteTableResponse({ payload: payload })); } + queryEntities(request) { + return BbPromise.resolve(new AzuriteTableResponse({})); + } + _getTable(name) { const coll = this.db.getCollection(Tables.Tables); const result = coll.chain() diff --git a/lib/middleware/table/actions.js b/lib/middleware/table/actions.js index d2302c6..6ecbfaf 100644 --- a/lib/middleware/table/actions.js +++ b/lib/middleware/table/actions.js @@ -41,4 +41,8 @@ actions[Operations.DELETE_ENTITY] = (request, res) => { actions[Operations.QUERY_TABLE] = (request, res) => { queryTable.process(request, res); +} + +actions[Operations.QUERY_ENTITY] = (request, res) => { + queryTable.process(request, res); } \ No newline at end of file diff --git a/lib/middleware/table/validation.js b/lib/middleware/table/validation.js index d34ddd9..78baa11 100644 --- a/lib/middleware/table/validation.js +++ b/lib/middleware/table/validation.js @@ -69,4 +69,9 @@ validations[Operations.DELETE_ENTITY] = (valContext) => { validations[Operations.QUERY_TABLE] = (valContext) => { valContext .run(TableExistsVal) +} + +validations[Operations.QUERY_ENTITY] = (valContext) => { + valContext + .run(TableExistsVal) } \ No newline at end of file diff --git a/lib/routes/table/EntityRoute.js b/lib/routes/table/EntityRoute.js index 04281bf..f3b1f75 100644 --- a/lib/routes/table/EntityRoute.js +++ b/lib/routes/table/EntityRoute.js @@ -10,9 +10,10 @@ const env = require('./../../core/env'), * for details on specification. */ module.exports = (app) => { - // app.route(`/${env.emulatedStorageAccountName}/:table`) app.route(new RegExp(`\/${env.emulatedStorageAccountName}\/([A-Za-z0-9]+)(.*)`)) .get((req, res, next) => { + req.azuriteOperation = Operations.QUERY_ENTITY; + req.azuriteRequest = new AzuriteTableRequest({ req: req }); next(); }) .head((req, res, next) => {