added project repository

This commit is contained in:
2025-01-01 20:32:01 +00:00
parent 4d52186d21
commit 6d980a980e
7 changed files with 277 additions and 54 deletions
@@ -1,34 +1,36 @@
import 'package:backend_dart/domain/entities/project.dart';
import 'package:backend_dart/domain/interface/error.dart';
import 'package:fpdart/fpdart.dart';
/// Interface for managing project data interactions.
abstract class ProjectDataSource {
/// Creates a new project in the data source.
///
/// Throws an error if the creation fails.
Future<void> createProject(NewProject project);
TaskEither<IError, Project> createProject(ProjectCreate project);
/// Retrieves a project by its unique ID.
///
/// Returns `null` if no project is found.
Future<Project?> findProjectById(String id);
TaskEither<IError, Project> findProjectById(String id);
/// Retrieves all projects associated with a specific user.
///
/// Returns an empty list if no projects are found.
Future<List<Project>> findProjectsByUserId(String userId);
TaskEither<IError,List<Project>> findProjectsByUserId(String userId);
/// Updates an existing project in the data source.
///
/// Throws an error if the update fails.
Future<void> updateProject(ProjectUpdate project);
TaskEither<IError, Project> updateProject(ProjectUpdate project);
/// Deletes a project by its unique ID.
///
/// Throws an error if the deletion fails.
Future<void> deleteProject(String id);
TaskEither<IError, Project> deleteProject(String id);
/// Retrieves all projects in the data source.
///
/// Returns an empty list if no projects exist.
Future<List<Project>> findAllProjects();
TaskEither<IError, List<Project>> findAllProjects();
}