feat(knowledge): add ProjectsScreen and ProjectEditScreen, sort projects by updated_at

This commit is contained in:
2026-04-04 23:56:18 -04:00
parent a50193dbc0
commit e39d31fe43
5 changed files with 269 additions and 5 deletions
+7 -3
View File
@@ -7,13 +7,17 @@ class ProjectsApi {
final Dio _dio;
const ProjectsApi(this._dio);
Future<List<Project>> getAll({String? status}) async {
Future<List<Project>> getAll({
String? status,
String sort = 'updated_at',
String order = 'desc',
}) async {
try {
final response = await _dio.get(
'/api/projects',
queryParameters: {
'sort': 'updated_at',
'order': 'desc',
'sort': sort,
'order': order,
if (status != null) 'status': status,
},
);
@@ -5,7 +5,12 @@ class ProjectsRepository {
final ProjectsApi _api;
const ProjectsRepository(this._api);
Future<List<Project>> getAll({String? status}) => _api.getAll(status: status);
Future<List<Project>> getAll({
String? status,
String sort = 'updated_at',
String order = 'desc',
}) =>
_api.getAll(status: status, sort: sort, order: order);
Future<Project> getOne(int id) => _api.getOne(id);
Future<Project> create({
required String title,