2016-02-10 21:36:40 -08:00
|
|
|
// InstallationsRouter.js
|
|
|
|
|
|
|
|
|
|
import ClassesRouter from './ClassesRouter';
|
|
|
|
|
import rest from '../rest';
|
2020-07-15 20:10:33 +02:00
|
|
|
import { promiseEnsureIdempotency } from '../middlewares';
|
2016-02-10 21:36:40 -08:00
|
|
|
|
|
|
|
|
export class InstallationsRouter extends ClassesRouter {
|
2017-09-05 17:51:11 -04:00
|
|
|
className() {
|
|
|
|
|
return '_Installation';
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-10 21:36:40 -08:00
|
|
|
handleFind(req) {
|
2025-03-03 16:11:42 -05:00
|
|
|
const body = Object.assign(req.body || {}, ClassesRouter.JSONFromQuery(req.query));
|
2022-09-30 01:38:57 +03:00
|
|
|
const options = ClassesRouter.optionsFromBody(body, req.config.defaultLimit);
|
2018-09-01 13:58:06 -04:00
|
|
|
return rest
|
|
|
|
|
.find(
|
|
|
|
|
req.config,
|
|
|
|
|
req.auth,
|
|
|
|
|
'_Installation',
|
|
|
|
|
body.where,
|
|
|
|
|
options,
|
2020-07-11 02:17:27 +05:30
|
|
|
req.info.clientSDK,
|
|
|
|
|
req.info.context
|
2018-09-01 13:58:06 -04:00
|
|
|
)
|
2020-07-13 17:13:08 -05:00
|
|
|
.then(response => {
|
2018-09-01 13:58:06 -04:00
|
|
|
return { response: response };
|
2016-02-10 21:36:40 -08:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-19 23:47:44 -05:00
|
|
|
mountRoutes() {
|
2020-07-13 17:13:08 -05:00
|
|
|
this.route('GET', '/installations', req => {
|
2018-09-01 13:58:06 -04:00
|
|
|
return this.handleFind(req);
|
|
|
|
|
});
|
2020-07-13 17:13:08 -05:00
|
|
|
this.route('GET', '/installations/:objectId', req => {
|
2018-09-01 13:58:06 -04:00
|
|
|
return this.handleGet(req);
|
|
|
|
|
});
|
2020-07-15 20:10:33 +02:00
|
|
|
this.route('POST', '/installations', promiseEnsureIdempotency, req => {
|
2018-09-01 13:58:06 -04:00
|
|
|
return this.handleCreate(req);
|
|
|
|
|
});
|
2020-10-25 15:06:58 -05:00
|
|
|
this.route('PUT', '/installations/:objectId', promiseEnsureIdempotency, req => {
|
|
|
|
|
return this.handleUpdate(req);
|
|
|
|
|
});
|
2020-07-13 17:13:08 -05:00
|
|
|
this.route('DELETE', '/installations/:objectId', req => {
|
2018-09-01 13:58:06 -04:00
|
|
|
return this.handleDelete(req);
|
|
|
|
|
});
|
2016-02-10 21:36:40 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default InstallationsRouter;
|