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 <git@herrmehren.de>
This commit is contained in:
David Mehren 2021-04-29 18:07:06 +02:00
parent 4205856b41
commit fddb7e8c8c
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3

View file

@ -74,7 +74,7 @@ entity "revision" {
entity "authorship" {
*id : uuid <<generated>>
--
*userId : uuid <FK user>>
*authorId : uuid <FK user>>
*startPos : number
*endPos : number
*createdAt : date
@ -86,11 +86,12 @@ entity "revision_authorship" {
*authorshipId : uuid <<FK authorship>>
}
entity "author_colors" {
*noteId : uuid <<FK note>>
*userId : uuid <<FK user>>
entity "author" {
*id : number <<generated>>
--
*color : text
sessionID : text <<FK session>>
userId : uuid <<FK user>>
}
@ -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