This repository has been archived on 2026-06-02. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
FabledApp/lib/data/models/project.dart
T
bvandeusen fceae5529d Add Projects feature; sync Note/Task models with backend additions
## New: Projects
- Project model, API, repository, Riverpod provider
- ProjectListScreen: active/archived sections, create dialog, long-press status/delete
- ProjectSelector widget: DropdownButtonFormField for note + task editors
- Projects tab added to shell (bottom nav + navigation rail, 4th position)
- /projects route registered in GoRouter ShellRoute

## Updated: Note model
- Added tags: List<String>, projectId: int?, milestoneId: int?
- NotesApi.create/update pass tags and project_id
- NotesRepository and NotesNotifier signatures updated
- NoteEditScreen: chip-based tag input + ProjectSelector

## Updated: Task model
- Added projectId: int?, milestoneId: int?, parentId: int?
- TasksApi.create passes project_id; update payload includes project_id
- TasksRepository and TasksNotifier signatures updated
- TaskEditScreen: ProjectSelector added; project_id sent on save

## Provider fix
- ProjectsNotifier.update renamed to updateProject to avoid conflict
  with AsyncNotifier.update(FutureOr<State> Function(State)) base method

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-02 20:52:59 -05:00

41 lines
1.1 KiB
Dart

class Project {
final int id;
final String title;
final String? description;
final String? goal;
final String status; // active | completed | archived
final String? color;
final DateTime createdAt;
final DateTime updatedAt;
const Project({
required this.id,
required this.title,
this.description,
this.goal,
required this.status,
this.color,
required this.createdAt,
required this.updatedAt,
});
factory Project.fromJson(Map<String, dynamic> json) => Project(
id: json['id'] as int,
title: json['title'] as String? ?? '',
description: json['description'] as String?,
goal: json['goal'] as String?,
status: json['status'] as String? ?? 'active',
color: json['color'] as String?,
createdAt: DateTime.parse(json['created_at'] as String),
updatedAt: DateTime.parse(json['updated_at'] as String),
);
Map<String, dynamic> toJson() => {
'title': title,
'description': description,
'goal': goal,
'status': status,
'color': color,
};
}