feat(knowledge): update Project model, ProjectsApi sort, and NoteEditScreen noteType support

This commit is contained in:
2026-04-04 23:52:10 -04:00
parent f5ba2d25a3
commit a50193dbc0
4 changed files with 40 additions and 4 deletions
+7 -1
View File
@@ -11,7 +11,11 @@ class ProjectsApi {
try {
final response = await _dio.get(
'/api/projects',
queryParameters: status != null ? {'status': status} : null,
queryParameters: {
'sort': 'updated_at',
'order': 'desc',
if (status != null) 'status': status,
},
);
final data = response.data as Map<String, dynamic>;
final list = data['projects'] as List<dynamic>;
@@ -37,10 +41,12 @@ class ProjectsApi {
String? description,
String? goal,
String? color,
String status = 'active',
}) async {
try {
final response = await _dio.post('/api/projects', data: {
'title': title,
'status': status,
if (description != null && description.isNotEmpty)
'description': description,
if (goal != null && goal.isNotEmpty) 'goal': goal,
+4
View File
@@ -5,6 +5,7 @@ class Project {
final String? goal;
final String status; // active | completed | archived
final String? color;
final String? autoSummary;
final DateTime createdAt;
final DateTime updatedAt;
@@ -15,6 +16,7 @@ class Project {
this.goal,
required this.status,
this.color,
this.autoSummary,
required this.createdAt,
required this.updatedAt,
});
@@ -26,6 +28,7 @@ class Project {
goal: json['goal'] as String?,
status: json['status'] as String? ?? 'active',
color: json['color'] as String?,
autoSummary: json['auto_summary'] as String?,
createdAt: DateTime.parse(json['created_at'] as String),
updatedAt: DateTime.parse(json['updated_at'] as String),
);
@@ -36,5 +39,6 @@ class Project {
'goal': goal,
'status': status,
'color': color,
'auto_summary': autoSummary,
};
}
@@ -12,9 +12,14 @@ class ProjectsRepository {
String? description,
String? goal,
String? color,
String status = 'active',
}) =>
_api.create(
title: title, description: description, goal: goal, color: color);
title: title,
description: description,
goal: goal,
color: color,
status: status);
Future<Project> update(int id, Map<String, dynamic> fields) =>
_api.update(id, fields);
Future<void> delete(int id) => _api.delete(id);