Skip to content

Commit

Permalink
Fix: Adding assets method to allow searching for metering service
Browse files Browse the repository at this point in the history
  • Loading branch information
zoernert committed Jan 28, 2024
1 parent 4b5488b commit 59f9b42
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion framework/services/metering.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,19 @@ module.exports = {
* Actions
*/
actions: {

assets: {
rest: {
method: "GET",
path: "/assets"
},
async handler(ctx) {
if((typeof ctx.params.q == 'undefined') || (ctx.params.q.length == 0)) {
return (await ctx.call("readings_model.list",{ pageSize: 50,sort:"-clearingTime"})).rows;
} else {
return await ctx.call("readings_model.find",{search:ctx.params.q,searchFields:['meterId']});
}
}
},
lastReading: {
rest: {
method: "GET",
Expand Down

0 comments on commit 59f9b42

Please sign in to comment.