Skip to content

Commit

Permalink
New organizationId property in PublishedElection
Browse files Browse the repository at this point in the history
  • Loading branch information
marcvelmer committed Mar 8, 2023
1 parent 0ca886d commit 0a953ca
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- `fetchElections` function to fetch all elections based on a given account
- New `organizationId` property in `PublishedElection`

### Changed

Expand Down
5 changes: 5 additions & 0 deletions src/api/election.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ export interface IElectionInfoResponse {
*/
electionId: string;

/**
* The id of the organization that created the election
*/
organizationId: string;

/**
* The status of the election
*/
Expand Down
1 change: 1 addition & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ export class VocdoniSDKClient {
.then((censusInfo) =>
PublishedElection.build({
id: electionInfo.electionId,
organizationId: electionInfo.organizationId,
title: electionInfo.metadata.title,
description: electionInfo.metadata.description,
header: electionInfo.metadata.media.header,
Expand Down
7 changes: 7 additions & 0 deletions src/types/election/published.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { ElectionStatus } from '../../core/election';

export interface IPublishedElectionParameters extends IElectionParameters {
id: string;
organizationId: string;
status: ElectionStatus;
voteCount: number;
finalResults: boolean;
Expand All @@ -21,6 +22,7 @@ export interface IPublishedElectionParameters extends IElectionParameters {
*/
export class PublishedElection extends Election {
private readonly _id: string;
private readonly _organizationId: string;
private readonly _status: ElectionStatus;
private readonly _voteCount: number;
private readonly _finalResults: boolean;
Expand Down Expand Up @@ -49,6 +51,7 @@ export class PublishedElection extends Election {
census: params.census,
});
this._id = params.id;
this._organizationId = params.organizationId;
this._status = params.status;
this._voteCount = params.voteCount;
this._finalResults = params.finalResults;
Expand Down Expand Up @@ -112,6 +115,10 @@ export class PublishedElection extends Election {
return this._id;
}

get organizationId(): string {
return this._organizationId;
}

get status(): ElectionStatus {
return this._status;
}
Expand Down

0 comments on commit 0a953ca

Please sign in to comment.