コード例 #1
0
def getAll():
    """
        return all tally sheets
    """

    # Create the list of tally sheets from our data
    people = TallySheetVersion.query.all()

    # Serialize the data for the response
    person_schema = TallySheetVersionSchema(many=True)
    data = person_schema.dump(people).data
    return data
コード例 #2
0
def update(tallySheetId, body):
    """
        Append new version to the tally sheet.
    """
    # Get the tally sheet
    tallySheet = TallySheet.query.filter(
        TallySheet.tallySheetId == tallySheetId).one_or_none()

    if tallySheet is None:
        abort(
            404,
            "Tally Sheet not found for Id: {tallySheetId}".format(
                tallySheetId=tallySheetId),
        )

    create_tallysheet_version(body, tallySheet)

    schema = TallySheetVersionSchema()

    return schema.dump(new_tallysheet).data, 201