Skip to content

Commit

Permalink
docs: update db-view.md (#244)
Browse files Browse the repository at this point in the history
Reviewed-By: Phil Schneider <[email protected]>
  • Loading branch information
MaximilianHauer authored Sep 2, 2024
1 parent e41722a commit e34f7ee
Showing 1 changed file with 93 additions and 94 deletions.
187 changes: 93 additions & 94 deletions docs/database/db-view.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,13 @@ The database is organized into several key tables, each serving a specific purpo

### COMPANY_SSI_DETAIL_ASSIGNED_DOCUMENTS

document_id (UUID): A unique identifier for the document. This is a primary key and a foreign key referencing id in the DOCUMENTS table.
company_ssi_detail_id (UUID): A unique identifier for the company SSI detail. This is a primary key and a foreign key referencing id in the COMPANY_SSI_DETAILS table.
- **document_id (UUID)**: A unique identifier for the document. This is a primary key and a foreign key referencing `id` in the `DOCUMENTS` table.
- **company_ssi_detail_id (UUID)**: A unique identifier for the company SSI detail. This is a primary key and a foreign key referencing `id` in the `COMPANY_SSI_DETAILS` table.

### COMPANY_SSI_DETAIL_STATUSES

id (INTEGER): A unique identifier for the status. This is the primary key of the table.
label (TEXT): The label of the status.
- **id (INTEGER)**: A unique identifier for the status. This is the primary key of the table.
- **label (TEXT)**: The label of the status.

#### Possible Values

Expand All @@ -220,92 +220,91 @@ label (TEXT): The label of the status.

### COMPANY_SSI_DETAILS

id (UUID): A unique identifier for the company SSI detail. This is the primary key of the table.
bpnl (TEXT): The BP number of the company.
issuer_bpn (TEXT): The BP number of the issuer.
verified_credential_type_id (INTEGER): A foreign key referencing id in the VERIFIED_CREDENTIAL_TYPES table.
company_ssi_detail_status_id (INTEGER): A foreign key referencing id in the COMPANY_SSI_DETAIL_STATUSES table.
date_created (TIMESTAMP): The timestamp when the company SSI detail was created.
creator_user_id (TEXT): The user ID of the creator.
expiry_date (TIMESTAMP): The expiry date of the company SSI detail.
verified_credential_external_type_detail_version_id (UUID): A foreign key referencing id in the VERIFIED_CREDENTIAL_EXTERNAL_TYPE_DETAIL_VERSIONS table.
expiry_check_type_id (INTEGER): A foreign key referencing id in the EXPIRY_CHECK_TYPES table.
process_id (UUID): A foreign key referencing id in the PROCESSES table.
external_credential_id (UUID): A unique identifier for the external credential.
credential (TEXT): The credential information.
date_last_changed (TIMESTAMP): The timestamp when the company SSI detail was last changed.
last_editor_id (TEXT): The user ID of the last editor.
- **id (UUID)**: A unique identifier for the company SSI detail. This is the primary key of the table.
- **bpnl (TEXT)**: The BP number of the company.
- **issuer_bpn (TEXT)**: The BP number of the issuer.
- **verified_credential_type_id (INTEGER)**: A foreign key referencing `id` in the `VERIFIED_CREDENTIAL_TYPES` table.
- **company_ssi_detail_status_id (INTEGER)**: A foreign key referencing `id` in the `COMPANY_SSI_DETAIL_STATUSES` table.
- **date_created (TIMESTAMP)**: The timestamp when the company SSI detail was created.
- **creator_user_id (TEXT)**: The user ID of the creator.
- **expiry_date (TIMESTAMP)**: The expiry date of the company SSI detail.
- **verified_credential_external_type_detail_version_id (UUID)**: A foreign key referencing `id` in the `VERIFIED_CREDENTIAL_EXTERNAL_TYPE_DETAIL_VERSIONS` table.
- **expiry_check_type_id (INTEGER)**: A foreign key referencing `id` in the `EXPIRY_CHECK_TYPES` table.
- **process_id (UUID)**: A foreign key referencing `id` in the `PROCESSES` table.
- **external_credential_id (UUID)**: A unique identifier for the external credential.
- **credential (TEXT)**: The credential information.
- **date_last_changed (TIMESTAMP)**: The timestamp when the company SSI detail was last changed.
- **last_editor_id (TEXT)**: The user ID of the last editor.

### COMPANY_SSI_PROCESS_DATA

company_ssi_detail_id (UUID): A unique identifier for the company SSI detail. This is the primary key and a foreign key referencing id in the COMPANY_SSI_DETAILS table.
schema (JSONB): The schema of the credential.
credential_type_kind_id (INTEGER): A foreign key referencing id in the VERIFIED_CREDENTIAL_TYPE_KINDS table.
client_id (TEXT): The client ID.
client_secret (BYTEA): The client secret.
initialization_vector (BYTEA): The initialization vector for encryption.
encryption_mode (INTEGER): The encryption mode.
holder_wallet_url (TEXT): The URL of the holder's wallet.
callback_url (TEXT): The callback URL.
- **company_ssi_detail_id (UUID)**: A unique identifier for the company SSI detail. This is the primary key and a foreign key referencing `id` in the `COMPANY_SSI_DETAILS` table.
- **schema (JSONB)**: The schema of the credential.
- **credential_type_kind_id (INTEGER)**: A foreign key referencing `id` in the `VERIFIED_CREDENTIAL_TYPE_KINDS` table.
- **client_id (TEXT)**: The client ID.
- **client_secret (BYTEA)**: The client secret.
- **initialization_vector (BYTEA)**: The initialization vector for encryption.
- **encryption_mode (INTEGER)**: The encryption mode.
- **holder_wallet_url (TEXT)**: The URL of the holder's wallet.
- **callback_url (TEXT)**: The callback URL.

### DOCUMENT_STATUS

id (INTEGER): A unique identifier for the document status. This is the primary key of the table.
label (TEXT): The label of the document status.
DOCUMENT_TYPES
- **id (INTEGER)**: A unique identifier for the document status. This is the primary key of the table.
- **label (TEXT)**: The label of the document status.

#### Possible Values
#### DOCUMENT_STATUS - Possible Values

- `ACTIVE`: The document is active.
- `INACTIVE`: The document is inactive.

### DOCUMENT_TYPES

id (INTEGER): A unique identifier for the document type. This is the primary key of the table.
label (TEXT): The label of the document type.
- **id (INTEGER)**: A unique identifier for the document type. This is the primary key of the table.
- **label (TEXT)**: The label of the document type.

#### Possible Values
#### DOCUMENT_TYPES - 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).

### DOCUMENTS

id (UUID): A unique identifier for the document. This is the primary key of the table.
date_created (TIMESTAMP): The timestamp when the document was created.
document_hash (BYTEA): The hash of the document content for verification.
document_content (BYTEA): The binary content of the document.
document_name (TEXT): The name of the document.
media_type_id (INTEGER): A foreign key referencing id in the MEDIA_TYPES table.
document_type_id (INTEGER): A foreign key referencing id in the DOCUMENT_TYPES table.
document_status_id (INTEGER): A foreign key referencing id in the DOCUMENT_STATUS table.
identity_id (TEXT): The identity ID associated with the document.
date_last_changed (TIMESTAMP): The timestamp when the document was last changed.
last_editor_id (TEXT): The user ID of the last editor.
- **id (UUID)**: A unique identifier for the document. This is the primary key of the table.
- **date_created (TIMESTAMP)**: The timestamp when the document was created.
- **document_hash (BYTEA)**: The hash of the document content for verification.
- **document_content (BYTEA)**: The binary content of the document.
- **document_name (TEXT)**: The name of the document.
- **media_type_id (INTEGER)**: A foreign key referencing `id` in the `MEDIA_TYPES` table.
- **document_type_id (INTEGER)**: A foreign key referencing `id` in the `DOCUMENT_TYPES` table.
- **document_status_id (INTEGER)**: A foreign key referencing `id` in the `DOCUMENT_STATUS` table.
- **identity_id (TEXT)**: The identity ID associated with the document.
- **date_last_changed (TIMESTAMP)**: The timestamp when the document was last changed.
- **last_editor_id (TEXT)**: The user ID of the last editor.

### EXPIRY_CHECK_TYPES

id (INTEGER): A unique identifier for the expiry check type. This is the primary key of the table.
label (TEXT): The label of the expiry check type.
- **id (INTEGER)**: A unique identifier for the expiry check type. This is the primary key of the table.
- **label (TEXT)**: The label of the expiry check type.

#### Possible Values
#### EXPIRY_CHECK_TYPES - Possible Values

- `ONE_MONTH`: The expiry check was done one month prior to the expiry of the credential.
- `TWO_WEEKS`: The expiry check was done two weeks prior to the expiry of the credential.
- `ONE_DAY`: The expiry check was done one month prior to the expiry of the credential.

### MEDIA_TYPES

id (INTEGER): A unique identifier for the media type. This is the primary key of the table.
label (TEXT): The label of the media type.
- **id (INTEGER)**: A unique identifier for the media type. This is the primary key of the table.
- **label (TEXT)**: The label of the media type.

### PROCESS_STEP_STATUSES

id (INTEGER): A unique identifier for the process step status. This is the primary key of the table.
label (TEXT): The label of the process step status.
- **id (INTEGER)**: A unique identifier for the process step status. This is the primary key of the table.
- **label (TEXT)**: The label of the process step status.

#### Possible Values
#### PROCESS_STEP_STATUSES - Possible Values

- `TODO`: The process step is still to be executed.
- `DONE`: The process step was already executed successfully.
Expand All @@ -315,10 +314,10 @@ label (TEXT): The label of the process step status.

### PROCESS_STEP_TYPES

id (INTEGER): A unique identifier for the process step type. This is the primary key of the table.
label (TEXT): The label of the process step type.
- **id (INTEGER)**: A unique identifier for the process type. This is the primary key of the table.
- **label (TEXT)**: The label of the process type.^

#### Possible Values
#### PROCESS_STEP_TYPES - Possible Values

- `CREATE_CREDENTIAL`: Creates a credential in the issuer wallet.
- `SIGN_CREDENTIAL`: Signs the credential in the issuer wallet.
Expand All @@ -331,87 +330,87 @@ label (TEXT): The label of the process step type.

### PROCESS_STEPS

id (UUID): A unique identifier for the process step. This is the primary key of the table.
process_step_type_id (INTEGER): A foreign key referencing id in the PROCESS_STEP_TYPES table.
process_step_status_id (INTEGER): A foreign key referencing id in the PROCESS_STEP_STATUSES table.
process_id (UUID): A foreign key referencing id in the PROCESSES table.
date_created (TIMESTAMP): The timestamp when the process step was created.
date_last_changed (TIMESTAMP): The timestamp when the process step was last changed.
message (TEXT): A message associated with the process step.
- **id (UUID)**: A unique identifier for the process step. This is the primary key of the table.
- **process_step_type_id (INTEGER)**: A foreign key referencing `id` in the `PROCESS_STEP_TYPES` table.
- **process_step_status_id (INTEGER)**: A foreign key referencing `id` in the `PROCESS_STEP_STATUSES` table.
- **process_id (UUID)**: A foreign key referencing `id` in the `PROCESSES` table.
- **date_created (TIMESTAMP)**: The timestamp when the process step was created.
- **date_last_changed (TIMESTAMP)**: The timestamp when the process step was last changed.
- **message (TEXT)**: A message associated with the process step.

### PROCESS_TYPES

id (INTEGER): A unique identifier for the process type. This is the primary key of the table.
label (TEXT): The label of the process type.
- **id (INTEGER)**: A unique identifier for the process type. This is the primary key of the table.
- **label (TEXT)**: The label of the process type.

#### Possible Values
#### PROCESS_TYPES - Possible Values

- `CREATE_CREDENTIAL`: Process to create credentials.
- `DECLINE_CREDENTIAL`: Process to revoke credentials.

### PROCESSES

id (UUID): A unique identifier for the process. This is the primary key of the table.
process_type_id (INTEGER): A foreign key referencing id in the PROCESS_TYPES table.
lock_expiry_date (TIMESTAMP): The lock expiry date of the process.
version (UUID): The version of the process.
- **id (UUID)**: A unique identifier for the process. This is the primary key of the table.
- **process_type_id (INTEGER)**: A foreign key referencing `id` in the `PROCESS_TYPES` table.
- **lock_expiry_date (TIMESTAMP)**: The lock expiry date of the process.
- **version (UUID)**: The version of the process.

### USE_CASES

id (UUID): A unique identifier for the use case. This is the primary key of the table.
name (TEXT): The name of the use case.
shortname (TEXT): The short name of the use case.
- **id (UUID)**: A unique identifier for the use case. This is the primary key of the table.
- **name (TEXT)**: The name of the use case.
- **shortname (TEXT)**: The short name of the use case.

### VERIFIED_CREDENTIAL_EXTERNAL_TYPE_DETAIL_VERSIONS

id (UUID): A unique identifier for the external type detail version. This is the primary key of the table.
verified_credential_external_type_id (INTEGER): A foreign key referencing id in the VERIFIED_CREDENTIAL_EXTERNAL_TYPES table.
version (TEXT): The version of the external type detail.
template (TEXT): The template url of the external type detail.
valid_from (TIMESTAMP): The validity start date of the external type detail version.
expiry (TIMESTAMP): The expiry date of the external type detail version.
- **id (UUID)**: A unique identifier for the external type detail version. This is the primary key of the table.
- **verified_credential_external_type_id (INTEGER)**: A foreign key referencing `id` in the `VERIFIED_CREDENTIAL_EXTERNAL_TYPES` table.
- **version (TEXT)**: The version of the external type detail.
- **template (TEXT)**: The template URL of the external type detail.
- **valid_from (TIMESTAMP)**: The validity start date of the external type detail version.
- **expiry (TIMESTAMP)**: The expiry date of the external type detail version.

### VERIFIED_CREDENTIAL_TYPE_ASSIGNED_EXTERNAL_TYPES

verified_credential_type_id (INTEGER): A unique identifier for the verified credential type. This is a primary key and a foreign key referencing id in the VERIFIED_CREDENTIAL_TYPES table.
verified_credential_external_type_id (INTEGER): A unique identifier for the verified credential external type. This is a primary key and a foreign key referencing id in the VERIFIED_CREDENTIAL_EXTERNAL_TYPES table.
- **verified_credential_type_id (INTEGER)**: A unique identifier for the verified credential type. This is a primary key and a foreign key referencing `id` in the `VERIFIED_CREDENTIAL_TYPES` table.
- **verified_credential_external_type_id (INTEGER)**: A unique identifier for the verified credential external type. This is a primary key and a foreign key referencing `id` in the `VERIFIED_CREDENTIAL_EXTERNAL_TYPES` table.

### VERIFIED_CREDENTIAL_EXTERNAL_TYPES

id (INTEGER): A unique identifier for the external type. This is the primary key of the table.
label (TEXT): The label of the external type.
- **id (INTEGER)**: A unique identifier for the external type. This is the primary key of the table.
- **label (TEXT)**: The label of the external type.

### VERIFIED_CREDENTIAL_TYPE_ASSIGNED_KINDS

verified_credential_type_id (INTEGER): A unique identifier for the verified credential type. This is a primary key and a foreign key referencing id in the VERIFIED_CREDENTIAL_TYPES table.
verified_credential_type_kind_id (INTEGER): A unique identifier for the verified credential type kind. This is a primary key and a foreign key referencing id in the VERIFIED_CREDENTIAL_TYPE_KINDS table.
- **verified_credential_type_id (INTEGER)**: A unique identifier for the verified credential type. This is a primary key and a foreign key referencing `id` in the `VERIFIED_CREDENTIAL_TYPES` table.
- **verified_credential_type_kind_id (INTEGER)**: A unique identifier for the verified credential type kind. This is a primary key and a foreign key referencing `id` in the `VERIFIED_CREDENTIAL_TYPE_KINDS` table.

### VERIFIED_CREDENTIAL_TYPE_ASSIGNED_USE_CASES

verified_credential_type_id (INTEGER): A unique identifier for the verified credential type. This is a primary key and a foreign key referencing id in the VERIFIED_CREDENTIAL_TYPES table.
use_case_id (UUID): A unique identifier for the use case. This is a primary key and a foreign key referencing id in the USE_CASES table.
- **verified_credential_type_id (INTEGER)**: A unique identifier for the verified credential type. This is a primary key and a foreign key referencing `id` in the `VERIFIED_CREDENTIAL_TYPES` table.
- **use_case_id (UUID)**: A unique identifier for the use case. This is a primary key and a foreign key referencing `id` in the `USE_CASES` table.

### VERIFIED_CREDENTIAL_TYPE_KINDS

id (INTEGER): A unique identifier for the credential type kind. This is the primary key of the table.
label (TEXT): The label of the credential type kind.
- **id (INTEGER)**: A unique identifier for the credential type kind. This is the primary key of the table.
- **label (TEXT)**: The label of the credential type kind.

### VERIFIED_CREDENTIAL_TYPES

id (INTEGER): A unique identifier for the credential type. This is the primary key of the table.
label (TEXT): The label of the credential type.
- **id (INTEGER)**: A unique identifier for the credential type. This is the primary key of the table.
- **label (TEXT)**: The label of the credential type.

### Enum Value Tables

`company_ssi_detail_status`, `document_status`, `document_types`, `expiry_check_types`, `media_types`, `process_step_statuses`, `process_step_types`, `process_steps`, `process_types`, `verified_credential_external_types`, `verified_credential_type_kinds`, `verified_credential_types` are tables designed to store enum values. They contain an id and label, derived from the backend enums.
`company_ssi_detail_status`, `document_status`, `document_types`, `expiry_check_types`, `media_types`, `process_step_statuses`, `process_step_types`, `process_steps`, `process_types`, `verified_credential_external_types`, `verified_credential_type_kinds`, `verified_credential_types` are tables designed to store enum values. They contain an `id` and `label`, derived from the backend enums.

### Mapping Tables

`company_ssi_detail_assigned_documents` and `verified_credential_type_assigned_external_types`, `verified_credential_type_assigned_kinds`, `verified_credential_type_assigned_use_cases` are used to map entities.

### Credentials

The `company_ssi_details` table is utilized to safe the credential requests and set their status.
The `company_ssi_details` table is utilized to save the credential requests and set their status.

### Process Handling

Expand Down

0 comments on commit e34f7ee

Please sign in to comment.