Beispiel #1
0
def finish(proofId):
    result = Proof.update(
        finished=True,
        proofId=proofId
    )

    return Schema().dump(result).data, 201
def create(invoiceId, body):
    request_body = RequestBody(body)
    result = InvoiceStationaryItem.create(
        invoiceId=invoiceId,
        stationaryItemId=request_body.get("stationaryItemId"))

    return Schema().dump(result).data, 201
def get_by_id(proofId):
    result = Proof.get_by_id(proofId=proofId)

    if result is None:
        raise NotFoundException("Proof not found. (proofId=%d)" % proofId)

    return Schema().dump(result).data
def create(body):
    request_body = RequestBody(body)
    election_name = request_body.get("electionName")
    election_template_name = request_body.get("electionTemplateName")

    files = connexion.request.files
    polling_stations_dataset = files.get("pollingStationsDataset")
    postal_counting_centres_dataset = files.get("postalCountingCentresDataset")
    party_candidates_dataset = files.get("partyCandidatesDataset")
    invalid_vote_categories_dataset = files.get("invalidVoteCategoriesDataset")
    number_of_seats_dataset_file = files.get("numberOfSeatsDataset")

    election = Election.create(
        electionTemplateName=election_template_name,
        electionName=election_name,
        isListed=True,
        party_candidate_dataset_file=party_candidates_dataset,
        polling_station_dataset_file=polling_stations_dataset,
        postal_counting_centers_dataset_file=postal_counting_centres_dataset,
        invalid_vote_categories_dataset_file=invalid_vote_categories_dataset,
        number_of_seats_dataset_file=number_of_seats_dataset_file)

    db.session.commit()

    return Schema().dump(election).data
def get_by_id(electionId):
    result = Election.get_by_id(electionId=electionId)
    if result is None:
        raise NotFoundException(message="Election not found (electionId=%d)" %
                                electionId,
                                code=MESSAGE_CODE_ELECTION_NOT_FOUND)

    return Schema().dump(result).data
Beispiel #6
0
def get_all(ballotId=None, ballotType=None, electionId=None):
    result = Ballot.get_all(
        ballotId=ballotId,
        ballotType=ballotType,
        electionId=electionId
    )

    return Schema(many=True).dump(result).data
Beispiel #7
0
def create(body):
    request_body = RequestBody(body)
    result = TallySheetVersion.create(
        tallySheetId=request_body.get("tallySheetId"))

    db.session.commit()

    return Schema().dump(result).data, 201
def get_by_id(proofId):
    result = Proof.get_by_id(proofId=proofId)

    if result is None:
        raise NotFoundException("Proof not found. (proofId=%d)" % proofId,
                                code=MESSAGE_CODE_PROOF_NOT_FOUND)

    return Schema().dump(result).data
def create(body):
    request_body = RequestBody(body)
    result = BallotBox.create(electionId=request_body.get("electionId"),
                              ballotBoxId=request_body.get("ballotBoxId"))

    db.session.commit()

    return Schema().dump(result).data, 201
def finish(proofId):
    result = Proof.update(
        finished=True,
        proofId=proofId
    )

    db.session.commit()

    return Schema().dump(result).data, 201
Beispiel #11
0
def upload_file(body):
    request_body = RequestBody(body)
    result = Proof.upload_file(
        proofId=request_body.get("proofId"),
        fileSource=connexion.request.files['scannedFile'],
        fileType=FileTypeEnum.Image
    )

    return Schema().dump(result).data, 201
def get_all(electionId=None,
            areaName=None,
            associatedAreaId=None,
            areaType=None):
    result = Area.get_all(election_id=electionId,
                          area_name=areaName,
                          associated_area_id=associatedAreaId,
                          area_type=get_area_type(area_type=areaType))

    return Schema(many=True).dump(result).data
Beispiel #13
0
def create(body):
    request_body = RequestBody(body)
    result = Model.create(
        electionId=request_body.get("electionId"),
        issuingOfficeId=request_body.get("issuingOfficeId"),
        receivingOfficeId=request_body.get("receivingOfficeId"),
        issuedTo=request_body.get("issuedTo"),
    )

    return Schema().dump(result).data
Beispiel #14
0
def get_all(electionId=None,
            officeName=None,
            parentOfficeId=None,
            officeType=None):
    result = Office.get_all(electionId=electionId,
                            officeName=officeName,
                            parentOfficeId=parentOfficeId,
                            officeType=officeType)

    return Schema(many=True).dump(result).data
