diff --git a/.eslintrc.js b/.eslintrc.js index 75fdb772a02..cd954b7dbd4 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -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 }) diff --git a/app/models/microlocation.js b/app/models/microlocation.ts similarity index 51% rename from app/models/microlocation.js rename to app/models/microlocation.ts index e193999c0bd..9c92b4f277d 100644 --- a/app/models/microlocation.js +++ b/app/models/microlocation.ts @@ -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 + } +} diff --git a/app/models/video-stream.ts b/app/models/video-stream.ts new file mode 100644 index 00000000000..f257045cd57 --- /dev/null +++ b/app/models/video-stream.ts @@ -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 + } +} diff --git a/app/serializers/video-stream.ts b/app/serializers/video-stream.ts new file mode 100644 index 00000000000..45083fa7cf9 --- /dev/null +++ b/app/serializers/video-stream.ts @@ -0,0 +1,7 @@ +import ApplicationSerializer from 'open-event-frontend/serializers/application'; + +export default class VideoStreamSerializer extends ApplicationSerializer { + attrs = { + rooms: { serialize: true } + } +} diff --git a/package.json b/package.json index 26310b772f9..fdc93a9558c 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/tests/unit/models/video-stream-test.ts b/tests/unit/models/video-stream-test.ts new file mode 100644 index 00000000000..385cfb2decb --- /dev/null +++ b/tests/unit/models/video-stream-test.ts @@ -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); + }); +}); diff --git a/yarn.lock b/yarn.lock index 1317e892515..c4e21b2b460 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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== @@ -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"