Files
kami-parse-server/src/Routers/InstallationsRouter.js

52 lines
1.2 KiB
JavaScript
Raw Normal View History

// InstallationsRouter.js
import ClassesRouter from './ClassesRouter';
import rest from '../rest';
export class InstallationsRouter extends ClassesRouter {
className() {
return '_Installation';
}
handleFind(req) {
const body = Object.assign(
req.body,
ClassesRouter.JSONFromQuery(req.query)
);
const options = ClassesRouter.optionsFromBody(body);
return rest
.find(
req.config,
req.auth,
'_Installation',
body.where,
options,
req.info.clientSDK,
req.info.context
)
2020-07-13 17:13:08 -05:00
.then(response => {
return { response: response };
});
}
2016-02-19 23:47:44 -05:00
mountRoutes() {
2020-07-13 17:13:08 -05:00
this.route('GET', '/installations', req => {
return this.handleFind(req);
});
2020-07-13 17:13:08 -05:00
this.route('GET', '/installations/:objectId', req => {
return this.handleGet(req);
});
2020-07-13 17:13:08 -05:00
this.route('POST', '/installations', req => {
return this.handleCreate(req);
});
2020-07-13 17:13:08 -05:00
this.route('PUT', '/installations/:objectId', req => {
return this.handleUpdate(req);
});
2020-07-13 17:13:08 -05:00
this.route('DELETE', '/installations/:objectId', req => {
return this.handleDelete(req);
});
}
}
export default InstallationsRouter;