2020-07-27 16:35:12 -04:00
|
|
|
@startuml
|
|
|
|
hide circle
|
2020-10-24 14:55:31 -04:00
|
|
|
skinparam nodesep 60
|
2020-07-27 16:35:12 -04:00
|
|
|
|
2021-01-22 18:41:49 -05:00
|
|
|
entity "note" {
|
2020-07-27 16:35:12 -04:00
|
|
|
*id : uuid <<generated>>
|
|
|
|
--
|
|
|
|
*shortid : text
|
2020-10-03 05:14:41 -04:00
|
|
|
alias : text
|
2020-07-27 16:35:12 -04:00
|
|
|
*viewcount : number
|
2021-01-22 18:41:49 -05:00
|
|
|
*ownerId : uuid <<FK user>>
|
2020-10-03 05:02:03 -04:00
|
|
|
description: text
|
|
|
|
title: text
|
2020-07-27 16:35:12 -04:00
|
|
|
}
|
|
|
|
|
2021-01-22 18:41:49 -05:00
|
|
|
entity "user" {
|
2020-07-27 16:35:12 -04:00
|
|
|
*id : uuid <<generated>>
|
|
|
|
--
|
2020-08-12 13:47:22 -04:00
|
|
|
*userName : text
|
|
|
|
*displayName : text
|
|
|
|
*createdAt : date
|
|
|
|
*updatedAt : date
|
|
|
|
photo : text
|
|
|
|
email : text
|
|
|
|
}
|
|
|
|
|
2021-01-22 18:41:49 -05:00
|
|
|
entity "auth_token"{
|
2020-08-12 13:47:22 -04:00
|
|
|
*id : number <<generated>>
|
|
|
|
--
|
|
|
|
*userId : uuid
|
|
|
|
*accessToken : text
|
|
|
|
}
|
|
|
|
|
2021-01-22 18:41:49 -05:00
|
|
|
entity "identity" {
|
2020-08-12 13:47:22 -04:00
|
|
|
*id : number
|
|
|
|
--
|
2021-01-22 18:41:49 -05:00
|
|
|
*userId : uuid <<FK user>>
|
2020-08-12 13:47:22 -04:00
|
|
|
' Identifies the external login provider and is set in the config
|
|
|
|
*providerName : text
|
|
|
|
*syncSource : boolean
|
|
|
|
*createdAt : date
|
|
|
|
*updatedAt : date
|
|
|
|
' The unique identifier of a user from the login provider
|
|
|
|
providerUserId : text
|
|
|
|
' Token used to access the OAuth provider in the users name. Can be NULL
|
|
|
|
oauthAccessToken : text
|
|
|
|
' Password hash. Can be NULL
|
|
|
|
passwordHash : text
|
2020-07-27 16:35:12 -04:00
|
|
|
}
|
|
|
|
|
2021-01-22 18:41:49 -05:00
|
|
|
entity "session" {
|
2020-08-12 13:47:22 -04:00
|
|
|
*id : text
|
|
|
|
--
|
|
|
|
*expiredAt : number
|
|
|
|
*json : text
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-01-22 18:41:49 -05:00
|
|
|
entity "revision" {
|
2020-09-22 14:06:16 -04:00
|
|
|
*id : number <<generated>>
|
2020-07-27 16:35:12 -04:00
|
|
|
--
|
2021-01-22 18:41:49 -05:00
|
|
|
*noteId : uuid <<FK note>>
|
2020-07-27 16:35:12 -04:00
|
|
|
*content : text
|
|
|
|
*patch : text
|
|
|
|
*createdAt : date
|
|
|
|
*length : number
|
|
|
|
}
|
|
|
|
|
2021-01-22 18:41:49 -05:00
|
|
|
entity "authorship" {
|
2020-07-27 16:35:12 -04:00
|
|
|
*id : uuid <<generated>>
|
|
|
|
--
|
2021-01-22 18:41:49 -05:00
|
|
|
*userId : uuid <FK user>>
|
2020-07-27 16:35:12 -04:00
|
|
|
*startPos : number
|
|
|
|
*endPos : number
|
|
|
|
*createdAt : date
|
|
|
|
*updatedAt : date
|
|
|
|
}
|
|
|
|
|
2021-01-22 18:41:49 -05:00
|
|
|
entity "revision_authorship" {
|
|
|
|
*revisionId : number <<FK revision>>
|
|
|
|
*authorshipId : uuid <<FK authorship>>
|
2020-07-27 16:35:12 -04:00
|
|
|
}
|
|
|
|
|
2021-01-22 18:41:49 -05:00
|
|
|
entity "author_colors" {
|
|
|
|
*noteId : uuid <<FK note>>
|
|
|
|
*userId : uuid <<FK user>>
|
2020-08-12 13:47:22 -04:00
|
|
|
--
|
|
|
|
*color : text
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-01-22 18:41:49 -05:00
|
|
|
entity "note_user_permission" {
|
|
|
|
*userId : uuid <<FK user>>
|
|
|
|
*noteId : uuid <<FK note>>
|
2020-07-27 16:35:12 -04:00
|
|
|
--
|
|
|
|
*canEdit : boolean
|
|
|
|
}
|
|
|
|
|
2021-01-22 18:41:49 -05:00
|
|
|
entity "group" {
|
2020-07-27 16:35:12 -04:00
|
|
|
*id : number <<generated>>
|
|
|
|
--
|
|
|
|
*name : text <<unique>>
|
|
|
|
*displayName : text
|
|
|
|
' Is set to denote a special group
|
|
|
|
' Special groups are used to map the old share settings like "everyone can edit"
|
2020-08-12 13:47:22 -04:00
|
|
|
' or "logged in users can view" to the group permission system
|
2020-07-27 16:35:12 -04:00
|
|
|
*special : boolean
|
|
|
|
}
|
2020-08-12 13:47:22 -04:00
|
|
|
|
2021-01-22 18:41:49 -05:00
|
|
|
entity "note_group_permission" {
|
|
|
|
*groupId : number <<FK group>>
|
|
|
|
*noteId : uuid <<FK note>>
|
2020-07-27 16:35:12 -04:00
|
|
|
--
|
|
|
|
*canEdit : boolean
|
|
|
|
}
|
|
|
|
|
2021-01-22 18:41:49 -05:00
|
|
|
entity "tag" {
|
2020-10-03 05:02:03 -04:00
|
|
|
*id: number <<generated>>
|
|
|
|
*name: text
|
|
|
|
}
|
|
|
|
|
2021-01-22 18:41:49 -05:00
|
|
|
entity "media_upload" {
|
2020-10-13 04:19:12 -04:00
|
|
|
*id : text <<unique>>
|
|
|
|
--
|
2021-01-22 18:41:49 -05:00
|
|
|
*noteId : uuid <<FK note>>
|
|
|
|
*userId : uuid <<FK user>>
|
2020-10-13 04:19:12 -04:00
|
|
|
*backendType: text
|
|
|
|
backendData: text
|
|
|
|
*createdAt : date
|
|
|
|
}
|
|
|
|
|
2021-01-22 18:41:49 -05:00
|
|
|
user "1" -- "0..*" note: owner
|
|
|
|
user "1" -u- "1..*" identity
|
|
|
|
user "1" - "1..*" auth_token
|
|
|
|
user "1" -l- "1..*" session
|
|
|
|
user "1" - "0..*" media_upload
|
|
|
|
user "0..*" -- "0..*" note
|
|
|
|
user "1" - "0..*" authorship
|
2020-10-24 14:55:31 -04:00
|
|
|
|
2021-01-22 18:41:49 -05:00
|
|
|
(user, note) . author_colors
|
2020-10-24 14:55:31 -04:00
|
|
|
|
2021-01-22 18:41:49 -05:00
|
|
|
revision "0..*" - "0..*" authorship
|
|
|
|
(revision, authorship) .. revision_authorship
|
2020-10-24 14:55:31 -04:00
|
|
|
|
2021-01-22 18:41:49 -05:00
|
|
|
media_upload "0..*" -- "1" note
|
|
|
|
note "1" - "1..*" revision
|
|
|
|
note "0..*" -l- "0..*" tag
|
|
|
|
note "0..*" -- "0..*" group
|
2020-10-24 14:55:31 -04:00
|
|
|
|
2021-01-22 18:41:49 -05:00
|
|
|
user "0..*" -- "0..*" note
|
|
|
|
(user, note) . note_user_permission
|
|
|
|
(note, group) . note_group_permission
|
2020-10-24 14:55:31 -04:00
|
|
|
|
2020-08-12 13:47:22 -04:00
|
|
|
@enduml
|