119 lines
3.0 KiB
Markdown
119 lines
3.0 KiB
Markdown
# Chrono Manager Module
|
|
|
|
The Chrono Manager module provides the backend management layer for calendar, event, task, and journal functionality within the Ktrix platform.
|
|
|
|
## Overview
|
|
|
|
This module implements the Provider-Service-Collection-Entity architecture for chronological data:
|
|
|
|
- **Providers**: Calendar/task service providers (local, CalDAV, Exchange, etc.)
|
|
- **Services**: Individual calendar/task services within a provider
|
|
- **Collections**: Calendars, task lists, or journal collections
|
|
- **Entities**: Individual events, tasks, or journal entries
|
|
|
|
## Features
|
|
|
|
- Multi-provider support for calendars and tasks
|
|
- CRUD operations for collections and entities
|
|
- Event management with recurrence support
|
|
- Task management with priorities and subtasks
|
|
- Journal entry support
|
|
- Delta synchronization
|
|
- Filtering and sorting capabilities
|
|
|
|
## Architecture
|
|
|
|
### PHP Backend (`lib/`)
|
|
- `Manager.php`: Core manager class handling all operations
|
|
- `Module.php`: Module registration and lifecycle
|
|
|
|
### TypeScript Frontend (`src/`)
|
|
- **Types**: TypeScript interfaces for all data structures
|
|
- **Services**: API communication layer
|
|
- **Stores**: Pinia stores for state management
|
|
- **Models**: Data model classes with validation
|
|
|
|
## Usage
|
|
|
|
### Backend (PHP)
|
|
|
|
```php
|
|
use KTXM\ChronoManager\Manager;
|
|
|
|
// Register providers
|
|
Manager::registerProvider('local', LocalProvider::class);
|
|
|
|
// Create manager instance
|
|
$manager = new Manager($logger);
|
|
|
|
// List collections
|
|
$collections = $manager->collectionList($tenantId, $userId);
|
|
|
|
// Create entity
|
|
$entity = $manager->entityCreate($tenantId, $userId, $providerId, $serviceId, $collectionId, $entityData);
|
|
```
|
|
|
|
### Frontend (TypeScript)
|
|
|
|
```typescript
|
|
import { useCollectionsStore, useEntitiesStore } from '@ChronoManager/stores';
|
|
|
|
// Get stores
|
|
const collectionsStore = useCollectionsStore();
|
|
const entitiesStore = useEntitiesStore();
|
|
|
|
// Load collections
|
|
const collections = await collectionsStore.list();
|
|
|
|
// Create entity
|
|
const entity = await entitiesStore.create(collection, entityData);
|
|
```
|
|
|
|
## Entity Types
|
|
|
|
### Event
|
|
Calendar events with start/end times, locations, attendees, and recurrence patterns.
|
|
|
|
### Task
|
|
Todo items with priorities, due dates, completion tracking, and subtasks.
|
|
|
|
### Journal
|
|
Journal entries with timestamps and content.
|
|
|
|
## Development
|
|
|
|
### Build TypeScript
|
|
|
|
```bash
|
|
npm install
|
|
npm run build
|
|
```
|
|
|
|
### Watch Mode
|
|
|
|
```bash
|
|
npm run watch
|
|
```
|
|
|
|
## API Endpoints
|
|
|
|
All endpoints are prefixed with `/m/chrono_manager/`:
|
|
|
|
- `/provider/list` - List available providers
|
|
- `/provider/extant` - Check provider availability
|
|
- `/service/list` - List available services
|
|
- `/service/fetch` - Get service details
|
|
- `/collection/list` - List collections
|
|
- `/collection/create` - Create collection
|
|
- `/collection/modify` - Update collection
|
|
- `/collection/destroy` - Delete collection
|
|
- `/entity/list` - List entities
|
|
- `/entity/create` - Create entity
|
|
- `/entity/modify` - Update entity
|
|
- `/entity/destroy` - Delete entity
|
|
- `/entity/delta` - Get delta changes
|
|
|
|
## License
|
|
|
|
AGPL-3.0-or-later
|