elikem / my-story-booklet-v2

0 stars 0 forks source link

README

User

# Table name: users
#
#  id                     :bigint           not null, primary key
#  country_of_residence   :string
#  email                  :string           default(""), not null
#  first_name             :string
#  languages_spoken       :text             default([]), is an Array
#  last_name              :string

We capture basic demographic information the user. Name(s), the language they speak and where they reside. In the future a username is necessary to provide profile pages.

Story

# Table name: stories
#
#  id         :bigint           not null, primary key
#  content    :text
#  language   :string
#  status     :string
#  title      :string
#  user_id    :bigint

A user can have several stories. A story represents content for a booklet in a language. You cannot have more than one story share the same language. There's a future where we will support other booklets and languages.

Publication Lifecycle

# Table name: publications
#
#  id                 :bigint           not null, primary key
#  publication_number :string
#  publication_status :text             default([]), is an Array
#  story_id           :bigint

When you create a story, you have to publish it in order to generate a PDF. There are several steps in the publishing lifecycle.

The process begins with a GET request on the Stories Controller. This request takes the story and publication and passes it on to Story Model's publish method.

In summary, the publish method will take user's story and create an IDML file that is consumed by a companion application that converts the IDML file into a PDF and then shared with the user.

At the end of each step, the publication_status on the publication is updated to reflect the completion of that step.

The final step is a GET request to the companion app (to inform a pdf ready for conversion)...i.e. /start-pdf-conversion-process.

Interactions between (companion)[] and the (core)[] app

After Step 7, in the create_idml method (See publication.rb), we call post_idml_publication_to_companion to post the publication object the companion.

The companion app will trigger a process after insertion to download the idml file into the hot folder for conversion.

Code Annotations

rake annotate_models

rake annotate_routes

Code linting

rufo .

Rails notification and messages

// Display a warning toast, with no title
toastr.warning('My name is Inigo Montoya. You killed my father, prepare to die!')

// Display a success toast, with a title
toastr.success('Have fun storming the castle!', 'Miracle Max Says')

// Display an error toast, with a title
toastr.error('I do not think that word means what you think it means.', 'Inconceivable!')

// Immediately remove current toasts without using animation
toastr.remove()

// Remove current toasts using animation
toastr.clear()

// Override global options
toastr.success('We do have the Kapua suite available.', 'Turtle Bay Resort', {timeOut: 5000})