mirror of
https://github.com/DRYTRIX/TimeTracker.git
synced 2026-01-18 01:59:43 -06:00
Backend - Add TaskActivity model to record start/pause/review/complete/cancel/reopen - Preserve started_at when reopening tasks; keep timestamps in app-local time - Expose recent activities on task detail view Migrations - Add 004_add_task_activities_table (FKs + indexes) Task detail (UI) - Move Description into its own card and render as Markdown (markdown + bleach) - Restyle Quick Actions to use dashboard btn-action styles - Add custom confirmation modal + tooltips - Recent Time Entries: use dashboard action buttons, add progressive “Show more/less” (10 per click) Tasks list - Fix dark mode for filter UI (inputs, selects, input-group-text, checkboxes) Create/Edit task - Integrate EasyMDE Markdown editor with toolbar - Strong dark-theme overrides (toolbar, editor, preview, status bar, tokens) - Prevent unintended side-by-side persistence - Align “Current Task Info” dark-mode styles with task detail CSS - Add dark-mode tints for action buttons, tooltip light theme in dark mode - Editor layout polish (padding, focus ring, gutters, selection) - Quick actions layout: compact horizontal group Deps - Add: markdown, bleach Run - flask db upgrade # applies 004_add_task_activities_table
29 lines
1.1 KiB
Python
29 lines
1.1 KiB
Python
from app import db
|
|
from app.utils.timezone import now_in_app_timezone
|
|
|
|
|
|
class TaskActivity(db.Model):
|
|
"""Lightweight audit log for significant task events."""
|
|
__tablename__ = 'task_activities'
|
|
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
task_id = db.Column(db.Integer, db.ForeignKey('tasks.id'), nullable=False, index=True)
|
|
user_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=True, index=True)
|
|
event = db.Column(db.String(50), nullable=False, index=True)
|
|
details = db.Column(db.Text, nullable=True)
|
|
created_at = db.Column(db.DateTime, default=now_in_app_timezone, nullable=False, index=True)
|
|
|
|
task = db.relationship('Task', backref=db.backref('activities', lazy='dynamic', cascade='all, delete-orphan'))
|
|
user = db.relationship('User')
|
|
|
|
def __init__(self, task_id, event, user_id=None, details=None):
|
|
self.task_id = task_id
|
|
self.user_id = user_id
|
|
self.event = event
|
|
self.details = details
|
|
|
|
def __repr__(self):
|
|
return f'<TaskActivity task={self.task_id} event={self.event}>'
|
|
|
|
|