Skip to content
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

Update models and relationships #462

Merged
merged 13 commits into from
May 31, 2023
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
1 change: 0 additions & 1 deletion app/controllers/meetings/publish/agenda.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ export default class MeetingsPublishAgendaController extends Controller {
const rslt = await this.store.createRecord('agenda', {
agendaType: type,
zitting: this.model,
agendapunten: this.model.behandeldeAgendapunten,
renderedContent: prePublish,
});
return rslt;
Expand Down
4 changes: 2 additions & 2 deletions app/models/agenda-position.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Model, { belongsTo } from '@ember-data/model';

export default class AgendaPositionModel extends Model {
@belongsTo('concept') position;
@belongsTo('agendapunt') agendapoint;
@belongsTo('concept', { inverse: null }) position;
@belongsTo('agendapunt', { inverse: null }) agendapoint;
}

// skos:prefLabel "before";
Expand Down
6 changes: 3 additions & 3 deletions app/models/agenda.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import Model, { attr, belongsTo, hasMany } from '@ember-data/model';

export default class Agenda extends Model {
@attr inhoud;
@attr agendaStatus;
@attr agendaType;
@attr renderedContent;

@belongsTo('zitting', { inverse: null }) zitting;
@belongsTo('published-resource') publishedResource;
@belongsTo('published-resource', { inverse: 'agenda' }) publishedResource;

@hasMany('agendapunt', { inverse: null }) agendapunten;
@hasMany('signed-resource') signedResources;
@hasMany('signed-resource', { inverse: 'agenda' }) signedResources;
}
5 changes: 3 additions & 2 deletions app/models/agendapunt.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ export default class Agendapunt extends Model {
@attr('string') titel;
@attr('string-set') type;
@attr('number') position;

@belongsTo('agendapunt', { inverse: null }) vorigeAgendapunt;
@hasMany('agendapunt', { inverse: null }) referenties;
@belongsTo('agenda', { inverse: null }) agenda;
@belongsTo('zitting', { inverse: 'agendapunten' }) zitting;
@belongsTo('behandeling-van-agendapunt', { inverse: 'onderwerp' })
behandeling;

@hasMany('agendapunt', { inverse: null }) referenties;
}
8 changes: 6 additions & 2 deletions app/models/behandeling-van-agendapunt.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,25 @@ import { inject as service } from '@ember/service';

export default class BehandelingVanAgendapunt extends Model {
@service store;

@attr openbaar;
@attr afgeleidUit;
@attr('string') gevolg;

@belongsTo('behandeling-van-agendapunt', { inverse: null })
vorigeBehandelingVanAgendapunt;
@belongsTo('agendapunt', { inverse: 'behandeling' }) onderwerp;
@belongsTo('functionaris', { inverse: null }) secretaris;
@belongsTo('mandataris', { inverse: null }) voorzitter;
@belongsTo('document-container', { inverse: null }) documentContainer;
@belongsTo('versioned-behandeling', { inverse: 'behandeling' })
versionedBehandeling;

@hasMany('besluit', { inverse: 'volgendUitBehandelingVanAgendapunt' })
besluiten;
@hasMany('mandataris', { inverse: null }) aanwezigen;
@hasMany('mandataris', { inverse: null }) afwezigen;
@hasMany('stemming', { inverse: 'behandelingVanAgendapunt' }) stemmingen;
@belongsTo('document-container') documentContainer;
@belongsTo('versioned-behandeling') versionedBehandeling;

async initializeDocument() {
const agendaItem = await this.onderwerp;
Expand Down
9 changes: 9 additions & 0 deletions app/models/beleidsdomein-code.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Model, { attr, hasMany } from '@ember-data/model';

export default class BeleidsdomeinCodeModel extends Model {
@attr uri;
@attr label;
@attr scopeNote;

@hasMany('mandataris', { inverse: 'beleidsdomein' }) mandatarissen;
}
2 changes: 0 additions & 2 deletions app/models/besluit.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import Model, { belongsTo } from '@ember-data/model';

export default class BesluitModel extends Model {
@belongsTo('rechtsgrond-besluit', { inverse: null }) realistatie;
@belongsTo('behandeling-van-agendapunt', { inverse: 'besluiten' })
volgendUitBehandelingVanAgendapunt;
@belongsTo('editor-document', { inverse: null }) afgeleidUitNotule;
}
7 changes: 7 additions & 0 deletions app/models/bestuurseenheid.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,16 @@ import Model, { attr, belongsTo, hasMany } from '@ember-data/model';

export default class BestuurseenheidModel extends Model {
@attr naam;
@attr alternatieveNaam;
@attr wilMailOntvangen;
@attr mailAdres;
@attr uri;

@belongsTo('werkingsgebied', { inverse: 'bestuurseenheid' }) werkingsgebied;
@belongsTo('werkingsgebied', { inverse: null }) provincie;
@belongsTo('bestuurseenheid-classificatie-code', { inverse: null })
classificatie;

@hasMany('bestuursorgaan', { inverse: 'bestuurseenheid' }) bestuursorganen;

rdfaBindings = {
Expand Down
1 change: 1 addition & 0 deletions app/models/bestuursfunctie-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export default class BestuursfunctieCodeModel extends Model {
@attr label;
@attr scopeNote;
@attr uri;

@hasMany('bestuursorgaan-classificatie-code', { inverse: 'standaardType' })
standaardTypeVan;

Expand Down
4 changes: 3 additions & 1 deletion app/models/bestuursfunctie.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import Model, { attr, belongsTo, hasMany } from '@ember-data/model';

export default class BestuursfunctieModel extends Model {
@attr uri;

@belongsTo('bestuursfunctie-code', { inverse: null }) rol;
@hasMany('bestuursorgaan', { inverse: 'bevat' }) bevatIn;

@hasMany('bestuursorgaan', { inverse: 'bevatBestuursfunctie' }) bevatIn;

rdfaBindings = {
class:
Expand Down
1 change: 1 addition & 0 deletions app/models/bestuursorgaan-classificatie-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export default class BestuursorgaanClassificatieCodeModel extends Model {
@attr label;
@attr scopeNote;
@attr uri;

@hasMany('bestuursfunctie-code', { inverse: 'standaardTypeVan' })
standaardType;
@hasMany('bestuursorgaan', { inverse: null }) isClassificatieVan;
Expand Down
3 changes: 3 additions & 0 deletions app/models/bestuursorgaan.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@ export default class BestuursorgaanModel extends Model {
@attr naam;
@attr('date') bindingEinde;
@attr('date') bindingStart;

@belongsTo('bestuurseenheid', { inverse: 'bestuursorganen' }) bestuurseenheid;
@belongsTo('bestuursorgaan-classificatie-code', { inverse: null })
classificatie;
@belongsTo('bestuursorgaan', { inverse: 'heeftTijdsspecialisaties' })
isTijdsspecialisatieVan;
@belongsTo('rechtstreekse-verkiezing', { inverse: 'steltSamen' })
wordtSamengesteldDoor;

@hasMany('bestuursorgaan', { inverse: 'isTijdsspecialisatieVan' })
heeftTijdsspecialisaties;
@hasMany('mandaat', { inverse: 'bevatIn' }) bevat;
@hasMany('bestuursfunctie', { inverse: 'bevatIn' }) bevatBestuursfunctie;

rdfaBindings = {
naam: 'http://www.w3.org/2004/02/skos/core#prefLabel',
Expand Down
7 changes: 2 additions & 5 deletions app/models/document-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@ import Model, { attr, belongsTo, hasMany } from '@ember-data/model';

export default class DocumentContainerModel extends Model {
@attr uri;
@hasMany('editor-document', { inverse: 'documentContainer' }) revisions;

@belongsTo('editor-document', { inverse: null }) currentVersion;
@belongsTo('concept', { inverse: null }) status;
@belongsTo('editor-document-folder', { inverse: null }) folder;
@belongsTo('bestuurseenheid', { inverse: null }) publisher;

@hasMany('versioned-agenda') versionedAgendas;
@hasMany('versioned-notulen') versionedNotulen;
@hasMany('versioned-besluiten-lijst') versionedBesluitenLijsten;
@hasMany('versioned-behandelingen') versionedBehandelingen;
@hasMany('editor-document', { inverse: 'documentContainer' }) revisions;
@hasMany('attachment', { inverse: 'documentContainer' }) attachments;
@hasMany('editor-document', { inverse: 'parts' }) isPartOf;
}
1 change: 1 addition & 0 deletions app/models/editor-document.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default class EditorDocumentModel extends Model {
nextVersion;
@belongsTo('document-container', { inverse: 'revisions' })
documentContainer;

@hasMany('document-container', { inverse: 'isPartOf' }) parts;

get htmlSafeContent() {
Expand Down
2 changes: 1 addition & 1 deletion app/models/extract-preview.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Model, { belongsTo, attr } from '@ember-data/model';

export default class ExtractPreviewModel extends Model {
@belongsTo('behandeling-van-agendapunt') treatment;
@belongsTo('behandeling-van-agendapunt', { inverse: null }) treatment;
@attr html;
@attr('string-set') validationErrors;
}
5 changes: 4 additions & 1 deletion app/models/fractie.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ import Model, { attr, belongsTo, hasMany } from '@ember-data/model';
export default class FractieModel extends Model {
@attr uri;
@attr naam;
@attr generatedFrom;

@belongsTo('fractietype', { inverse: null }) fractietype;
@hasMany('bestuursorgaan', { inverse: null }) bestuursorganenInTijd;
@belongsTo('bestuurseenheid', { inverse: null }) bestuurseenheid;

@hasMany('bestuursorgaan', { inverse: null }) bestuursorganenInTijd;

rdfaBindings = {
class: 'http://data.vlaanderen.be/ns/mandaat#Fractie',
naam: 'http://www.w3.org/ns/regorg#legalName',
Expand Down
1 change: 1 addition & 0 deletions app/models/fractietype.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Model, { attr } from '@ember-data/model';
export default class FractieTypeModel extends Model {
@attr uri;
@attr label;
@attr scopeNote;

get isOnafhankelijk() {
return (
Expand Down
1 change: 1 addition & 0 deletions app/models/functionaris-status-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Model, { attr } from '@ember-data/model';
export default class FunctionarisStatusCodeModel extends Model {
@attr uri;
@attr label;
@attr scopeNote;

rdfaBindings = {
class:
Expand Down
3 changes: 2 additions & 1 deletion app/models/functionaris.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ export default class FunctionarisModel extends Model {
@attr('datetime') start;
@attr('datetime') einde;
@attr uri;

@belongsTo('bestuursfunctie', { inverse: null }) bekleedt;
@belongsTo('persoon', { inverse: 'isAangesteldAls' }) isBestuurlijkeAliasVan;
@belongsTo('persoon', { inverse: null }) isBestuurlijkeAliasVan;
@belongsTo('functionaris-status-code', { inverse: null }) status;

rdfaBindings = {
Expand Down
2 changes: 1 addition & 1 deletion app/models/gebruiker.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class UserModel extends Model {
@hasMany('account', { inverse: null })
account;

@hasMany('bestuurseenheden', { inverse: null })
@hasMany('bestuurseenheid', { inverse: null })
bestuurseenheden;

// this is only used for mock login afaik
Expand Down
1 change: 1 addition & 0 deletions app/models/geslacht-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Model, { attr } from '@ember-data/model';
export default class GeslachtCodeModel extends Model {
@attr uri;
@attr label;
@attr scopeNote;

rdfaBindings = {
class: 'http://mu.semte.ch/vocabularies/ext/GeslachtCode',
Expand Down
2 changes: 1 addition & 1 deletion app/models/intermission.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ export default class IntermissionModel extends Model {
@attr('datetime') endedAt;
@attr comment;
@belongsTo('zitting', { inverse: 'intermissions' }) zitting;
@belongsTo('agenda-position') agendaPosition;
@belongsTo('agenda-position', { inverse: null }) agendaPosition;
}
3 changes: 3 additions & 0 deletions app/models/kandidatenlijst.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ export default class KandidatenlijstModel extends Model {
@attr uri;
@attr lijstnaam;
@attr lijstnummer;

@belongsTo('lijsttype', { inverse: null }) lijsttype;
@belongsTo('rechtstreekse-verkiezing', { inverse: 'heeftLijst' })
rechtstreekseVerkiezing;

@hasMany('persoon', { inverse: 'isKandidaatVoor' }) kandidaten;

rdfaBindings = {
Expand Down
9 changes: 9 additions & 0 deletions app/models/lidmaatschap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Model, { attr, belongsTo } from '@ember-data/model';

export default class LidmaatschapModel extends Model {
@attr uri;

@belongsTo('fractie', { inverse: null }) binnenFractie;
@belongsTo('mandataris', { inverse: 'heeftLidmaatschap' }) lid;
@belongsTo('tijdsinterval', { inverse: null }) lidGedurende;
}
7 changes: 7 additions & 0 deletions app/models/lijsttype.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Model, { attr } from '@ember-data/model';

export default class LijsttypeModel extends Model {
@attr uri;
@attr label;
@attr scopeNote;
}
2 changes: 2 additions & 0 deletions app/models/mandaat.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import Model, { attr, belongsTo, hasMany } from '@ember-data/model';
export default class MandaatModel extends Model {
@attr uri;
@attr aantalHouders;

@belongsTo('bestuursfunctie-code', { inverse: null }) bestuursfunctie;

@hasMany('bestuursorgaan', { inverse: 'bevat' }) bevatIn;

rdfaBindings = {
Expand Down
1 change: 1 addition & 0 deletions app/models/mandataris-status-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ import Model, { attr } from '@ember-data/model';
export default class MandatarisStatusCodeModel extends Model {
@attr uri;
@attr label;
@attr scopeNote;
}
17 changes: 12 additions & 5 deletions app/models/mandataris.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,22 @@ export default class MandatarisModel extends Model {
@attr uri;
@attr('datetime') datumEedaflegging;
@attr('datetime') datumMinistrieelBesluit;
@attr generatedFrom;

@belongsTo('mandaat', { inverse: null }) bekleedt;
@belongsTo('lidmaatschap', { inverse: 'lid' }) heeftLidmaatschap;
@belongsTo('persoon', { inverse: 'isAangesteldAls' }) isBestuurlijkeAliasVan;
@hasMany('mandataris', { inverse: null }) tijdelijkeVervangingen;
@hasMany('behandeling-van-agendapunt') aanwezigBijBehandeling;
@hasMany('behandeling-van-agendapunt') afwezigBijBehandeling;
@hasMany('zitting') aanwezigBijZitting;
@hasMany('zitting') afwezigBijZitting;
@belongsTo('mandataris-status-code', { inverse: null }) status;

@hasMany('mandataris', { inverse: null }) tijdelijkeVervangingen;
@hasMany('beleidsdomein-code', { inverse: 'mandatarissen' }) beleidsdomein;
@hasMany('behandeling-van-agendapunt', { inverse: null })
aanwezigBijBehandeling;
@hasMany('behandeling-van-agendapunt', { inverse: null })
afwezigBijBehandeling;
@hasMany('zitting', { inverse: null }) aanwezigBijZitting;
@hasMany('zitting', { inverse: null }) afwezigBijZitting;

rdfaBindings = {
class: 'http://data.vlaanderen.be/ns/mandaat#Mandataris',
start: 'http://data.vlaanderen.be/ns/mandaat#start',
Expand Down
3 changes: 3 additions & 0 deletions app/models/persoon.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ export default class PersoonModel extends Model {
@attr achternaam;
@attr alternatieveNaam;
@attr gebruikteVoornaam;

@belongsTo('geboorte', { inverse: null }) geboorte;
@belongsTo('identificator', { inverse: null }) identificator;
@belongsTo('geslacht-code', { inverse: null }) geslacht;

@hasMany('mandataris', { inverse: 'isBestuurlijkeAliasVan' }) isAangesteldAls;
@hasMany('kandidatenlijst', { inverse: 'kandidaten' }) isKandidaatVoor;
@hasMany('verkiezingsresultaat', { inverse: null }) verkiezingsresultaten;
Expand Down
15 changes: 10 additions & 5 deletions app/models/published-resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@ export default class PublishedResourceModel extends Model {
@attr hashValue;
@attr('datetime') createdOn;
@attr submissionStatus;
@belongsTo('blockchain-status') status;
@belongsTo('gebruiker') gebruiker;
@belongsTo('versioned-agenda') versionedAgenda;
@belongsTo('versioned-besluiten-lijst') versionedBesluitenLijst;
@belongsTo('versioned-notulen') versionedNotulen;

@belongsTo('blockchain-status', { inverse: null }) status;
@belongsTo('gebruiker', { inverse: null }) gebruiker;
@belongsTo('agenda', { inverse: 'publishedResource' }) agenda;
@belongsTo('versioned-besluiten-lijst', { inverse: 'publishedResource' })
versionedBesluitenLijst;
@belongsTo('versioned-behandeling', { inverse: 'publishedResource' })
versionedBehandeling;
@belongsTo('versioned-notulen', { inverse: 'publishedResource' })
versionedNotulen;
}
3 changes: 3 additions & 0 deletions app/models/rechtstreekse-verkiezing.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import Model, { attr, belongsTo, hasMany } from '@ember-data/model';

export default class RechtstreekseVerkiezingModel extends Model {
@attr uri;
@attr('date') datum;
@attr('date') geldigheid;

@belongsTo('bestuursorgaan', { inverse: 'wordtSamengesteldDoor' }) steltSamen;

@hasMany('kandidatenlijst', { inverse: 'rechtstreekseVerkiezing' })
heeftLijst;
}
Loading