express-ext 0.5.0 → 0.5.1
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 +0 -20
- package/package.json +1 -1
- package/src/index.ts +0 -18
package/lib/index.js
CHANGED
|
@@ -99,7 +99,6 @@ var FollowController = (function () {
|
|
|
99
99
|
this.id = id && id.length > 0 ? id : "id"
|
|
100
100
|
this.follow = this.follow.bind(this)
|
|
101
101
|
this.unfollow = this.unfollow.bind(this)
|
|
102
|
-
this.checkFollow = this.checkFollow.bind(this)
|
|
103
102
|
}
|
|
104
103
|
FollowController.prototype.follow = function (req, res) {
|
|
105
104
|
var _this = this
|
|
@@ -141,25 +140,6 @@ var FollowController = (function () {
|
|
|
141
140
|
return http_1.handleError(err, res, _this.log)
|
|
142
141
|
})
|
|
143
142
|
}
|
|
144
|
-
FollowController.prototype.checkFollow = function (req, res) {
|
|
145
|
-
var _this = this
|
|
146
|
-
var userId = res.locals[this.userId]
|
|
147
|
-
var id = req.params[this.id]
|
|
148
|
-
if (!id || id.length === 0) {
|
|
149
|
-
return res.status(400).end("'" + this.id + "' cannot be empty")
|
|
150
|
-
}
|
|
151
|
-
if (!userId || userId.length === 0) {
|
|
152
|
-
return res.status(400).end("'" + this.userId + "' cannot be empty")
|
|
153
|
-
}
|
|
154
|
-
this.service
|
|
155
|
-
.checkFollow(userId, id)
|
|
156
|
-
.then(function (count) {
|
|
157
|
-
return res.status(200).json(count).end()
|
|
158
|
-
})
|
|
159
|
-
.catch(function (err) {
|
|
160
|
-
return http_1.handleError(err, res, _this.log)
|
|
161
|
-
})
|
|
162
|
-
}
|
|
163
143
|
return FollowController
|
|
164
144
|
})()
|
|
165
145
|
exports.FollowController = FollowController
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -93,7 +93,6 @@ export class SavedController {
|
|
|
93
93
|
export interface FollowService {
|
|
94
94
|
follow(id: string, target: string): Promise<number>
|
|
95
95
|
unfollow(id: string, target: string): Promise<number>
|
|
96
|
-
checkFollow(id: string, target: string): Promise<number>
|
|
97
96
|
}
|
|
98
97
|
// tslint:disable-next-line:max-classes-per-file
|
|
99
98
|
export class FollowController {
|
|
@@ -102,7 +101,6 @@ export class FollowController {
|
|
|
102
101
|
this.id = id && id.length > 0 ? id : "id"
|
|
103
102
|
this.follow = this.follow.bind(this)
|
|
104
103
|
this.unfollow = this.unfollow.bind(this)
|
|
105
|
-
this.checkFollow = this.checkFollow.bind(this)
|
|
106
104
|
}
|
|
107
105
|
protected userId: string
|
|
108
106
|
protected id: string
|
|
@@ -140,22 +138,6 @@ export class FollowController {
|
|
|
140
138
|
})
|
|
141
139
|
.catch((err) => handleError(err, res, this.log))
|
|
142
140
|
}
|
|
143
|
-
checkFollow(req: Request, res: Response): void {
|
|
144
|
-
const userId: string = res.locals[this.userId]
|
|
145
|
-
const id = req.params[this.id]
|
|
146
|
-
if (!id || id.length === 0) {
|
|
147
|
-
return res.status(400).end(`'${this.id}' cannot be empty`)
|
|
148
|
-
}
|
|
149
|
-
if (!userId || userId.length === 0) {
|
|
150
|
-
return res.status(400).end(`'${this.userId}' cannot be empty`)
|
|
151
|
-
}
|
|
152
|
-
this.service
|
|
153
|
-
.checkFollow(userId, id)
|
|
154
|
-
.then((count) => {
|
|
155
|
-
return res.status(200).json(count).end()
|
|
156
|
-
})
|
|
157
|
-
.catch((err) => handleError(err, res, this.log))
|
|
158
|
-
}
|
|
159
141
|
}
|
|
160
142
|
export interface ReactService {
|
|
161
143
|
react(id: string, author: string, reaction: string): Promise<number>
|