This commit is contained in:
Phuoc Nguyen
2025-10-03 17:54:39 +07:00
parent 762395ce50
commit 38a33743e6
16 changed files with 1096 additions and 228 deletions

View File

@@ -0,0 +1,44 @@
import 'package:equatable/equatable.dart';
class Todo extends Equatable {
final int id;
final String title;
final String? description;
final bool completed;
final String userId;
final DateTime? createdAt;
final DateTime? updatedAt;
const Todo({
required this.id,
required this.title,
this.description,
required this.completed,
required this.userId,
this.createdAt,
this.updatedAt,
});
Todo copyWith({
int? id,
String? title,
String? description,
bool? completed,
String? userId,
DateTime? createdAt,
DateTime? updatedAt,
}) {
return Todo(
id: id ?? this.id,
title: title ?? this.title,
description: description ?? this.description,
completed: completed ?? this.completed,
userId: userId ?? this.userId,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
);
}
@override
List<Object?> get props => [id, title, description, completed, userId, createdAt, updatedAt];
}

View File

@@ -0,0 +1,8 @@
import 'package:fpdart/fpdart.dart';
import '../../../../core/errors/failures.dart';
import '../entities/todo.dart';
abstract class TodoRepository {
Future<Either<Failure, List<Todo>>> getTodos();
Future<Either<Failure, void>> refreshTodos();
}