objectcomputing / check-ins

Other
7 stars 7 forks source link

Add Role based External Documents #2521

Open timyates opened 1 week ago

timyates commented 1 week ago

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

the front end was done in https://github.com/objectcomputing/check-ins/pull/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"
   }

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.

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

POST /services/document -- Create a document

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

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

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