express-ext 0.1.30 → 0.1.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -78,7 +78,7 @@ var SavedController = (function () {
78
78
  this.item = item;
79
79
  this.id = (id && id.length > 0 ? id : 'id');
80
80
  this.save = this.save.bind(this);
81
- this.unsave = this.unsave.bind(this);
81
+ this.remove = this.remove.bind(this);
82
82
  this.load = this.load.bind(this);
83
83
  }
84
84
  SavedController.prototype.save = function (req, res) {
@@ -98,7 +98,7 @@ var SavedController = (function () {
98
98
  })
99
99
  .catch(function (err) { return http_1.handleError(err, res, _this.log); });
100
100
  };
101
- SavedController.prototype.unsave = function (req, res) {
101
+ SavedController.prototype.remove = function (req, res) {
102
102
  var _this = this;
103
103
  var id = req.params[this.id];
104
104
  var itemId = req.params[this.item];
@@ -110,7 +110,7 @@ var SavedController = (function () {
110
110
  res.status(400).end("'" + this.item + "' cannot be empty");
111
111
  return;
112
112
  }
113
- this.service.unsave(id, itemId).then(function (data) {
113
+ this.service.remove(id, itemId).then(function (data) {
114
114
  res.status(200).json(data).end();
115
115
  })
116
116
  .catch(function (err) { return http_1.handleError(err, res, _this.log); });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-ext",
3
- "version": "0.1.30",
3
+ "version": "0.1.31",
4
4
  "description": "express-ext",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./src/index.ts",
package/src/index.ts CHANGED
@@ -83,13 +83,13 @@ export function allow(access: AccessConfig): (req: Request, res: Response, next:
83
83
  export interface SavedService<T> {
84
84
  load(id: string): Promise<T[]>;
85
85
  save(id: string, itemId: string): Promise<number>;
86
- unsave(id: string, itemId: string): Promise<number>;
86
+ remove(id: string, itemId: string): Promise<number>;
87
87
  }
88
88
  export class SavedController<T> {
89
89
  constructor(public log: (msg: string) => void, public service: SavedService<T>, public item: string, id?: string) {
90
90
  this.id = (id && id.length > 0 ? id : 'id');
91
91
  this.save = this.save.bind(this);
92
- this.unsave = this.unsave.bind(this);
92
+ this.remove = this.remove.bind(this);
93
93
  this.load = this.load.bind(this);
94
94
  }
95
95
  id: string;
@@ -109,7 +109,7 @@ export class SavedController<T> {
109
109
  })
110
110
  .catch(err => handleError(err, res, this.log));
111
111
  }
112
- unsave(req: Request, res: Response) {
112
+ remove(req: Request, res: Response) {
113
113
  const id = req.params[this.id];
114
114
  const itemId = req.params[this.item];
115
115
  if (!id || id.length === 0) {
@@ -120,7 +120,7 @@ export class SavedController<T> {
120
120
  res.status(400).end(`'${this.item}' cannot be empty`);
121
121
  return;
122
122
  }
123
- this.service.unsave(id, itemId).then(data => {
123
+ this.service.remove(id, itemId).then(data => {
124
124
  res.status(200).json(data).end();
125
125
  })
126
126
  .catch(err => handleError(err, res, this.log));