blob: 6319957d3b7744f5c2e499f516e98398b728bad8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
import * as express from 'express'
import { database as db } from '../../../initializers/database'
import { checkSignature, signatureValidator } from '../../../middlewares'
const remotePodsRouter = express.Router()
// Post because this is a secured request
remotePodsRouter.post('/remove',
signatureValidator,
checkSignature,
removePods
)
// ---------------------------------------------------------------------------
export {
remotePodsRouter
}
// ---------------------------------------------------------------------------
function removePods (req: express.Request, res: express.Response, next: express.NextFunction) {
const host = req.body.signature.host
db.Pod.loadByHost(host)
.then(pod => {
return pod.destroy()
})
.then(() => res.type('json').status(204).end())
.catch(err => next(err))
}
|