2018-10-26 16:36:15 +00:00
|
|
|
import { inject as service } from '@ember/service';
|
2020-11-09 09:25:35 +00:00
|
|
|
import RepositoryService from 'consul-ui/services/repository';
|
2021-02-23 08:56:42 +00:00
|
|
|
import dataSource from 'consul-ui/decorators/data-source';
|
2018-10-26 16:36:15 +00:00
|
|
|
|
|
|
|
const modelName = 'session';
|
2020-11-09 09:25:35 +00:00
|
|
|
export default class SessionService extends RepositoryService {
|
|
|
|
@service('store')
|
|
|
|
store;
|
|
|
|
|
|
|
|
getModelName() {
|
2018-10-26 16:36:15 +00:00
|
|
|
return modelName;
|
2020-11-09 09:25:35 +00:00
|
|
|
}
|
|
|
|
|
2021-02-23 08:56:42 +00:00
|
|
|
@dataSource('/:ns/:dc/sessions/for-node/:id')
|
|
|
|
findByNode(params, configuration = {}) {
|
2018-12-04 17:04:44 +00:00
|
|
|
if (typeof configuration.cursor !== 'undefined') {
|
2021-02-23 08:56:42 +00:00
|
|
|
params.index = configuration.cursor;
|
|
|
|
params.uri = configuration.uri;
|
2018-12-04 17:04:44 +00:00
|
|
|
}
|
2021-02-23 08:56:42 +00:00
|
|
|
return this.store.query(this.getModelName(), params);
|
2020-11-09 09:25:35 +00:00
|
|
|
}
|
|
|
|
|
2018-10-26 16:36:15 +00:00
|
|
|
// TODO: Why Key? Probably should be findBySlug like the others
|
2021-02-23 08:56:42 +00:00
|
|
|
@dataSource('/:ns/:dc/sessions/for-key/:id')
|
|
|
|
findByKey(params, configuration = {}) {
|
2019-12-17 18:47:37 +00:00
|
|
|
return this.findBySlug(...arguments);
|
2020-11-09 09:25:35 +00:00
|
|
|
}
|
|
|
|
}
|