@startuml ' hide the spot hide circle ' avoid problems with angled crows feet skinparam linetype ortho entity "Note" { *id : uuid <> -- *shortid : text *alias : text *viewcount : number *ownerId : uuid <> } 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" as seesion { *id : text -- *expiredAt : number *json : text } entity "Revision" { *id : uuid <> -- *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 : uuid <> *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 } Note "1" - "1..*" Revision Revision "0..*" - "0..*" Authorship (Revision, Authorship) .. RevisionAuthorship Authorship "0..*" - "1" User Note "1" - "0..*" User : owner Note "1" - "0..*" NoteUserPermission NoteUserPermission "1" - "1" User Note "1" - "0..*" NoteGroupPermission NoteGroupPermission "0..*" - "1" Group Identity "1..*" - "1" User authToken "1..*" - "1" User seesion "1..*" - "1" User Note "0..*" - "0..*" User : color (Note, User) .. AuthorColors @enduml