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/note.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

68 lines
1.8 KiB
Dart

class Note {
final int id;
final String title;
final String body;
final List<String> tags;
final int? projectId;
final int? milestoneId;
final DateTime createdAt;
final DateTime updatedAt;
const Note({
required this.id,
required this.title,
required this.body,
required this.tags,
this.projectId,
this.milestoneId,
required this.createdAt,
required this.updatedAt,
});
factory Note.fromJson(Map<String, dynamic> json) => Note(
id: json['id'] as int,
title: json['title'] as String? ?? '',
body: json['body'] as String? ?? '',
tags: (json['tags'] as List<dynamic>?)
?.map((e) => e as String)
.toList() ??
[],
projectId: json['project_id'] as int?,
milestoneId: json['milestone_id'] as int?,
createdAt: DateTime.parse(json['created_at'] as String),
updatedAt: DateTime.parse(json['updated_at'] as String),
);
Map<String, dynamic> toJson() => {
'title': title,
'body': body,
'tags': tags,
'project_id': projectId,
'milestone_id': milestoneId,
};
Note copyWith({
String? title,
String? body,
List<String>? tags,
Object? projectId = _undefined,
Object? milestoneId = _undefined,
}) =>
Note(
id: id,
title: title ?? this.title,
body: body ?? this.body,
tags: tags ?? this.tags,
projectId: identical(projectId, _undefined)
? this.projectId
: projectId as int?,
milestoneId: identical(milestoneId, _undefined)
? this.milestoneId
: milestoneId as int?,
createdAt: createdAt,
updatedAt: updatedAt,
);
static const _undefined = Object();
}