def get_all(electionId=None,
            electorateName=None,
            parentElectorateId=None,
            electorateType=None):
    result = Electorate.get_all(electionId=electionId,
                                electorateName=electorateName,
                                parentElectorateId=parentElectorateId,
                                electorateType=electorateType)

    return Schema(many=True).dump(result).data
def receive(body):
    request_body = RequestBody(body)
    result = InvoiceStationaryItem.update(
        invoiceId=request_body.get("invoiceId"),
        stationaryItemId=request_body.get("stationaryItemId"),
        received=True,
        receivedFrom=request_body.get("receivedFrom"),
        receivedOfficeId=request_body.get("receivedOfficeId"),
        scannedImages=connexion.request.files['scannedImages'])

    return Schema().dump(result).data, 201
Beispiel #17
0
def get_all(electionId=None,
            issuingOfficeId=None,
            receivingOfficeId=None,
            issuedBy=None,
            issuedTo=None):
    result = Model.get_all(electionId=electionId,
                           issuingOfficeId=issuingOfficeId,
                           receivingOfficeId=receivingOfficeId,
                           issuedBy=issuedBy,
                           issuedTo=issuedTo)

    return Schema(many=True).dump(result).data
def _cache_get_all(user_access_area_ids,
                   parentElectionId=None,
                   rootElectionId=None,
                   isListed=None):
    if isListed == "false":
        isListed = False
    elif isListed == "true":
        isListed = True

    result = Election.get_all(parentElectionId=parentElectionId,
                              rootElectionId=rootElectionId,
                              isListed=isListed)

    return Schema(many=True).dump(result).data
def get_all(invoiceId,
            stationaryItemId=None,
            received=None,
            receivedFrom=None,
            receivedBy=None,
            receivedOffice=None):
    result = InvoiceStationaryItem.get_all(invoiceId=invoiceId,
                                           stationaryItemId=stationaryItemId,
                                           received=received,
                                           receivedFrom=receivedFrom,
                                           receivedBy=receivedBy,
                                           receivedOffice=receivedOffice)

    return Schema(many=True).dump(result).data
def create(body):
    request_body = RequestBody(body)
    election_name = request_body.get("electionName")

    files = connexion.request.files
    polling_stations_dataset = files.get("pollingStationsDataset")
    postal_counting_centres_dataset = files.get("postalCountingCentresDataset")
    party_candidates_dataset = files.get("partyCandidatesDataset")
    invalid_vote_categories_dataset = files.get("invalidVoteCategoriesDataset")

    election = Election.create(electionName=election_name)
    election.set_polling_stations_dataset(fileSource=polling_stations_dataset)
    election.set_postal_counting_centres_dataset(fileSource=postal_counting_centres_dataset)
    election.set_party_candidates_dataset(fileSource=party_candidates_dataset)
    election.set_invalid_vote_categories_dataset(fileSource=invalid_vote_categories_dataset)

    build_presidential_election(root_election=election)

    db.session.commit()

    return Schema().dump(election).data
Beispiel #21
0
def create(body):
    request_body = RequestBody(body)
    result = Ballot.create(electionId=request_body.get("electionId"),
                           ballotId=request_body.get("ballotId"))

    return Schema().dump(result).data, 201
def get_all(ballotBoxId):
    result = BallotBox.get_all(ballotBoxId=ballotBoxId)

    return Schema(many=True).dump(result).data
def getAll(electionId=None, officeId=None, tallySheetCode=None):
    result = TallySheet.get_all(electionId=electionId,
                                officeId=officeId,
                                tallySheetCode=tallySheetCode)

    return Schema(many=True).dump(result).data
def get_all():
    result = BallotBoxDomain.get_all()

    return Schema(many=True).dump(result).data
def get_by_id(invoiceId, stationaryItemId):
    result = InvoiceStationaryItem.get_by_id(invoiceId, stationaryItemId)

    return Schema().dump(result).data, 201
def get_all(ballotBoxId=None, electionId=None):
    result = BallotBox.get_all(ballotBoxId=ballotBoxId, electionId=electionId)

    return Schema(many=True).dump(result).data
def get_all():
    result = Proof.get_all()

    result = get_paginated_query(result).all()

    return Schema(many=True).dump(result).data
Beispiel #28
0
def get_all(ballotId=None):
    result = Ballot.get_all(ballotId=ballotId)

    return Schema(many=True).dump(result).data
def get_all():
    result = Election.get_all()

    return Schema(many=True).dump(result).data
Beispiel #30
0
def get_by_id(fileId):
    result = Model.get_by_id(fileId=fileId)

    return Schema().dump(result).data