mbari-org / oni

Organism Naming Infrastructure
https://mbari-org.github.io/oni/
0 stars 0 forks source link

Implement all history related actions #2

Closed hohonuuli closed 2 weeks ago

hohonuuli commented 3 weeks ago

Implement the following:

hohonuuli commented 2 weeks ago

Add concept ✅

sequenceDiagram
   participant U as User
   participant S as ConceptService
   participant D as Database
   participant P as ParentConcept
   participant C as ChildConcept
   participant H as History

   U->>S: Add concept
   S->>+S: Find parent concept by name
   S->>C: Create child concept
   S->>P: Add child to parent
   S->>H: Create history
   S->>P: Add History to Parent
   alt User is admin
        S->>H: Mark history as approved
   else

   end
   S-->>-U: Return ConceptMetadata (for Child)

   U->>+S: Approve
   alt User is admin
        S->>H: Mark history as approved
   else
   end
   S-->>-U: Return ExtendedHistory

   U->>+S: Reject
   alt User is admin
        S->>S: Look up parent
        S->>P: Filter parent's children to find child
        S->>C: cascade delete child 
        S->>H: Mark history as rejected
   else

   end
   S-->>-U: Return ExtendedHistory
Column Value
Field Concept.child
Old Value null
NewValue Lampocteis sp. A
Action Add
hohonuuli commented 2 weeks ago

Add ConceptName

For non-primary name

Column Value
Field ConceptName
Old Value null
NewValue Lampocteis sp. A
Action Add

For Primary name

This action replaces the existing primary name. The existing primary name is kept as former, but we can't rely on that being present as it could be deleted by someone later on.

Column Value
Field ConceptName
Old Value Foo
NewValue Bar
Action Add