Internal
Public Access
Initial commit: KeepItGoing task management server
Features: - Django-based REST API with web interface - Task management with tags, priorities, and due dates - Time tracking with start/stop timers - Subtasks support - Task filtering (all, today, upcoming, overdue, completed) - Tag-based organization with color coding - Sorting by due date and priority - Auto-assign tags when filtering - Responsive 3-pane layout (sidebar, task list, detail panel) - Task sharing between users - Mobile-responsive design with dark mode support 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
"""
|
||||
Sync models for KeepItGoing.
|
||||
|
||||
Tracks sync state for offline clients.
|
||||
"""
|
||||
|
||||
import uuid
|
||||
from django.conf import settings
|
||||
from django.db import models
|
||||
|
||||
|
||||
class SyncLog(models.Model):
|
||||
"""
|
||||
Tracks sync operations for each user/device.
|
||||
"""
|
||||
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||
user = models.ForeignKey(
|
||||
settings.AUTH_USER_MODEL,
|
||||
on_delete=models.CASCADE,
|
||||
related_name='sync_logs'
|
||||
)
|
||||
device_id = models.CharField(max_length=255)
|
||||
last_sync_at = models.DateTimeField()
|
||||
sync_token = models.CharField(max_length=255, unique=True)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
class Meta:
|
||||
db_table = 'sync_logs'
|
||||
unique_together = ['user', 'device_id']
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.user.email} - {self.device_id}"
|
||||
|
||||
|
||||
class SyncConflict(models.Model):
|
||||
"""
|
||||
Records sync conflicts for manual resolution.
|
||||
"""
|
||||
CONFLICT_STATUS = [
|
||||
('pending', 'Pending'),
|
||||
('resolved_local', 'Resolved (Local)'),
|
||||
('resolved_server', 'Resolved (Server)'),
|
||||
('resolved_merged', 'Resolved (Merged)'),
|
||||
]
|
||||
|
||||
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||
user = models.ForeignKey(
|
||||
settings.AUTH_USER_MODEL,
|
||||
on_delete=models.CASCADE,
|
||||
related_name='sync_conflicts'
|
||||
)
|
||||
entity_type = models.CharField(max_length=50) # task, group, tag, etc.
|
||||
entity_id = models.UUIDField()
|
||||
local_data = models.JSONField()
|
||||
server_data = models.JSONField()
|
||||
status = models.CharField(max_length=20, choices=CONFLICT_STATUS, default='pending')
|
||||
resolved_at = models.DateTimeField(null=True, blank=True)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
class Meta:
|
||||
db_table = 'sync_conflicts'
|
||||
ordering = ['-created_at']
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.entity_type} conflict for {self.user.email}"
|
||||
Reference in New Issue
Block a user