Skip to main content

max / goingson

3.7 KB · 94 lines History Blame Raw
1 //! Core domain models and business logic for GoingsOn.
2 //!
3 //! This crate provides the foundational types and traits for the GoingsOn
4 //! project management application, including:
5 //!
6 //! - **Domain Models**: [`Project`], [`Task`], [`Event`], [`Email`], and related types
7 //! - **Repository Traits**: Abstract data access layer for persistence
8 //! - **Business Logic**: Urgency calculation, recurrence handling, quick-add parsing
9 //! - **Error Handling**: Unified [`CoreError`] type for all operations
10 //!
11 //! # Architecture
12 //!
13 //! The crate follows a clean architecture pattern where domain models are
14 //! independent of persistence concerns. Repository traits define the data
15 //! access contract, allowing different implementations (SQLite, PostgreSQL).
16 //!
17 //! # Example
18 //!
19 //! ```rust,ignore
20 //! use goingson_core::{Task, Priority, TaskStatus, calculate_urgency};
21 //! use chrono::Utc;
22 //!
23 //! // Calculate task urgency based on priority, status, and due date
24 //! let urgency = calculate_urgency(
25 //! &Priority::High,
26 //! &TaskStatus::Pending,
27 //! None,
28 //! &Utc::now(),
29 //! &["urgent"],
30 //! );
31 //! ```
32
33 pub mod backup_restore;
34 pub mod constants;
35 pub mod contact;
36 pub mod date_utils;
37 pub mod day_planning;
38 pub mod email_id;
39 pub mod email_sync;
40 pub mod error;
41 pub mod id_types;
42 pub mod models;
43 pub mod parser;
44 pub mod plugin;
45 pub mod recurrence;
46 pub mod repository;
47 pub mod search_parser;
48 pub mod text_utils;
49 pub mod monthly_review;
50 pub mod urgency;
51 pub mod validation;
52 pub mod weekly_review;
53
54 pub use contact::{
55 Contact, ContactCustomField, ContactEmail, ContactPhone, NewContact, NewContactCustomField,
56 NewContactEmail, NewContactPhone, NewSocialHandle, SocialHandle, UpdateContact,
57 };
58 pub use error::CoreError;
59 pub use id_types::{
60 AnnotationId, AttachmentId, ContactEmailId, ContactId, ContactPhoneId, CustomFieldId,
61 DailyNoteId, EmailAccountId, EmailId, EventId, MilestoneId, MonthlyGoalId,
62 MonthlyReflectionId, ProjectId, SavedViewId, SocialHandleId,
63 SubtaskId, SyncAccountId, TaskId, TimeSessionId, UserId, WeeklyReviewId,
64 };
65 pub use models::{
66 Annotation, Attachment, BackupSettings, BlockType, CssClass, DailyNote, DbValue, Email, EmailAccount,
67 EmailAuthType, EmailThread, Event, FolderSyncState, Milestone,
68 MilestoneStatus, MonthlyGoal, MonthlyGoalStatus, MonthlyReflection,
69 AttachmentMeta, NewAttachment, NewBackupSettings, NewEmail, NewEmailWithTracking, NewEvent, NewEventBuilder,
70 NewMilestone, NewProject, NewSavedView, NewTask, NewTaskBuilder, Priority,
71 Project, ParseableEnum, ProjectStatus, ProjectType, Recurrence, RecurrenceRule, MonthlySpec,
72 SavedView, SortDirection,
73 SyncAccount,
74 SortField, Subtask, Task, TaskFilterQuery, TaskSortColumn, TaskStatus, TimeSession,
75 TimeTrackingSummary, UpdateEvent, UpdateProject, UpdateTask, User,
76 ViewFilters, ViewType, WeeklyReview,
77 format_file_size, mime_from_extension,
78 };
79 pub use parser::{parse_quick_add, parse_quick_add_with_warnings, ParsedTask, ParseResult};
80 pub use day_planning::{Conflict, TimelineItem, detect_conflicts};
81 pub use recurrence::{calculate_next_due, calculate_next_due_with_day, calculate_next_due_rich, expand_recurrence, should_recur};
82 pub use repository::*;
83 pub use urgency::calculate_urgency;
84 pub use plugin::{
85 ExportPluginConfig, ImportEntityType, ImportExecuteResult, ImportFailure, ImportItem,
86 ImportItemData, ImportOptions, ImportParseResult, ImportPluginConfig, ImportProgress,
87 ImportProjectData, ImportTaskData, ImportEventData, PluginCapabilities, PluginMeta, PluginType,
88 };
89 pub use email_id::deterministic_email_id;
90 pub use validation::Validate;
91
92 /// A specialized `Result` type for core operations.
93 pub type Result<T> = std::result::Result<T, CoreError>;
94