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>>
|
|
|
|
--
|
2021-05-16 16:54:45 -04:00
|
|
|
publicId: text
|
2021-02-22 17:36:44 -05: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-06-06 11:46:32 -04:00
|
|
|
entity "alias" {
|
|
|
|
*id: uuid <<generated>>
|
|
|
|
---
|
|
|
|
name: text
|
|
|
|
' If the alias is primary. Can be NULL, which means it's not primary
|
|
|
|
primary: boolean
|
|
|
|
}
|
|
|
|
|
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
|
2021-01-21 13:37:43 -05:00
|
|
|
*keyId: text
|
2020-08-12 13:47:22 -04:00
|
|
|
*accessToken : text
|
2021-01-24 14:37:04 -05:00
|
|
|
*label: text
|
2021-01-17 08:49:28 -05:00
|
|
|
*createdAt: date
|
2021-01-21 13:37:43 -05:00
|
|
|
lastUsed: number
|
|
|
|
validUntil: number
|
2020-08-12 13:47:22 -04:00
|
|
|
}
|
|
|
|
|
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>>
|
2021-08-08 15:53:20 -04:00
|
|
|
*providerType: text
|
2020-08-12 13:47:22 -04:00
|
|
|
' Identifies the external login provider and is set in the config
|
2021-08-08 15:53:20 -04:00
|
|
|
providerName : text
|
2020-08-12 13:47:22 -04:00
|
|
|
*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-04-29 12:07:06 -04:00
|
|
|
*authorId : 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-04-29 12:07:06 -04:00
|
|
|
entity "author" {
|
|
|
|
*id : number <<generated>>
|
2020-08-12 13:47:22 -04:00
|
|
|
--
|
|
|
|
*color : text
|
2021-04-29 12:07:06 -04:00
|
|
|
sessionID : text <<FK session>>
|
|
|
|
userId : uuid <<FK user>>
|
2020-08-12 13:47:22 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
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-27 16:58:55 -05:00
|
|
|
entity "group_members_user" {
|
|
|
|
*group : number <<FK group>>
|
|
|
|
*member : uuid <<FK user>>
|
|
|
|
}
|
|
|
|
|
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
|
2021-02-27 05:24:41 -05:00
|
|
|
*fileUrl: text
|
2020-10-13 04:19:12 -04:00
|
|
|
backendData: text
|
|
|
|
*createdAt : date
|
|
|
|
}
|
|
|
|
|
2021-02-03 15:15:39 -05:00
|
|
|
entity "history_entry" {
|
|
|
|
*noteId : uuid <<FK note>>
|
|
|
|
*userId : uuid <<FK user>>
|
|
|
|
--
|
|
|
|
*pinStatus: boolean
|
|
|
|
*updatedAt: date
|
|
|
|
}
|
|
|
|
|
2021-04-29 12:07:06 -04:00
|
|
|
user "0..1" -- "0..*" note: owner
|
2021-01-22 18:41:49 -05:00
|
|
|
user "1" -u- "1..*" identity
|
2021-01-27 16:58:55 -05:00
|
|
|
user "1" -l- "1..*" auth_token: authTokens
|
|
|
|
user "1" -r- "1..*" session
|
|
|
|
user "1" -- "0..*" media_upload
|
2021-04-29 12:07:06 -04:00
|
|
|
user "1" -- "0..*" history_entry
|
2021-01-22 18:41:49 -05:00
|
|
|
user "0..*" -- "0..*" note
|
2021-04-29 12:07:06 -04:00
|
|
|
user "0..1" -- "0..*" author
|
2020-10-24 14:55:31 -04:00
|
|
|
|
2021-04-29 12:07:06 -04:00
|
|
|
author "1" -- "0..*" authorship
|
|
|
|
author "1" -u- "0..*" session
|
2020-10-24 14:55:31 -04:00
|
|
|
|
2021-01-27 16:58:55 -05:00
|
|
|
revision "0..*" -- "0..*" authorship
|
2021-01-22 18:41:49 -05:00
|
|
|
(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
|
2021-04-29 12:07:06 -04:00
|
|
|
note "1" -d- "1..*" revision
|
2021-02-03 15:15:39 -05:00
|
|
|
note "1" - "0..*" history_entry
|
2021-01-22 18:41:49 -05:00
|
|
|
note "0..*" -l- "0..*" tag
|
2021-06-06 11:46:32 -04:00
|
|
|
note "1" - "0..*" alias
|
2021-01-22 18:41:49 -05:00
|
|
|
note "0..*" -- "0..*" group
|
2021-01-27 16:58:55 -05:00
|
|
|
user "1..*" -- "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
|
2021-01-27 16:58:55 -05:00
|
|
|
(user, group) . group_members_user
|
2020-10-24 14:55:31 -04:00
|
|
|
|
2020-08-12 13:47:22 -04:00
|
|
|
@enduml
|