Skip to content
Michael J. Giarlo edited this page Dec 2, 2020 · 10 revisions

Welcome to the happy-heron ("H2") wiki! This is where we put developer-focused documentation.

State machine diagrams

State machine diagrams for collections and works live in the application repository:

Collections

Collections

Works

Works

Updates

To keep these up to date, run the following command and commit the resulting changes whenever the state machines change:

$ bin/rake state_machines:draw CLASS=Work,Collection

Complete deposits locally

Completing a deposit of a work or a collection in H2 requires SDR integration, which we don't have when doing development locally. (We could add sdr-api in docker-compose.yml, but then we need dor-services-app, workflow-service, fedora, etc. etc., so it would very quickly become heavier than we want.) It's still useful to simulate completion of deposits. Here's how to do that:

# Make sure to have the object ID (the database ID, an integer), e.g.:
id = 123
# Make up a druid too, e.g.:
druid = 'druid:bc123df4567'

# This simulates what's done in the DepositStatusJob when we receive a response from sdr-api
object = Work.find(id) # or Collection.find(id)
object.druid = druid
object.add_purl_to_citation # if it's a Work
object.deposit_complete!

You may wish to check the latest definition of DepositStatusJob#complete_deposit to confirm this documentation hasn't gotten stale. If it has, please update it.

Remote form validation (Stimulus, XHR, and server-based validations)

  • Naming conventions (from snake_case Rails models to kebab-case in Stimulus-land), documenting that we take whatever Rails gives us, translate it to Stimulus
  • Where to declare validations in the app (forms, models, how to decide). Presence validation in the forms. Format validation in the models. Why? Allow drafts to be saved without required fields for deposit, but don't allow garbage values.
  • Stimulus 101 (controllers, targets, actions)
  • Remote forms 101 (submitting via XHR, + using stimulus hooks to retrieve and parse responses)
  • Example PRs: