@startuml hide circle skinparam nodesep 60 entity "Note" { *id : uuid <> -- *shortid : text alias : text *viewcount : number *ownerId : uuid <> description: text title: text } entity "User" { *id : uuid <> -- *userName : text *displayName : text *createdAt : date *updatedAt : date photo : text email : text } entity "AuthToken" as authToken{ *id : number <> -- *userId : uuid *accessToken : text } entity "Identity" { *id : number -- *userId : uuid <> ' 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 } entity "Session" { *id : text -- *expiredAt : number *json : text } entity "Revision" { *id : number <> -- *noteId : uuid <> *content : text *patch : text *createdAt : date *length : number } entity "Authorship" { *id : uuid <> -- *userId : uuid > *startPos : number *endPos : number *createdAt : date *updatedAt : date } entity "RevisionAuthorship" { *revisionId : number <> *authorshipId : uuid <> } entity "AuthorColors" { *noteId : uuid <> *userId : uuid <> -- *color : text } entity "NoteUserPermission" { *userId : uuid <> *noteId : uuid <> -- *canEdit : boolean } entity "Group" { *id : number <> -- *name : text <> *displayName : text ' Is set to denote a special group ' Special groups are used to map the old share settings like "everyone can edit" ' or "logged in users can view" to the group permission system *special : boolean } entity "NoteGroupPermission" { *groupId : number <> *noteId : uuid <> -- *canEdit : boolean } entity "Tag" { *id: number <> *name: text } entity "MediaUpload" { *id : text <> -- *noteId : uuid <> *userId : uuid <> *backendType: text backendData: text *createdAt : date } User "1" -- "0..*" Note: owner User "1" -u- "1..*" Identity User "1" - "1..*" authToken User "1" -l- "1..*" Session User "1" - "0..*" MediaUpload User "0..*" -- "0..*" Note User "1" - "0..*" Authorship (User, Note) . AuthorColors Revision "0..*" - "0..*" Authorship (Revision, Authorship) .. RevisionAuthorship MediaUpload "0..*" -- "1" Note Note "1" - "1..*" Revision Note "0..*" -l- "0..*" Tag Note "0..*" -- "0..*" Group User "0..*" -- "0..*" Note (User, Note) . NoteUserPermission (Note, Group) . NoteGroupPermission @enduml