-
Notifications
You must be signed in to change notification settings - Fork 0
๐ Data Models
Divyansh Bhardwaj edited this page Oct 8, 2025
·
1 revision
// src/models/User.ts
export interface User {
id: string; // UUID
email: string; // User's email address
password: string; // Hashed password (stored in localStorage)
name: string; // Display name
createdAt: string; // ISO date string
updatedAt: string; // ISO date string
}
export interface LoginCredentials {
email: string;
password: string;
}
export interface AuthState {
user: User | null;
isAuthenticated: boolean;
isLoading: boolean;
error: string | null;
}// src/models/Note.ts
export interface Note {
id: string; // UUID
title: string; // Note title
content: string; // Rich text content (HTML)
plainTextContent: string; // Plain text for search
authorId: string; // User ID who created the note
authorName: string; // Author's display name
tags: string[]; // Array of tag names
createdAt: string; // ISO date string
updatedAt: string; // ISO date string
isDeleted: boolean; // Soft delete flag
}
export interface CreateNoteDTO {
title: string;
content: string;
tags?: string[];
}
export interface UpdateNoteDTO {
title?: string;
content?: string;
tags?: string[];
}
export interface NoteFilters {
searchQuery?: string;
tags?: string[];
sortBy?: 'createdAt' | 'updatedAt' | 'title';
sortOrder?: 'asc' | 'desc';
}// src/models/Tag.ts
export interface Tag {
id: string; // UUID
name: string; // Tag name
color?: string; // Optional color for UI
createdAt: string; // ISO date string
usageCount: number; // How many notes use this tag
}
export interface TagStats {
totalTags: number;
mostUsedTags: Tag[];
}