Skip to content

Commit

Permalink
Add missing subscription for meeting create (#2937)
Browse files Browse the repository at this point in the history
  • Loading branch information
reiterl authored Oct 26, 2023
1 parent a6e8d16 commit 015eb16
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { ViewProjection, ViewProjector, ViewProjectorCountdown, ViewProjectorMes
import { ViewUser } from './view-user';

export const MEETING_LIST_SUBSCRIPTION = `meeting_list`;
export const MEETING_CREATE_SUBSCRIPTION = `meeting_create`;

export enum RelatedTime {
Future = 1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { FULL_FIELDSET } from 'src/app/domain/fieldsets/misc';
import { SubscriptionConfigGenerator } from 'src/app/domain/interfaces/subscription-config';
import { MEETING_LIST_SUBSCRIPTION } from 'src/app/site/pages/meetings/view-models/view-meeting';
import {
MEETING_CREATE_SUBSCRIPTION,
MEETING_LIST_SUBSCRIPTION
} from 'src/app/site/pages/meetings/view-models/view-meeting';
import { ORGANIZATION_ID } from 'src/app/site/pages/organization/services/organization.service';
import { ViewOrganization } from 'src/app/site/pages/organization/view-models/view-organization';

Expand Down Expand Up @@ -36,6 +39,19 @@ export const getOrganizationSubscriptionConfig: SubscriptionConfigGenerator = ()
isDelayed: false
});

export const getMeetingCreateSubscriptionConfig: SubscriptionConfigGenerator = () => ({
modelRequest: {
viewModelCtor: ViewOrganization,
ids: [ORGANIZATION_ID],
follow: [
getMeetingCreateFollowConfig(`active_meeting_ids`),
getMeetingCreateFollowConfig(`archived_meeting_ids`),
getMeetingCreateFollowConfig(`template_meeting_ids`)
]
},
subscriptionName: MEETING_CREATE_SUBSCRIPTION
});

function getMeetingListFollowConfig(
idField: `active_meeting_ids` | `archived_meeting_ids` | `template_meeting_ids`
): any {
Expand All @@ -48,3 +64,13 @@ function getMeetingListFollowConfig(
fieldset: `list`
};
}

function getMeetingCreateFollowConfig(
idField: `active_meeting_ids` | `archived_meeting_ids` | `template_meeting_ids`
): any {
return {
idField: idField,
follow: [{ idField: `committee_id`, fieldset: `name` }],
fieldset: [`name`]
};
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component } from '@angular/core';
import { Id } from 'src/app/domain/definitions/key-types';
import { BaseModelRequestHandlerComponent } from 'src/app/site/base/base-model-request-handler.component';
import { getMeetingCreateSubscriptionConfig } from 'src/app/site/pages/organization/organization.subscription';

import { getCommitteeMeetingDetailSubscriptionConfig } from '../../../../../../committees.subscription';

Expand All @@ -15,4 +16,8 @@ export class CommitteeDetailMeetingMainComponent extends BaseModelRequestHandler
this.subscribeTo(getCommitteeMeetingDetailSubscriptionConfig(id), { hideWhenDestroyed: true });
}
}

protected override onShouldCreateModelRequests(): void {
this.subscribeTo(getMeetingCreateSubscriptionConfig());
}
}

0 comments on commit 015eb16

Please sign in to comment.