From fddb7e8c8c55b5a0574bf72faa06b20edcd2ff21 Mon Sep 17 00:00:00 2001 From: David Mehren Date: Thu, 29 Apr 2021 18:07:06 +0200 Subject: [PATCH] Allow anonymous user colors in DB schema Every authorship now has an author that saves the color. The author links to the session and optionally the user. For anonymous users, the session now can be used to reidentify the user. If the user is logged-in, the userId is saved into the author table. This allows to identify the user even after the session expired. A note created by an anonymous user does not have an owner. The cardinality was updated to reflect that. Signed-off-by: David Mehren --- docs/content/dev/db-schema.plantuml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/docs/content/dev/db-schema.plantuml b/docs/content/dev/db-schema.plantuml index 80a86a6d5..98ff6a3cb 100644 --- a/docs/content/dev/db-schema.plantuml +++ b/docs/content/dev/db-schema.plantuml @@ -74,7 +74,7 @@ entity "revision" { entity "authorship" { *id : uuid <> -- - *userId : uuid > + *authorId : uuid > *startPos : number *endPos : number *createdAt : date @@ -86,11 +86,12 @@ entity "revision_authorship" { *authorshipId : uuid <> } -entity "author_colors" { - *noteId : uuid <> - *userId : uuid <> +entity "author" { + *id : number <> -- *color : text + sessionID : text <> + userId : uuid <> } @@ -148,22 +149,23 @@ entity "history_entry" { *updatedAt: date } -user "1" -- "0..*" note: owner +user "0..1" -- "0..*" note: owner user "1" -u- "1..*" identity user "1" -l- "1..*" auth_token: authTokens user "1" -r- "1..*" session user "1" -- "0..*" media_upload -user "1" - "0..*" history_entry +user "1" -- "0..*" history_entry user "0..*" -- "0..*" note -user "1" -- "0..*" authorship +user "0..1" -- "0..*" author -(user, note) . author_colors +author "1" -- "0..*" authorship +author "1" -u- "0..*" session revision "0..*" -- "0..*" authorship (revision, authorship) .. revision_authorship media_upload "0..*" -- "1" note -note "1" - "1..*" revision +note "1" -d- "1..*" revision note "1" - "0..*" history_entry note "0..*" -l- "0..*" tag note "0..*" -- "0..*" group