Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Role based External Documents #2521

Merged
merged 22 commits into from
Jul 1, 2024

Conversation

timyates
Copy link
Collaborator

@timyates timyates commented Jun 21, 2024

This is the backend and simple readonly front-end required for #1656

the front end was done in #2522 and merged in to here

Schema

erDiagram
    DOCUMENT {
        UUID document_id PK
        string name "unique"
        string URL "unique"
        string description "optional"
    }
   ROLE_DOCUMENT {
       UUID role_id PK
       UUID document_id PK
       int display_order "the order for documents assigned to a role"
   }
Loading

DTO format

DocumentCreateDTO

{
  "name": "string",
  "url": "string",
  "description": "string"
}

Note

name and url must be unique across all documents, and description is optional

DocumentResponseDTO

  {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "name": "string",
    "url": "string",
    "description": "string"
  }

Note

description may be null

Endpoints

GET /services/document -- List all documents.

  • Auth None
  • Returns list of DocumentResponseDTO ordered by name

GET /services/document/{role_id} -- List documents assigned to a role

  • Auth None
  • Returns list of DocumentResponseDTO assigned to the given role_id, ordered by the display_order in the database

POST /services/document -- Create a document

  • Permission CAN_ADMINISTER_DOCUMENTATION required
  • Expects a DocumentCreateDTO as the body
  • Name and URL must be unique
  • Responds with the created document

PUT /services/document/{documentId} -- Update a document

  • Permission CAN_ADMINISTER_DOCUMENTATION required
  • Expects a DocumentCreateDTO as the body
  • Name and URL must be unique
  • Responds with the updated document

DELETE /services/document/{documentId} -- Delete a document

  • Permission CAN_ADMINISTER_DOCUMENTATION required
  • Document must be first removed from all Role associations

POST /services/document/{role_id} -- Set the list of documents for a role

  • Permission CAN_ADMINISTER_DOCUMENTATION required
  • Expects a list of UUID strings as the body (these are document ids)
  • This may be an empty list to clear the documents
  • The order of the documents in the list will be their display order.
  • Duplicate document ids are ignored
  • Returns list of DocumentResponseDTO assigned to the given role_id, ordered by the display_order in the database

@timyates timyates self-assigned this Jun 21, 2024
@timyates timyates changed the title Add Role based External Documents backend: Add Role based External Documents Jun 21, 2024
Copy link
Collaborator

@vhscom vhscom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic!

@timyates timyates changed the title backend: Add Role based External Documents Add Role based External Documents Jun 25, 2024
@mkimberlin mkimberlin merged commit 3a44c67 into develop Jul 1, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants