Skip to main content

Overview

The Record entity is a flexible data structure used to store various types of information within Simple Manager Mobile. Records support metadata, soft deletion, and user association.

Interface Definition

export interface Record {
    id: string;
    title: string;
    subtitle?: string;
    metadata?: string;
    type: string;
    userId?: string;
    createdAt: string;
    updatedAt: string;
    isDeleted: boolean;
}

Properties

id
string
required
Unique identifier for the record
title
string
required
Main title or name of the record
subtitle
string
Optional secondary title or description for additional context
metadata
string
Optional JSON string or additional metadata associated with the record
type
string
required
Category or type classification of the record
userId
string
Optional identifier of the user who owns or created this record
createdAt
string
required
ISO 8601 timestamp indicating when the record was created
updatedAt
string
required
ISO 8601 timestamp indicating when the record was last updated
isDeleted
boolean
required
Soft deletion flag. When true, the record is marked as deleted but not removed from the database

Usage Example

import { Record } from '@/domain/entities/Record';

const record: Record = {
  id: 'rec_123456',
  title: 'Patient Medical History',
  subtitle: 'Annual checkup notes',
  metadata: JSON.stringify({ category: 'medical', priority: 'high' }),
  type: 'medical_record',
  userId: 'user_789',
  createdAt: '2024-03-12T10:30:00Z',
  updatedAt: '2024-03-12T10:30:00Z',
  isDeleted: false
};

Common Operations

Creating a New Record

const newRecord: Omit<Record, 'id' | 'createdAt' | 'updatedAt'> = {
  title: 'New Record',
  type: 'general',
  isDeleted: false
};

Soft Deleting a Record

const deletedRecord: Record = {
  ...existingRecord,
  isDeleted: true,
  updatedAt: new Date().toISOString()
};

Build docs developers (and LLMs) love