From 1f581fcc759f94335e96aa832b74e33ac499a9d6 Mon Sep 17 00:00:00 2001 From: Zhihe Li Date: Tue, 28 Mar 2023 12:08:15 -0400 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20Remove=20type=20on=20ch?= =?UTF-8?q?annel=20recordings=20(#155)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../generated/models/channel-recording.js | 6 ----- addons/api/addon/models/channel-recording.js | 21 --------------- .../api/mirage/factories/channel-recording.js | 2 -- .../unit/models/channel-recording-test.js | 27 ------------------- 4 files changed, 56 deletions(-) diff --git a/addons/api/addon/generated/models/channel-recording.js b/addons/api/addon/generated/models/channel-recording.js index 77f5dbc5c..fe2d7bbb0 100644 --- a/addons/api/addon/generated/models/channel-recording.js +++ b/addons/api/addon/generated/models/channel-recording.js @@ -12,12 +12,6 @@ import { attr } from '@ember-data/model'; export default class GeneratedChannelRecordingModel extends BaseModel { // =attributes - @attr('string', { - description: 'The type of the resource, to help differentiate schemas', - readOnly: true, - }) - type; - @attr('number', { description: 'The total number of bytes uploaded from the client in this Channel.', diff --git a/addons/api/addon/models/channel-recording.js b/addons/api/addon/models/channel-recording.js index 42c459170..993a5d69b 100644 --- a/addons/api/addon/models/channel-recording.js +++ b/addons/api/addon/models/channel-recording.js @@ -1,30 +1,9 @@ import GeneratedChannelRecordingModel from '../generated/models/channel-recording'; import { belongsTo } from '@ember-data/model'; -export const TYPE_CHANNEL_RECORDING_SESSION = 'session'; -export const TYPES_CHANNEL_RECORDING = Object.freeze([ - TYPE_CHANNEL_RECORDING_SESSION, -]); - export default class ChannelRecordingModel extends GeneratedChannelRecordingModel { @belongsTo('connection-recording') connection_recording; - /** - * True if the channel type is `session`. - * @type {boolean} - */ - get isSession() { - return this.type === TYPE_CHANNEL_RECORDING_SESSION; - } - - /** - * True if the channel is an unknown type. - * @type {boolean} - */ - get isUnknown() { - return !TYPES_CHANNEL_RECORDING.includes(this.type); - } - /** * Download the ascii cast recording for this channel. * @returns {Promise} diff --git a/addons/api/mirage/factories/channel-recording.js b/addons/api/mirage/factories/channel-recording.js index 685b08115..ecc72d2ec 100644 --- a/addons/api/mirage/factories/channel-recording.js +++ b/addons/api/mirage/factories/channel-recording.js @@ -5,9 +5,7 @@ import factory from '../generated/factories/channel-recording'; import generateId from '../helpers/id'; -import { TYPES_CHANNEL_RECORDING as types } from 'api/models/channel-recording'; export default factory.extend({ id: () => generateId('chr_'), - type: (i) => types[i % types.length], }); diff --git a/addons/api/tests/unit/models/channel-recording-test.js b/addons/api/tests/unit/models/channel-recording-test.js index 0a73c18d0..2ec3d2427 100644 --- a/addons/api/tests/unit/models/channel-recording-test.js +++ b/addons/api/tests/unit/models/channel-recording-test.js @@ -1,6 +1,5 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -import { TYPE_CHANNEL_RECORDING_SESSION } from 'api/models/channel-recording'; module('Unit | Model | channel-recording', function (hooks) { setupTest(hooks); @@ -10,30 +9,4 @@ module('Unit | Model | channel-recording', function (hooks) { let model = store.createRecord('channel-recording', {}); assert.ok(model); }); - - test('it has isUnknown property and returns the expected values', async function (assert) { - assert.expect(2); - const store = this.owner.lookup('service:store'); - const modelA = store.createRecord('channel-recording', { - type: TYPE_CHANNEL_RECORDING_SESSION, - }); - const modelB = store.createRecord('channel-recording', { - type: 'no-such-type', - }); - assert.false(modelA.isUnknown); - assert.true(modelB.isUnknown); - }); - - test('it has isSession property and returns the expected values', async function (assert) { - assert.expect(2); - const store = this.owner.lookup('service:store'); - const modelA = store.createRecord('channel-recording', { - type: TYPE_CHANNEL_RECORDING_SESSION, - }); - const modelB = store.createRecord('channel-recording', { - type: 'random', - }); - assert.true(modelA.isSession); - assert.false(modelB.isSession); - }); });