Skip to content

chore: Add Video Stream models #5330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ config.overrides.push({
env: config.env,
rules: {
...config.rules,
'@typescript-eslint/no-explicit-any': 'off'
"@typescript-eslint/no-unused-vars": ["error"],
'@typescript-eslint/no-explicit-any': 'off',
'semi': 'off'
},
globals: config.globals
})
Expand Down
12 changes: 10 additions & 2 deletions app/models/microlocation.js → app/models/microlocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ export default class Microlocation extends ModelBase.extend({
latitude : attr('number'),
longitude : attr('number'),

sessions : hasMany('session'),
event : belongsTo('event')
sessions : hasMany('session'),
event : belongsTo('event'),
videoStream : belongsTo('video-stream')
}) {}

// DO NOT DELETE: this is how TypeScript knows how to look up your models.
declare module 'ember-data/types/registries/model' {
export default interface ModelRegistry {
microlocation: Microlocation
}
}
17 changes: 17 additions & 0 deletions app/models/video-stream.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import Model, { attr, hasMany } from '@ember-data/model';
import Microlocation from './microlocation';

export default class VideoStream extends Model {
@attr() name!: string;
@attr() url!: string;
@attr() password!: string;
@attr() additionalInformation!: string;
@hasMany('microlocation') rooms!: Microlocation[];
}

// DO NOT DELETE: this is how TypeScript knows how to look up your models.
declare module 'ember-data/types/registries/model' {
export default interface ModelRegistry {
'video-stream': VideoStream
}
}
7 changes: 7 additions & 0 deletions app/serializers/video-stream.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import ApplicationSerializer from 'open-event-frontend/serializers/application';

export default class VideoStreamSerializer extends ApplicationSerializer {
attrs = {
rooms: { serialize: true }
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"@sentry/tracing": "^5.27.3",
"@types/ember": "^3.16.2",
"@types/ember-data": "^3.16.6",
"@types/ember-data__model": "^3.16.1",
"@types/ember-qunit": "^3.4.13",
"@types/ember__test-helpers": "^1.7.3",
"@types/lodash-es": "^4.17.3",
Expand Down
14 changes: 14 additions & 0 deletions tests/unit/models/video-stream-test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { run } from '@ember/runloop';

module('Unit | Model | video stream', function(hooks) {
setupTest(hooks);

// Replace this with your real tests.
test('it exists', function(assert) {
const store = this.owner.lookup('service:store');
const model = run(() => store.createRecord('video-stream', {}));
assert.ok(model);
});
});
9 changes: 8 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1880,7 +1880,7 @@
dependencies:
"@types/node" "*"

"@types/ember-data@^3.16.6":
"@types/ember-data@*", "@types/ember-data@^3.16.6":
version "3.16.6"
resolved "https://registry.yarnpkg.com/@types/ember-data/-/ember-data-3.16.6.tgz#209bfa9b6979be32c3ed4a3abf04c274a37be04c"
integrity sha512-gx73u5XhJxlui1PP6grft5i6jpfTpcORk35pVBlPGkhQVWjez44iq2B/e7iVXomw9FkGVpp+htDsCmfo4nzDzA==
Expand All @@ -1889,6 +1889,13 @@
"@types/ember__object" "*"
"@types/rsvp" "*"

"@types/ember-data__model@^3.16.1":
version "3.16.1"
resolved "https://registry.yarnpkg.com/@types/ember-data__model/-/ember-data__model-3.16.1.tgz#54c1e88cf52f08bafcd0701a266a85feb5ae2950"
integrity sha512-RJMpKpq8jkLuUl/+E45PegE7fCXIzGlN854oJx6TwnOskZYx0CNe/dXeuicNuFbKRSPtfSqb9rmIXb5ApEUC2w==
dependencies:
"@types/ember-data" "*"

"@types/ember-qunit@^3.4.13":
version "3.4.13"
resolved "https://registry.yarnpkg.com/@types/ember-qunit/-/ember-qunit-3.4.13.tgz#58d359b62a6f6e7039d546f4c08b83ad269f7498"
Expand Down