diff --git a/client/src/app/domain/models/meeting-users/meeting-user.ts b/client/src/app/domain/models/meeting-users/meeting-user.ts index 29169c6bf1..c3743d54f4 100644 --- a/client/src/app/domain/models/meeting-users/meeting-user.ts +++ b/client/src/app/domain/models/meeting-users/meeting-user.ts @@ -18,6 +18,7 @@ export class MeetingUser extends BaseDecimalModel { public vote_delegated_to_id!: Id; // meeting_user/vote_delegations_from_ids; + public poll_voted_ids: Id[]; public group_ids!: Id[]; // (group/meeting_user_ids)[]; public speaker_ids!: Id[]; // (speaker/meeting_user_id)[]; public personal_note_ids!: Id[]; // (personal_note/meeting_user_id)[]; @@ -52,6 +53,7 @@ export class MeetingUser extends BaseDecimalModel { `assignment_candidate_ids`, `vote_delegated_to_id`, `vote_delegations_from_ids`, + `poll_voted_ids`, `chat_message_ids`, `group_ids`, `structure_level_ids` diff --git a/client/src/app/domain/models/meetings/meeting.ts b/client/src/app/domain/models/meetings/meeting.ts index d01d8dd3f8..a831ee40eb 100644 --- a/client/src/app/domain/models/meetings/meeting.ts +++ b/client/src/app/domain/models/meetings/meeting.ts @@ -4,7 +4,8 @@ import { HasProperties } from '../../interfaces/has-properties'; import { AgendaItemCreation, AgendaItemType } from '../agenda/agenda-item'; import { BaseModel } from '../base/base-model'; import { ChangeRecoMode, LineNumberingMode } from '../motions/motions.constants'; -import { PollBackendDurationType, PollMethod, PollPercentBase, PollType } from '../poll/poll-constants'; +import { PollVisibility } from '../poll'; +import { BaseOnehundredPercentBase } from '../poll/poll-config-types'; import { ApplauseType } from './applause'; import { BallotPaperSelection, @@ -146,11 +147,9 @@ export class Settings { public motion_poll_ballot_paper_selection!: BallotPaperSelection; public motion_poll_ballot_paper_number!: number; - public motion_poll_default_type!: PollType; - public motion_poll_default_onehundred_percent_base!: PollPercentBase; + public motion_poll_default_type!: PollVisibility; + public motion_poll_default_onehundred_percent_base!: BaseOnehundredPercentBase; public motion_poll_default_group_ids!: Id[]; // (group/used_as_motion_poll_default_id)[]; - public motion_poll_default_backend!: PollBackendDurationType; - public motion_poll_default_method!: PollMethod; public motion_poll_projection_name_order_first!: `first_name` | `last_name`; public motion_poll_projection_max_columns!: number; @@ -182,11 +181,9 @@ export class Settings { public assignment_poll_add_candidates_to_list_of_speakers!: boolean; public assignment_poll_enable_max_votes_per_option!: boolean; public assignment_poll_sort_poll_result_by_votes!: boolean; - public assignment_poll_default_type!: PollType; - public assignment_poll_default_method!: PollMethod; - public assignment_poll_default_onehundred_percent_base!: PollPercentBase; + public assignment_poll_default_type!: PollVisibility; + public assignment_poll_default_onehundred_percent_base!: BaseOnehundredPercentBase; public assignment_poll_default_group_ids!: Id[]; // (group/used_as_assignment_poll_default_id)[]; - public assignment_poll_default_backend!: PollBackendDurationType; // topic poll public topic_poll_default_group_ids: Id[]; // (group/used_as_poll_default_id)[]; @@ -195,11 +192,9 @@ export class Settings { public poll_ballot_paper_selection: BallotPaperSelection; public poll_ballot_paper_number: number; public poll_sort_poll_result_by_votes: boolean; - public poll_default_type: PollType; - public poll_default_method: PollMethod; - public poll_default_onehundred_percent_base: PollPercentBase; + public poll_default_type: PollVisibility; + public poll_default_onehundred_percent_base: BaseOnehundredPercentBase; public poll_default_group_ids: Id[]; // (group/used_as_poll_default_id)[]; - public poll_default_backend: PollBackendDurationType; public poll_default_live_voting_enabled: boolean; // SSO @@ -412,14 +407,10 @@ export class Meeting extends BaseModel { `motion_poll_ballot_paper_selection`, `motion_poll_ballot_paper_number`, `motion_poll_default_type`, - `motion_poll_default_method`, `motion_poll_default_onehundred_percent_base`, `motion_poll_default_group_ids`, - `motion_poll_default_backend`, `motion_poll_projection_name_order_first`, `motion_poll_projection_max_columns`, - `poll_candidate_list_ids`, - `poll_candidate_ids`, `meeting_user_ids`, `users_enable_presence_view`, `users_enable_vote_weight`, @@ -446,18 +437,14 @@ export class Meeting extends BaseModel { `assignment_poll_enable_max_votes_per_option`, `assignment_poll_sort_poll_result_by_votes`, `assignment_poll_default_type`, - `assignment_poll_default_method`, `assignment_poll_default_onehundred_percent_base`, `assignment_poll_default_group_ids`, - `assignment_poll_default_backend`, `poll_ballot_paper_selection`, `poll_ballot_paper_number`, `poll_sort_poll_result_by_votes`, `poll_default_type`, - `poll_default_method`, `poll_default_onehundred_percent_base`, `poll_default_group_ids`, - `poll_default_backend`, `poll_default_live_voting_enabled`, `topic_poll_default_group_ids`, `projector_ids`, @@ -488,8 +475,6 @@ export class Meeting extends BaseModel { `motion_change_recommendation_ids`, `motion_state_ids`, `poll_ids`, - `option_ids`, - `vote_ids`, `assignment_ids`, `assignment_candidate_ids`, `personal_note_ids`, diff --git a/client/src/app/domain/models/poll-candidate-lists/poll-candidate-list.ts b/client/src/app/domain/models/poll-candidate-lists/poll-candidate-list.ts deleted file mode 100644 index fbfeff3909..0000000000 --- a/client/src/app/domain/models/poll-candidate-lists/poll-candidate-list.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Id } from '../../definitions/key-types'; -import { HasMeetingId } from '../../interfaces'; -import { BaseModel } from '../base/base-model'; - -export class PollCandidateList extends BaseModel { - public static COLLECTION = `poll_candidate_list`; - - public option_id!: Id; // option/content_object_id; - public poll_candidate_ids!: Id[]; // poll_candidate/poll_candidate_list_id; - - public constructor(input?: any) { - super(PollCandidateList.COLLECTION, input); - } - - public static readonly REQUESTABLE_FIELDS: (keyof PollCandidateList)[] = [ - `id`, - `poll_candidate_ids`, - `meeting_id`, - `option_id` - ]; -} -export interface PollCandidateList extends HasMeetingId {} diff --git a/client/src/app/domain/models/poll-candidate-lists/poll-candidate.ts b/client/src/app/domain/models/poll-candidate-lists/poll-candidate.ts deleted file mode 100644 index 5b879d2774..0000000000 --- a/client/src/app/domain/models/poll-candidate-lists/poll-candidate.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Id } from '../../definitions/key-types'; -import { HasMeetingId } from '../../interfaces'; -import { BaseModel } from '../base/base-model'; - -export class PollCandidate extends BaseModel { - public static COLLECTION = `poll_candidate`; - - public weight!: number; - - public poll_candidate_list_id!: Id; // poll_candidate_list/poll_candidate_ids; - public user_id!: Id; // user/poll_candidate_ids; - - public constructor(input?: any) { - super(PollCandidate.COLLECTION, input); - } - - public static readonly REQUESTABLE_FIELDS: (keyof PollCandidate)[] = [ - `id`, - `poll_candidate_list_id`, - `user_id`, - `weight`, - `meeting_id` - ]; -} -export interface PollCandidate extends HasMeetingId {} diff --git a/client/src/app/domain/models/poll/ballot.ts b/client/src/app/domain/models/poll/ballot.ts new file mode 100644 index 0000000000..343f5ee6f7 --- /dev/null +++ b/client/src/app/domain/models/poll/ballot.ts @@ -0,0 +1,41 @@ +import { Id } from '../../definitions/key-types'; +import { HasMeetingId } from '../../interfaces'; +import { BaseModel } from '../base/base-model'; +import { VoteValue, VoteValueVerbose } from './vote-constants'; + +export class Ballot extends BaseModel { + public static COLLECTION = `ballot`; + + public weight: number; + public split: boolean; + public value: VoteValue; + + public poll_id!: Id; + public acting_meeting_user_id: Id; + public represented_meeting_user_id: Id; + + public get valueVerbose(): string { + return VoteValueVerbose[this.value]; + } + + public constructor(input?: Partial) { + super(Ballot.COLLECTION, input); + } + + protected getDecimalFields(): string[] { + return [`weight`]; + } + + public static readonly REQUESTABLE_FIELDS: (keyof Ballot)[] = [ + `id`, + `weight`, + `split`, + `value`, + `meeting_id`, + `poll_id`, + `acting_meeting_user_id`, + `represented_meeting_user_id` + ]; +} + +export interface Ballot extends HasMeetingId {} diff --git a/client/src/app/domain/models/poll/base-poll-config.ts b/client/src/app/domain/models/poll/base-poll-config.ts new file mode 100644 index 0000000000..0b4fa7c023 --- /dev/null +++ b/client/src/app/domain/models/poll/base-poll-config.ts @@ -0,0 +1,6 @@ +import { Id } from '../../definitions/key-types'; +import { BaseModel } from '../base/base-model'; + +export abstract class BasePollConfigModel extends BaseModel { + public poll_id!: Id; +} diff --git a/client/src/app/domain/models/poll/generic-poll.ts b/client/src/app/domain/models/poll/generic-poll.ts index b35cdefc33..55cb09439a 100644 --- a/client/src/app/domain/models/poll/generic-poll.ts +++ b/client/src/app/domain/models/poll/generic-poll.ts @@ -1,11 +1,7 @@ -import { Observable } from 'rxjs'; import { ViewTopic } from 'src/app/site/pages/meetings/pages/agenda'; import { ViewAssignment } from 'src/app/site/pages/meetings/pages/assignments'; import { ViewMotion } from 'src/app/site/pages/meetings/pages/motions'; -import { ViewPollCandidateList } from 'src/app/site/pages/meetings/pages/polls/view-models/view-poll-candidate-list'; -import { ViewUser } from 'src/app/site/pages/meetings/view-models/view-user'; - -import { EntitledUsersEntry, PollClassType, PollMethod, PollPercentBase, PollState, PollType } from './poll-constants'; +import { ViewMeetingUser } from 'src/app/site/pages/meetings/view-models/view-meeting-user'; export type PollContentObject = ViewAssignment | ViewMotion | ViewTopic; @@ -14,27 +10,6 @@ export type PollContentObject = ViewAssignment | ViewMotion | ViewTopic; * This is a unification of the data received in the projector and ViewPoll; both * use this interface, so the poll services can work on this shared view on the data. */ -export interface PollData { - pollClassType?: PollClassType; - pollmethod: PollMethod; - state: PollState; - onehundred_percent_base: PollPercentBase; - votesvalid: number; - votesinvalid: number; - votescast: number; - type: PollType; - entitled_users_at_stop: EntitledUsersEntry[]; - options: OptionData[]; - options$: Observable; - global_option: OptionData; - global_yes?: boolean; - global_no?: boolean; - global_abstain?: boolean; - content_object?: PollContentObject; - getContentObjectTitle: () => string | null; -} - -export type PollDataKey = keyof PollData; export interface OptionTitle { title: string; @@ -53,7 +28,8 @@ export interface OptionData { amount_global_yes?: number; amount_global_no?: number; amount_global_abstain?: number; - content_object?: ViewUser | ViewMotion | ViewPollCandidateList; + meeting_user?: ViewMeetingUser; + text?: string; entries_amount?: number; } diff --git a/client/src/app/domain/models/poll/index.ts b/client/src/app/domain/models/poll/index.ts index 316a36a5fe..a379463e24 100644 --- a/client/src/app/domain/models/poll/index.ts +++ b/client/src/app/domain/models/poll/index.ts @@ -1,6 +1,5 @@ +export * from './ballot'; export * from './generic-poll'; -export * from './option'; export * from './poll'; export * from './poll-constants'; -export * from './vote'; export * from './vote-constants'; diff --git a/client/src/app/domain/models/poll/option.ts b/client/src/app/domain/models/poll/option.ts deleted file mode 100644 index afd8cd32dc..0000000000 --- a/client/src/app/domain/models/poll/option.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Fqid, Id, Ids } from '../../definitions/key-types'; -import { BaseDecimalModel } from '../base/base-decimal-model'; - -export class Option extends BaseDecimalModel