SubmissionController - applebiter/gnatwriter GitHub Wiki

Submission controller encapsulates story submission management functionality.

create_submission()

create_submission(
    story_id: int, submitted_to: str, date_sent: str = None,
    date_reply_received: str = None, date_published: str = None, 
    date_paid: str = None, result: str = None, amount: float = None
) -> Submission

Takes a Story id and a string representing the publisher to whom the submission was made. Returns the new Submission.

update_submission()

update_submission(
    submission_id: int, submitted_to: str, date_sent: str,
    date_reply_received: str = None, date_published: str = None, 
    date_paid: str = None, result: str = None, 
    amount: float = None
) -> Type[Submission]

Takes a Submission id and accepts any of Submission attributes with new values. Returns the updated Submission.

delete_submission_by_id()

delete_submission_by_id(submission_id: int) -> bool

Takes a Submission id and returns True if the specified Submission is deleted from the database.

get_submission_by_id()

get_submission_by_id(submission_id: int) -> Type[Submission]

Takes a Submission id and returns the specified Submission.

get_all_submissions()

get_all_submissions() -> List[Type[Submission]]

Returns all Submissions associated with any Story belonging to the user, if any.

get_all_submissions_page()

get_all_submissions_page(page: int, per_page: int) -> List[Type[Submission]]

Takes a page number and an integer representing how many Submissions to return per page of results. Returns a list containing that page's Submissions.

get_submissions_by_story_id()

get_submissions_by_story_id(story_id: int) -> List[Type[Submission]]

Takes a Story id and returns a list of all associated Submissions, if any.

get_submissions_page_by_story_id()

get_submissions_page_by_story_id(
    story_id: int, page: int, per_page: int
) -> List[Type[Submission]]

Takes a Story id, a page number, and an integer describing how many Submissions to return per page of results. Returns a list containing that page's corresponding Submissions.