feat: 🎸 Add session recording models (#100)

* feat: 🎸 Add session recording models

✅ Closes: ICU-8075
This commit is contained in:
Zhihe Li authored and GitHub committed 2023-03-07 16:38:41 -05:00
1 parent b91b7ef4bb
commit b9cf61932b
12 files changed
+358

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
import GeneratedChannelModel from '../generated/models/channel';
import { belongsTo } from '@ember-data/model';
export const TYPE_CHANNEL_SESSION = 'session';
export const TYPES_CHANNEL = Object.freeze([TYPE_CHANNEL_SESSION]);
export default class ChannelModel extends GeneratedChannelModel {
@belongsTo('connection') connection;
/**
* True if the channel type is `session`.
* @type {boolean}
*/
get isSession() {
return this.type === TYPE_CHANNEL_SESSION;
}
/**
* True if the channel is an unknown type.
* @type {boolean}
*/
get isUnknown() {
return !TYPES_CHANNEL.includes(this.type);
}
}
+7
View File
@@ -0,0 +1,7 @@
import GeneratedConnectionModel from '../generated/models/connection';
import { belongsTo, hasMany } from '@ember-data/model';
export default class ConnectionModel extends GeneratedConnectionModel {
@belongsTo('recording') recording;
@hasMany('channel') channels;
}
+25
View File
@@ -0,0 +1,25 @@
import GeneratedRecordingModel from '../generated/models/recording';
import { hasMany } from '@ember-data/model';
export const TYPE_RECORDING_SSH = 'ssh';
export const TYPES_RECORDING = Object.freeze([TYPE_RECORDING_SSH]);
export default class RecordingModel extends GeneratedRecordingModel {
@hasMany('connection') connections;
/**
* True if the recording type is `ssh`.
* @type {boolean}
*/
get isSSH() {
return this.type === TYPE_RECORDING_SSH;
}
/**
* True if the recording is an unknown type.
* @type {boolean}
*/
get isUnknown() {
return !TYPES_RECORDING.includes(this.type);
}
}