refactor: 💡 Update list session recording API (#203)

* refactor: 💡 Update list session recording API
This commit is contained in:
Zhihe Li authored and GitHub committed 2023-04-19 12:34:31 -04:00
1 parent 61a3e17c5e
commit 4c9811739c
2 files changed
+17 -2

No files matched your search

+12 -1
View File
@@ -706,7 +706,18 @@ function routes() {
);
// session recordings
this.get('/session-recordings');
this.get(
'/session-recordings',
(
{ sessionRecordings },
{ queryParams: { scope_id: scopeId, recursive } }
) => {
if (recursive && scopeId === 'global') {
return sessionRecordings.all();
}
return sessionRecordings.where({ scopeId });
}
);
this.get(
'/session-recordings/:idMethod',
async ({ sessionRecordings }, { params: { idMethod } }) => {
@@ -26,7 +26,11 @@ export default class ScopesScopeSessionRecordingsRoute extends Route {
const scope = this.modelFor('scopes.scope');
// if (this.can.can('list session-recording', scope, { collection: 'session-recordings' })) {
const { id: scope_id } = scope;
const sessionRecordings = await this.store.findAll('session-recording');
const sessionRecordings = await this.store.query('session-recording', {
scope_id,
recursive: true,
});
const storageBuckets = await this.store.query('storage-bucket', {
scope_id,
recursive: true,