eclipse-tractusx / ssi-credential-issuer

SSI Credential Issuer
Apache License 2.0
3 stars 9 forks source link

DB Documentation Improvement #167

Closed jjeroch closed 2 weeks ago

jjeroch commented 5 months ago

Enhancement of the documentation of https://github.com/eclipse-tractusx/ssi-credential-issuer/blob/main/docs/database/db-view.md needed.

...more to be added....note the current content of the ticket only describes the immediate identified missing details - not all > topics which need to get added. To be explored by developer and PO

#### Attributes:

- `id` (SERIAL): A unique identifier for the document. This is the primary key of the table.
- `name` (VARCHAR(255)): The name of the document. This field is required and cannot be null.
- `content` (BYTEA): The binary content of the document. This field is required and cannot be null.
- `hash` (BYTEA): A hash of the document content, used for verification purposes. This field is required and cannot be null.
- `media_type_id` (INT): An identifier for the media type of the document. This field is required and cannot be null.
- `document_type_id` (document_type_id): An enumeration that specifies the type of the document. This field is required and cannot be null.
- `created_at` (TIMESTAMP): The timestamp when the document was created. It defaults to the current timestamp at the time of document creation.
- `updated_at` (TIMESTAMP): The timestamp when the document was last updated. It defaults to the current timestamp at the time of the update.

## Enumeration Types

### `document_type_id`

An enumeration type that defines the possible categories for documents in the `documents` table.

#### Possible Values:

- `PRESENTATION`: Represents a presentation document uploaded by the customer/requester to present a proof of certification etc.
- `CREDENTIAL`: Represents a credential document created by the issuer (unsigned).
- `VERIFIED_CREDENTIAL`: Represents a verified credential document (signed by the issuer wallet and official credential document).

## Relationships

- Each document in the `documents` table can be associated to only one company SSI detail records through the `document_company_ssi_details` table. // @Phil91  please check once if this is implemented like described
- The `document_id` in the `document_company_ssi_details` table is a foreign key that references the `id` in the `documents` table.

## Notes

- The `media_type_id` attribute in the `documents` table should correspond to a valid media type defined elsewhere in the database or application logic.
- The `document_type_id` enumeration should be kept up-to-date with any changes to the types of documents that the system needs to handle.
- Timestamps are automatically managed by the database to ensure accuracy in creation and modification times.