From ee97a4c1e1397d9e3129a26a1327ed9c4541fe0d Mon Sep 17 00:00:00 2001 From: Icebob Date: Sun, 7 Jul 2019 22:53:34 +0200 Subject: [PATCH] add rest properties --- packages/moleculer-db/CHANGELOG.md | 8 ++++++++ packages/moleculer-db/src/index.js | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/packages/moleculer-db/CHANGELOG.md b/packages/moleculer-db/CHANGELOG.md index 98b654b8..29223a0f 100644 --- a/packages/moleculer-db/CHANGELOG.md +++ b/packages/moleculer-db/CHANGELOG.md @@ -1,3 +1,11 @@ +-------------------------------------------------- + +# 0.8.1 (2019-07-07) + +## Changes +- update dependencies +- add rest properties for CRUD actions + -------------------------------------------------- # 0.8.0 (2019-07-01) diff --git a/packages/moleculer-db/src/index.js b/packages/moleculer-db/src/index.js index 7992b7ba..d4aab11b 100644 --- a/packages/moleculer-db/src/index.js +++ b/packages/moleculer-db/src/index.js @@ -162,6 +162,7 @@ module.exports = { cache: { keys: ["populate", "fields", "page", "pageSize", "sort", "search", "searchFields", "query"] }, + rest: "GET /", params: { populate: [ { type: "string", optional: true }, @@ -197,6 +198,7 @@ module.exports = { * @returns {Object} Saved entity. */ create: { + rest: "POST /", handler(ctx) { let params = ctx.params; return this._create(ctx, params); @@ -243,6 +245,7 @@ module.exports = { cache: { keys: ["id", "populate", "fields", "mapping"] }, + rest: "GET /:id", params: { id: [ { type: "string" }, @@ -279,6 +282,7 @@ module.exports = { * @throws {EntityNotFoundError} - 404 Entity not found */ update: { + rest: "PUT /:id", handler(ctx) { let params = ctx.params; return this._update(ctx, params); @@ -296,6 +300,7 @@ module.exports = { * @throws {EntityNotFoundError} - 404 Entity not found */ remove: { + rest: "DELETE /:id", params: { id: { type: "any" } },