logo logo
Design: Database: Notes meta

Database Notes
Purpose Hold private member notes.
Cardinality one Notes database per member in the engagement
at most one item per associated member
Source Code
Items src/ts/dbitems/Notes.ts
Zod Models
item NotesItem
item.item NotesRecord
itemId number of member in the Members database (first is 1)
item: NotesRecord
    kind 'note'
    mnum number of member in the Members db (same as itemId)
    note member note text


Each member may record a short private text note about another member which only the author can see.
The Notes database holds these notes.

(see userbase-js/types/index.d.ts)
  export interface Item {
    itemId: string
    item: any                   ◄────────────────┐
    createdBy: Attribution                       │
    updatedBy?: Attribution                      │
    fileId?: string                              │
    fileName?: string                            │
    fileSize?: number                            │
    fileUploadedBy?: Attribution                 │
    writeAccess?: AccessControl                  │
  }                                              │
NotesRecord represents the specific type of Item.item for a member note.

Ownership and Access

The each member owns their own Notes database.

The Notes databases are not shared and are only accessible by the owner.

Zod models

The following Zod models show how the Userbase items are represented in memory.

Note that in addition to the values specified by the Userbase Item interface the kind and database attributes are added during deserialization.

export type  NotesItem = z.infer<typeof NotesItem>;
export const NotesItem = z.object({
  kind:                 z.literal('notesitem'),
  itemId:               z.string(),
  item:                 NotesRecord,
  updatedBy:            z.custom<Attribution>(),
  database:             z.custom<Database>()
export type  NotesRecord = z.infer<typeof NotesRecord>;
export const NotesRecord = z.object({
  kind:                 z.literal('note'),
  mnum:                 z.number(),
  note:                 z.string()