implemented other repos, services, objects ...

This commit is contained in:
2025-01-01 21:36:20 +00:00
parent 6d980a980e
commit 10c72f22c5
51 changed files with 5940 additions and 502 deletions
@@ -1,6 +1,13 @@
import 'package:backend_dart/domain/data/project_data_source.dart';
import 'package:backend_dart/domain/data/project_task_data_source.dart';
import 'package:backend_dart/domain/data/time_entry_data_source.dart';
import 'package:backend_dart/domain/data/user_data_source.dart';
abstract class IDatabase {
UserDataSource get users;
TimeEntryDataSource get timeEntries;
ProjectTaskDataSource get tasks;
ProjectDataSource get projects;
Future<void> close();
}
@@ -7,30 +7,33 @@ abstract class ProjectDataSource {
/// Creates a new project in the data source.
///
/// Throws an error if the creation fails.
TaskEither<IError, Project> createProject(ProjectCreate project);
TaskEither<IError, Project> create(ProjectCreate project);
/// Retrieves a project by its unique ID.
///
/// Returns `null` if no project is found.
TaskEither<IError, Project> findProjectById(String id);
TaskEither<IError, Project> findById(String id);
/// Retrieves all projects associated with a specific user.
///
/// Returns an empty list if no projects are found.
TaskEither<IError,List<Project>> findProjectsByUserId(String userId);
TaskEither<IError, List<Project>> findByUserId(String userId);
/// Updates an existing project in the data source.
///
/// Throws an error if the update fails.
TaskEither<IError, Project> updateProject(ProjectUpdate project);
TaskEither<IError, Project> update(ProjectUpdate project);
/// Deletes a project by its unique ID.
///
/// Throws an error if the deletion fails.
TaskEither<IError, Project> deleteProject(String id);
TaskEither<IError, Project> delete(String id);
/// Retrieves all projects in the data source.
///
/// Returns an empty list if no projects exist.
TaskEither<IError, List<Project>> findAllProjects();
TaskEither<IError, List<Project>> findAll();
/// Generates a new unique ID for a task.
TaskEither<IError, String> generateId();
}
@@ -0,0 +1,39 @@
import 'package:backend_dart/domain/entities/project_task.dart';
import 'package:backend_dart/domain/interface/error.dart';
import 'package:fpdart/fpdart.dart';
/// Interface for managing task data interactions.
abstract class ProjectTaskDataSource {
/// Creates a new task in the data source.
///
/// Throws an error if the creation fails.
TaskEither<IError, ProjectTask> create(ProjectTaskCreate task);
/// Retrieves a task by its unique ID.
///
/// Returns `null` if no task is found.
TaskEither<IError, ProjectTask> findById(String id);
/// Retrieves all tasks for a specific project.
///
/// Returns an empty list if no tasks are found.
TaskEither<IError, List<ProjectTask>> findByProjectId(String projectId);
/// Updates an existing task in the data source.
///
/// Throws an error if the update fails.
TaskEither<IError, ProjectTask> update(ProjectTaskUpdate task);
/// Deletes a task by its unique ID.
///
/// Throws an error if the deletion fails.
TaskEither<IError, ProjectTask> delete(String id);
/// Retrieves all tasks in the data source.
///
/// Returns an empty list if no tasks exist.
TaskEither<IError, List<ProjectTask>> findAll();
/// Generates a new unique ID for a task.
TaskEither<IError, String> generateId();
}
@@ -0,0 +1,44 @@
import 'package:backend_dart/domain/entities/time_entry.dart';
import 'package:backend_dart/domain/interface/error.dart';
import 'package:fpdart/fpdart.dart';
/// Interface for managing time entry data interactions.
abstract class TimeEntryDataSource {
/// Creates a new time entry in the data source.
///
/// Throws an error if the creation fails.
TaskEither<IError, TimeEntry> create(TimeEntryCreate timeEntry);
/// Retrieves a time entry by its unique ID.
///
/// Returns `null` if no time entry is found.
TaskEither<IError, TimeEntry> findById(String id);
/// Retrieves all time entries for a specific user.
///
/// Returns an empty list if no time entries are found.
TaskEither<IError, List<TimeEntry>> findByUserId(String userId);
/// Retrieves all time entries for a specific project.
///
/// Returns an empty list if no time entries are found.
TaskEither<IError, List<TimeEntry>> findByProjectId(String projectId);
/// Updates an existing time entry in the data source.
///
/// Throws an error if the update fails.
TaskEither<IError, TimeEntry> update(TimeEntryUpdate timeEntry);
/// Deletes a time entry by its unique ID.
///
/// Throws an error if the deletion fails.
TaskEither<IError, TimeEntry> delete(String id);
/// Retrieves all time entries in the data source.
///
/// Returns an empty list if no time entries exist.
TaskEither<IError, List<TimeEntry>> findAll();
/// Generates a new unique ID for a time entry.
TaskEither<IError, String> generateId();
}
@@ -5,6 +5,7 @@ part 'project.freezed.dart';
@freezed
class ProjectCreate with _$ProjectCreate {
const factory ProjectCreate({
String? id,
required String name,
String? description,
String? clientId,
@@ -16,6 +16,7 @@ final _privateConstructorUsedError = UnsupportedError(
/// @nodoc
mixin _$ProjectCreate {
String? get id => throw _privateConstructorUsedError;
String get name => throw _privateConstructorUsedError;
String? get description => throw _privateConstructorUsedError;
String? get clientId => throw _privateConstructorUsedError;
@@ -35,7 +36,11 @@ abstract class $ProjectCreateCopyWith<$Res> {
_$ProjectCreateCopyWithImpl<$Res, ProjectCreate>;
@useResult
$Res call(
{String name, String? description, String? clientId, String userId});
{String? id,
String name,
String? description,
String? clientId,
String userId});
}
/// @nodoc
@@ -53,12 +58,17 @@ class _$ProjectCreateCopyWithImpl<$Res, $Val extends ProjectCreate>
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = freezed,
Object? name = null,
Object? description = freezed,
Object? clientId = freezed,
Object? userId = null,
}) {
return _then(_value.copyWith(
id: freezed == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String?,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
@@ -88,7 +98,11 @@ abstract class _$$ProjectCreateImplCopyWith<$Res>
@override
@useResult
$Res call(
{String name, String? description, String? clientId, String userId});
{String? id,
String name,
String? description,
String? clientId,
String userId});
}
/// @nodoc
@@ -104,12 +118,17 @@ class __$$ProjectCreateImplCopyWithImpl<$Res>
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = freezed,
Object? name = null,
Object? description = freezed,
Object? clientId = freezed,
Object? userId = null,
}) {
return _then(_$ProjectCreateImpl(
id: freezed == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String?,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
@@ -134,11 +153,14 @@ class __$$ProjectCreateImplCopyWithImpl<$Res>
class _$ProjectCreateImpl implements _ProjectCreate {
const _$ProjectCreateImpl(
{required this.name,
{this.id,
required this.name,
this.description,
this.clientId,
required this.userId});
@override
final String? id;
@override
final String name;
@override
@@ -150,7 +172,7 @@ class _$ProjectCreateImpl implements _ProjectCreate {
@override
String toString() {
return 'ProjectCreate(name: $name, description: $description, clientId: $clientId, userId: $userId)';
return 'ProjectCreate(id: $id, name: $name, description: $description, clientId: $clientId, userId: $userId)';
}
@override
@@ -158,6 +180,7 @@ class _$ProjectCreateImpl implements _ProjectCreate {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ProjectCreateImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.description, description) ||
other.description == description) &&
@@ -168,7 +191,7 @@ class _$ProjectCreateImpl implements _ProjectCreate {
@override
int get hashCode =>
Object.hash(runtimeType, name, description, clientId, userId);
Object.hash(runtimeType, id, name, description, clientId, userId);
/// Create a copy of ProjectCreate
/// with the given fields replaced by the non-null parameter values.
@@ -181,11 +204,14 @@ class _$ProjectCreateImpl implements _ProjectCreate {
abstract class _ProjectCreate implements ProjectCreate {
const factory _ProjectCreate(
{required final String name,
{final String? id,
required final String name,
final String? description,
final String? clientId,
required final String userId}) = _$ProjectCreateImpl;
@override
String? get id;
@override
String get name;
@override
@@ -0,0 +1,35 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'project_task.freezed.dart';
@freezed
class ProjectTask with _$ProjectTask {
const factory ProjectTask({
required String id,
required String name,
String? description,
required String projectId,
required DateTime createdAt,
required DateTime updatedAt,
}) = _ProjectTask;
}
@freezed
class ProjectTaskCreate with _$ProjectTaskCreate {
const factory ProjectTaskCreate({
String? id,
required String name,
String? description,
required String projectId,
}) = _ProjectTaskCreate;
}
@freezed
class ProjectTaskUpdate with _$ProjectTaskUpdate {
const factory ProjectTaskUpdate({
required String id,
String? name,
String? description,
String? projectId,
}) = _ProjectTaskUpdate;
}
@@ -0,0 +1,622 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'project_task.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$ProjectTask {
String get id => throw _privateConstructorUsedError;
String get name => throw _privateConstructorUsedError;
String? get description => throw _privateConstructorUsedError;
String get projectId => throw _privateConstructorUsedError;
DateTime get createdAt => throw _privateConstructorUsedError;
DateTime get updatedAt => throw _privateConstructorUsedError;
/// Create a copy of ProjectTask
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ProjectTaskCopyWith<ProjectTask> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ProjectTaskCopyWith<$Res> {
factory $ProjectTaskCopyWith(
ProjectTask value, $Res Function(ProjectTask) then) =
_$ProjectTaskCopyWithImpl<$Res, ProjectTask>;
@useResult
$Res call(
{String id,
String name,
String? description,
String projectId,
DateTime createdAt,
DateTime updatedAt});
}
/// @nodoc
class _$ProjectTaskCopyWithImpl<$Res, $Val extends ProjectTask>
implements $ProjectTaskCopyWith<$Res> {
_$ProjectTaskCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ProjectTask
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? name = null,
Object? description = freezed,
Object? projectId = null,
Object? createdAt = null,
Object? updatedAt = null,
}) {
return _then(_value.copyWith(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
projectId: null == projectId
? _value.projectId
: projectId // ignore: cast_nullable_to_non_nullable
as String,
createdAt: null == createdAt
? _value.createdAt
: createdAt // ignore: cast_nullable_to_non_nullable
as DateTime,
updatedAt: null == updatedAt
? _value.updatedAt
: updatedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
) as $Val);
}
}
/// @nodoc
abstract class _$$ProjectTaskImplCopyWith<$Res>
implements $ProjectTaskCopyWith<$Res> {
factory _$$ProjectTaskImplCopyWith(
_$ProjectTaskImpl value, $Res Function(_$ProjectTaskImpl) then) =
__$$ProjectTaskImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{String id,
String name,
String? description,
String projectId,
DateTime createdAt,
DateTime updatedAt});
}
/// @nodoc
class __$$ProjectTaskImplCopyWithImpl<$Res>
extends _$ProjectTaskCopyWithImpl<$Res, _$ProjectTaskImpl>
implements _$$ProjectTaskImplCopyWith<$Res> {
__$$ProjectTaskImplCopyWithImpl(
_$ProjectTaskImpl _value, $Res Function(_$ProjectTaskImpl) _then)
: super(_value, _then);
/// Create a copy of ProjectTask
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? name = null,
Object? description = freezed,
Object? projectId = null,
Object? createdAt = null,
Object? updatedAt = null,
}) {
return _then(_$ProjectTaskImpl(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
projectId: null == projectId
? _value.projectId
: projectId // ignore: cast_nullable_to_non_nullable
as String,
createdAt: null == createdAt
? _value.createdAt
: createdAt // ignore: cast_nullable_to_non_nullable
as DateTime,
updatedAt: null == updatedAt
? _value.updatedAt
: updatedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
));
}
}
/// @nodoc
class _$ProjectTaskImpl implements _ProjectTask {
const _$ProjectTaskImpl(
{required this.id,
required this.name,
this.description,
required this.projectId,
required this.createdAt,
required this.updatedAt});
@override
final String id;
@override
final String name;
@override
final String? description;
@override
final String projectId;
@override
final DateTime createdAt;
@override
final DateTime updatedAt;
@override
String toString() {
return 'ProjectTask(id: $id, name: $name, description: $description, projectId: $projectId, createdAt: $createdAt, updatedAt: $updatedAt)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ProjectTaskImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.description, description) ||
other.description == description) &&
(identical(other.projectId, projectId) ||
other.projectId == projectId) &&
(identical(other.createdAt, createdAt) ||
other.createdAt == createdAt) &&
(identical(other.updatedAt, updatedAt) ||
other.updatedAt == updatedAt));
}
@override
int get hashCode => Object.hash(
runtimeType, id, name, description, projectId, createdAt, updatedAt);
/// Create a copy of ProjectTask
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ProjectTaskImplCopyWith<_$ProjectTaskImpl> get copyWith =>
__$$ProjectTaskImplCopyWithImpl<_$ProjectTaskImpl>(this, _$identity);
}
abstract class _ProjectTask implements ProjectTask {
const factory _ProjectTask(
{required final String id,
required final String name,
final String? description,
required final String projectId,
required final DateTime createdAt,
required final DateTime updatedAt}) = _$ProjectTaskImpl;
@override
String get id;
@override
String get name;
@override
String? get description;
@override
String get projectId;
@override
DateTime get createdAt;
@override
DateTime get updatedAt;
/// Create a copy of ProjectTask
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ProjectTaskImplCopyWith<_$ProjectTaskImpl> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
mixin _$ProjectTaskCreate {
String? get id => throw _privateConstructorUsedError;
String get name => throw _privateConstructorUsedError;
String? get description => throw _privateConstructorUsedError;
String get projectId => throw _privateConstructorUsedError;
/// Create a copy of ProjectTaskCreate
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ProjectTaskCreateCopyWith<ProjectTaskCreate> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ProjectTaskCreateCopyWith<$Res> {
factory $ProjectTaskCreateCopyWith(
ProjectTaskCreate value, $Res Function(ProjectTaskCreate) then) =
_$ProjectTaskCreateCopyWithImpl<$Res, ProjectTaskCreate>;
@useResult
$Res call({String? id, String name, String? description, String projectId});
}
/// @nodoc
class _$ProjectTaskCreateCopyWithImpl<$Res, $Val extends ProjectTaskCreate>
implements $ProjectTaskCreateCopyWith<$Res> {
_$ProjectTaskCreateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ProjectTaskCreate
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = freezed,
Object? name = null,
Object? description = freezed,
Object? projectId = null,
}) {
return _then(_value.copyWith(
id: freezed == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String?,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
projectId: null == projectId
? _value.projectId
: projectId // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
}
}
/// @nodoc
abstract class _$$ProjectTaskCreateImplCopyWith<$Res>
implements $ProjectTaskCreateCopyWith<$Res> {
factory _$$ProjectTaskCreateImplCopyWith(_$ProjectTaskCreateImpl value,
$Res Function(_$ProjectTaskCreateImpl) then) =
__$$ProjectTaskCreateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String? id, String name, String? description, String projectId});
}
/// @nodoc
class __$$ProjectTaskCreateImplCopyWithImpl<$Res>
extends _$ProjectTaskCreateCopyWithImpl<$Res, _$ProjectTaskCreateImpl>
implements _$$ProjectTaskCreateImplCopyWith<$Res> {
__$$ProjectTaskCreateImplCopyWithImpl(_$ProjectTaskCreateImpl _value,
$Res Function(_$ProjectTaskCreateImpl) _then)
: super(_value, _then);
/// Create a copy of ProjectTaskCreate
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = freezed,
Object? name = null,
Object? description = freezed,
Object? projectId = null,
}) {
return _then(_$ProjectTaskCreateImpl(
id: freezed == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String?,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
projectId: null == projectId
? _value.projectId
: projectId // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
class _$ProjectTaskCreateImpl implements _ProjectTaskCreate {
const _$ProjectTaskCreateImpl(
{this.id, required this.name, this.description, required this.projectId});
@override
final String? id;
@override
final String name;
@override
final String? description;
@override
final String projectId;
@override
String toString() {
return 'ProjectTaskCreate(id: $id, name: $name, description: $description, projectId: $projectId)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ProjectTaskCreateImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.description, description) ||
other.description == description) &&
(identical(other.projectId, projectId) ||
other.projectId == projectId));
}
@override
int get hashCode =>
Object.hash(runtimeType, id, name, description, projectId);
/// Create a copy of ProjectTaskCreate
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ProjectTaskCreateImplCopyWith<_$ProjectTaskCreateImpl> get copyWith =>
__$$ProjectTaskCreateImplCopyWithImpl<_$ProjectTaskCreateImpl>(
this, _$identity);
}
abstract class _ProjectTaskCreate implements ProjectTaskCreate {
const factory _ProjectTaskCreate(
{final String? id,
required final String name,
final String? description,
required final String projectId}) = _$ProjectTaskCreateImpl;
@override
String? get id;
@override
String get name;
@override
String? get description;
@override
String get projectId;
/// Create a copy of ProjectTaskCreate
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ProjectTaskCreateImplCopyWith<_$ProjectTaskCreateImpl> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
mixin _$ProjectTaskUpdate {
String get id => throw _privateConstructorUsedError;
String? get name => throw _privateConstructorUsedError;
String? get description => throw _privateConstructorUsedError;
String? get projectId => throw _privateConstructorUsedError;
/// Create a copy of ProjectTaskUpdate
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ProjectTaskUpdateCopyWith<ProjectTaskUpdate> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ProjectTaskUpdateCopyWith<$Res> {
factory $ProjectTaskUpdateCopyWith(
ProjectTaskUpdate value, $Res Function(ProjectTaskUpdate) then) =
_$ProjectTaskUpdateCopyWithImpl<$Res, ProjectTaskUpdate>;
@useResult
$Res call({String id, String? name, String? description, String? projectId});
}
/// @nodoc
class _$ProjectTaskUpdateCopyWithImpl<$Res, $Val extends ProjectTaskUpdate>
implements $ProjectTaskUpdateCopyWith<$Res> {
_$ProjectTaskUpdateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ProjectTaskUpdate
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? name = freezed,
Object? description = freezed,
Object? projectId = freezed,
}) {
return _then(_value.copyWith(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
name: freezed == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String?,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
projectId: freezed == projectId
? _value.projectId
: projectId // ignore: cast_nullable_to_non_nullable
as String?,
) as $Val);
}
}
/// @nodoc
abstract class _$$ProjectTaskUpdateImplCopyWith<$Res>
implements $ProjectTaskUpdateCopyWith<$Res> {
factory _$$ProjectTaskUpdateImplCopyWith(_$ProjectTaskUpdateImpl value,
$Res Function(_$ProjectTaskUpdateImpl) then) =
__$$ProjectTaskUpdateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String id, String? name, String? description, String? projectId});
}
/// @nodoc
class __$$ProjectTaskUpdateImplCopyWithImpl<$Res>
extends _$ProjectTaskUpdateCopyWithImpl<$Res, _$ProjectTaskUpdateImpl>
implements _$$ProjectTaskUpdateImplCopyWith<$Res> {
__$$ProjectTaskUpdateImplCopyWithImpl(_$ProjectTaskUpdateImpl _value,
$Res Function(_$ProjectTaskUpdateImpl) _then)
: super(_value, _then);
/// Create a copy of ProjectTaskUpdate
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? name = freezed,
Object? description = freezed,
Object? projectId = freezed,
}) {
return _then(_$ProjectTaskUpdateImpl(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
name: freezed == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String?,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
projectId: freezed == projectId
? _value.projectId
: projectId // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// @nodoc
class _$ProjectTaskUpdateImpl implements _ProjectTaskUpdate {
const _$ProjectTaskUpdateImpl(
{required this.id, this.name, this.description, this.projectId});
@override
final String id;
@override
final String? name;
@override
final String? description;
@override
final String? projectId;
@override
String toString() {
return 'ProjectTaskUpdate(id: $id, name: $name, description: $description, projectId: $projectId)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ProjectTaskUpdateImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.description, description) ||
other.description == description) &&
(identical(other.projectId, projectId) ||
other.projectId == projectId));
}
@override
int get hashCode =>
Object.hash(runtimeType, id, name, description, projectId);
/// Create a copy of ProjectTaskUpdate
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ProjectTaskUpdateImplCopyWith<_$ProjectTaskUpdateImpl> get copyWith =>
__$$ProjectTaskUpdateImplCopyWithImpl<_$ProjectTaskUpdateImpl>(
this, _$identity);
}
abstract class _ProjectTaskUpdate implements ProjectTaskUpdate {
const factory _ProjectTaskUpdate(
{required final String id,
final String? name,
final String? description,
final String? projectId}) = _$ProjectTaskUpdateImpl;
@override
String get id;
@override
String? get name;
@override
String? get description;
@override
String? get projectId;
/// Create a copy of ProjectTaskUpdate
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ProjectTaskUpdateImplCopyWith<_$ProjectTaskUpdateImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -0,0 +1,51 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'time_entry.freezed.dart';
part 'time_entry.g.dart';
@freezed
class TimeEntry with _$TimeEntry {
const factory TimeEntry({
required String id,
required DateTime startTime,
required DateTime endTime,
String? description,
required String userId,
required String projectId,
required DateTime createdAt,
required DateTime updatedAt,
}) = _TimeEntry;
factory TimeEntry.fromJson(Map<String, dynamic> json) =>
_$TimeEntryFromJson(json);
}
@freezed
class TimeEntryCreate with _$TimeEntryCreate {
const factory TimeEntryCreate({
String? id,
required DateTime startTime,
required DateTime endTime,
String? description,
required String userId,
required String projectId,
}) = _TimeEntryCreate;
factory TimeEntryCreate.fromJson(Map<String, dynamic> json) =>
_$TimeEntryCreateFromJson(json);
}
@freezed
class TimeEntryUpdate with _$TimeEntryUpdate {
const factory TimeEntryUpdate({
required String id,
DateTime? startTime,
DateTime? endTime,
String? description,
String? userId,
String? projectId,
}) = _TimeEntryUpdate;
factory TimeEntryUpdate.fromJson(Map<String, dynamic> json) =>
_$TimeEntryUpdateFromJson(json);
}
@@ -0,0 +1,829 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'time_entry.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
TimeEntry _$TimeEntryFromJson(Map<String, dynamic> json) {
return _TimeEntry.fromJson(json);
}
/// @nodoc
mixin _$TimeEntry {
String get id => throw _privateConstructorUsedError;
DateTime get startTime => throw _privateConstructorUsedError;
DateTime get endTime => throw _privateConstructorUsedError;
String? get description => throw _privateConstructorUsedError;
String get userId => throw _privateConstructorUsedError;
String get projectId => throw _privateConstructorUsedError;
DateTime get createdAt => throw _privateConstructorUsedError;
DateTime get updatedAt => throw _privateConstructorUsedError;
/// Serializes this TimeEntry to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of TimeEntry
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$TimeEntryCopyWith<TimeEntry> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $TimeEntryCopyWith<$Res> {
factory $TimeEntryCopyWith(TimeEntry value, $Res Function(TimeEntry) then) =
_$TimeEntryCopyWithImpl<$Res, TimeEntry>;
@useResult
$Res call(
{String id,
DateTime startTime,
DateTime endTime,
String? description,
String userId,
String projectId,
DateTime createdAt,
DateTime updatedAt});
}
/// @nodoc
class _$TimeEntryCopyWithImpl<$Res, $Val extends TimeEntry>
implements $TimeEntryCopyWith<$Res> {
_$TimeEntryCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of TimeEntry
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? startTime = null,
Object? endTime = null,
Object? description = freezed,
Object? userId = null,
Object? projectId = null,
Object? createdAt = null,
Object? updatedAt = null,
}) {
return _then(_value.copyWith(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
startTime: null == startTime
? _value.startTime
: startTime // ignore: cast_nullable_to_non_nullable
as DateTime,
endTime: null == endTime
? _value.endTime
: endTime // ignore: cast_nullable_to_non_nullable
as DateTime,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
userId: null == userId
? _value.userId
: userId // ignore: cast_nullable_to_non_nullable
as String,
projectId: null == projectId
? _value.projectId
: projectId // ignore: cast_nullable_to_non_nullable
as String,
createdAt: null == createdAt
? _value.createdAt
: createdAt // ignore: cast_nullable_to_non_nullable
as DateTime,
updatedAt: null == updatedAt
? _value.updatedAt
: updatedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
) as $Val);
}
}
/// @nodoc
abstract class _$$TimeEntryImplCopyWith<$Res>
implements $TimeEntryCopyWith<$Res> {
factory _$$TimeEntryImplCopyWith(
_$TimeEntryImpl value, $Res Function(_$TimeEntryImpl) then) =
__$$TimeEntryImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{String id,
DateTime startTime,
DateTime endTime,
String? description,
String userId,
String projectId,
DateTime createdAt,
DateTime updatedAt});
}
/// @nodoc
class __$$TimeEntryImplCopyWithImpl<$Res>
extends _$TimeEntryCopyWithImpl<$Res, _$TimeEntryImpl>
implements _$$TimeEntryImplCopyWith<$Res> {
__$$TimeEntryImplCopyWithImpl(
_$TimeEntryImpl _value, $Res Function(_$TimeEntryImpl) _then)
: super(_value, _then);
/// Create a copy of TimeEntry
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? startTime = null,
Object? endTime = null,
Object? description = freezed,
Object? userId = null,
Object? projectId = null,
Object? createdAt = null,
Object? updatedAt = null,
}) {
return _then(_$TimeEntryImpl(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
startTime: null == startTime
? _value.startTime
: startTime // ignore: cast_nullable_to_non_nullable
as DateTime,
endTime: null == endTime
? _value.endTime
: endTime // ignore: cast_nullable_to_non_nullable
as DateTime,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
userId: null == userId
? _value.userId
: userId // ignore: cast_nullable_to_non_nullable
as String,
projectId: null == projectId
? _value.projectId
: projectId // ignore: cast_nullable_to_non_nullable
as String,
createdAt: null == createdAt
? _value.createdAt
: createdAt // ignore: cast_nullable_to_non_nullable
as DateTime,
updatedAt: null == updatedAt
? _value.updatedAt
: updatedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
));
}
}
/// @nodoc
@JsonSerializable()
class _$TimeEntryImpl implements _TimeEntry {
const _$TimeEntryImpl(
{required this.id,
required this.startTime,
required this.endTime,
this.description,
required this.userId,
required this.projectId,
required this.createdAt,
required this.updatedAt});
factory _$TimeEntryImpl.fromJson(Map<String, dynamic> json) =>
_$$TimeEntryImplFromJson(json);
@override
final String id;
@override
final DateTime startTime;
@override
final DateTime endTime;
@override
final String? description;
@override
final String userId;
@override
final String projectId;
@override
final DateTime createdAt;
@override
final DateTime updatedAt;
@override
String toString() {
return 'TimeEntry(id: $id, startTime: $startTime, endTime: $endTime, description: $description, userId: $userId, projectId: $projectId, createdAt: $createdAt, updatedAt: $updatedAt)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$TimeEntryImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.startTime, startTime) ||
other.startTime == startTime) &&
(identical(other.endTime, endTime) || other.endTime == endTime) &&
(identical(other.description, description) ||
other.description == description) &&
(identical(other.userId, userId) || other.userId == userId) &&
(identical(other.projectId, projectId) ||
other.projectId == projectId) &&
(identical(other.createdAt, createdAt) ||
other.createdAt == createdAt) &&
(identical(other.updatedAt, updatedAt) ||
other.updatedAt == updatedAt));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, id, startTime, endTime,
description, userId, projectId, createdAt, updatedAt);
/// Create a copy of TimeEntry
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$TimeEntryImplCopyWith<_$TimeEntryImpl> get copyWith =>
__$$TimeEntryImplCopyWithImpl<_$TimeEntryImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$TimeEntryImplToJson(
this,
);
}
}
abstract class _TimeEntry implements TimeEntry {
const factory _TimeEntry(
{required final String id,
required final DateTime startTime,
required final DateTime endTime,
final String? description,
required final String userId,
required final String projectId,
required final DateTime createdAt,
required final DateTime updatedAt}) = _$TimeEntryImpl;
factory _TimeEntry.fromJson(Map<String, dynamic> json) =
_$TimeEntryImpl.fromJson;
@override
String get id;
@override
DateTime get startTime;
@override
DateTime get endTime;
@override
String? get description;
@override
String get userId;
@override
String get projectId;
@override
DateTime get createdAt;
@override
DateTime get updatedAt;
/// Create a copy of TimeEntry
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$TimeEntryImplCopyWith<_$TimeEntryImpl> get copyWith =>
throw _privateConstructorUsedError;
}
TimeEntryCreate _$TimeEntryCreateFromJson(Map<String, dynamic> json) {
return _TimeEntryCreate.fromJson(json);
}
/// @nodoc
mixin _$TimeEntryCreate {
String? get id => throw _privateConstructorUsedError;
DateTime get startTime => throw _privateConstructorUsedError;
DateTime get endTime => throw _privateConstructorUsedError;
String? get description => throw _privateConstructorUsedError;
String get userId => throw _privateConstructorUsedError;
String get projectId => throw _privateConstructorUsedError;
/// Serializes this TimeEntryCreate to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of TimeEntryCreate
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$TimeEntryCreateCopyWith<TimeEntryCreate> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $TimeEntryCreateCopyWith<$Res> {
factory $TimeEntryCreateCopyWith(
TimeEntryCreate value, $Res Function(TimeEntryCreate) then) =
_$TimeEntryCreateCopyWithImpl<$Res, TimeEntryCreate>;
@useResult
$Res call(
{String? id,
DateTime startTime,
DateTime endTime,
String? description,
String userId,
String projectId});
}
/// @nodoc
class _$TimeEntryCreateCopyWithImpl<$Res, $Val extends TimeEntryCreate>
implements $TimeEntryCreateCopyWith<$Res> {
_$TimeEntryCreateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of TimeEntryCreate
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = freezed,
Object? startTime = null,
Object? endTime = null,
Object? description = freezed,
Object? userId = null,
Object? projectId = null,
}) {
return _then(_value.copyWith(
id: freezed == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String?,
startTime: null == startTime
? _value.startTime
: startTime // ignore: cast_nullable_to_non_nullable
as DateTime,
endTime: null == endTime
? _value.endTime
: endTime // ignore: cast_nullable_to_non_nullable
as DateTime,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
userId: null == userId
? _value.userId
: userId // ignore: cast_nullable_to_non_nullable
as String,
projectId: null == projectId
? _value.projectId
: projectId // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
}
}
/// @nodoc
abstract class _$$TimeEntryCreateImplCopyWith<$Res>
implements $TimeEntryCreateCopyWith<$Res> {
factory _$$TimeEntryCreateImplCopyWith(_$TimeEntryCreateImpl value,
$Res Function(_$TimeEntryCreateImpl) then) =
__$$TimeEntryCreateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{String? id,
DateTime startTime,
DateTime endTime,
String? description,
String userId,
String projectId});
}
/// @nodoc
class __$$TimeEntryCreateImplCopyWithImpl<$Res>
extends _$TimeEntryCreateCopyWithImpl<$Res, _$TimeEntryCreateImpl>
implements _$$TimeEntryCreateImplCopyWith<$Res> {
__$$TimeEntryCreateImplCopyWithImpl(
_$TimeEntryCreateImpl _value, $Res Function(_$TimeEntryCreateImpl) _then)
: super(_value, _then);
/// Create a copy of TimeEntryCreate
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = freezed,
Object? startTime = null,
Object? endTime = null,
Object? description = freezed,
Object? userId = null,
Object? projectId = null,
}) {
return _then(_$TimeEntryCreateImpl(
id: freezed == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String?,
startTime: null == startTime
? _value.startTime
: startTime // ignore: cast_nullable_to_non_nullable
as DateTime,
endTime: null == endTime
? _value.endTime
: endTime // ignore: cast_nullable_to_non_nullable
as DateTime,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
userId: null == userId
? _value.userId
: userId // ignore: cast_nullable_to_non_nullable
as String,
projectId: null == projectId
? _value.projectId
: projectId // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
@JsonSerializable()
class _$TimeEntryCreateImpl implements _TimeEntryCreate {
const _$TimeEntryCreateImpl(
{this.id,
required this.startTime,
required this.endTime,
this.description,
required this.userId,
required this.projectId});
factory _$TimeEntryCreateImpl.fromJson(Map<String, dynamic> json) =>
_$$TimeEntryCreateImplFromJson(json);
@override
final String? id;
@override
final DateTime startTime;
@override
final DateTime endTime;
@override
final String? description;
@override
final String userId;
@override
final String projectId;
@override
String toString() {
return 'TimeEntryCreate(id: $id, startTime: $startTime, endTime: $endTime, description: $description, userId: $userId, projectId: $projectId)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$TimeEntryCreateImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.startTime, startTime) ||
other.startTime == startTime) &&
(identical(other.endTime, endTime) || other.endTime == endTime) &&
(identical(other.description, description) ||
other.description == description) &&
(identical(other.userId, userId) || other.userId == userId) &&
(identical(other.projectId, projectId) ||
other.projectId == projectId));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType, id, startTime, endTime, description, userId, projectId);
/// Create a copy of TimeEntryCreate
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$TimeEntryCreateImplCopyWith<_$TimeEntryCreateImpl> get copyWith =>
__$$TimeEntryCreateImplCopyWithImpl<_$TimeEntryCreateImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$TimeEntryCreateImplToJson(
this,
);
}
}
abstract class _TimeEntryCreate implements TimeEntryCreate {
const factory _TimeEntryCreate(
{final String? id,
required final DateTime startTime,
required final DateTime endTime,
final String? description,
required final String userId,
required final String projectId}) = _$TimeEntryCreateImpl;
factory _TimeEntryCreate.fromJson(Map<String, dynamic> json) =
_$TimeEntryCreateImpl.fromJson;
@override
String? get id;
@override
DateTime get startTime;
@override
DateTime get endTime;
@override
String? get description;
@override
String get userId;
@override
String get projectId;
/// Create a copy of TimeEntryCreate
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$TimeEntryCreateImplCopyWith<_$TimeEntryCreateImpl> get copyWith =>
throw _privateConstructorUsedError;
}
TimeEntryUpdate _$TimeEntryUpdateFromJson(Map<String, dynamic> json) {
return _TimeEntryUpdate.fromJson(json);
}
/// @nodoc
mixin _$TimeEntryUpdate {
String get id => throw _privateConstructorUsedError;
DateTime? get startTime => throw _privateConstructorUsedError;
DateTime? get endTime => throw _privateConstructorUsedError;
String? get description => throw _privateConstructorUsedError;
String? get userId => throw _privateConstructorUsedError;
String? get projectId => throw _privateConstructorUsedError;
/// Serializes this TimeEntryUpdate to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of TimeEntryUpdate
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$TimeEntryUpdateCopyWith<TimeEntryUpdate> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $TimeEntryUpdateCopyWith<$Res> {
factory $TimeEntryUpdateCopyWith(
TimeEntryUpdate value, $Res Function(TimeEntryUpdate) then) =
_$TimeEntryUpdateCopyWithImpl<$Res, TimeEntryUpdate>;
@useResult
$Res call(
{String id,
DateTime? startTime,
DateTime? endTime,
String? description,
String? userId,
String? projectId});
}
/// @nodoc
class _$TimeEntryUpdateCopyWithImpl<$Res, $Val extends TimeEntryUpdate>
implements $TimeEntryUpdateCopyWith<$Res> {
_$TimeEntryUpdateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of TimeEntryUpdate
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? startTime = freezed,
Object? endTime = freezed,
Object? description = freezed,
Object? userId = freezed,
Object? projectId = freezed,
}) {
return _then(_value.copyWith(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
startTime: freezed == startTime
? _value.startTime
: startTime // ignore: cast_nullable_to_non_nullable
as DateTime?,
endTime: freezed == endTime
? _value.endTime
: endTime // ignore: cast_nullable_to_non_nullable
as DateTime?,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
userId: freezed == userId
? _value.userId
: userId // ignore: cast_nullable_to_non_nullable
as String?,
projectId: freezed == projectId
? _value.projectId
: projectId // ignore: cast_nullable_to_non_nullable
as String?,
) as $Val);
}
}
/// @nodoc
abstract class _$$TimeEntryUpdateImplCopyWith<$Res>
implements $TimeEntryUpdateCopyWith<$Res> {
factory _$$TimeEntryUpdateImplCopyWith(_$TimeEntryUpdateImpl value,
$Res Function(_$TimeEntryUpdateImpl) then) =
__$$TimeEntryUpdateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{String id,
DateTime? startTime,
DateTime? endTime,
String? description,
String? userId,
String? projectId});
}
/// @nodoc
class __$$TimeEntryUpdateImplCopyWithImpl<$Res>
extends _$TimeEntryUpdateCopyWithImpl<$Res, _$TimeEntryUpdateImpl>
implements _$$TimeEntryUpdateImplCopyWith<$Res> {
__$$TimeEntryUpdateImplCopyWithImpl(
_$TimeEntryUpdateImpl _value, $Res Function(_$TimeEntryUpdateImpl) _then)
: super(_value, _then);
/// Create a copy of TimeEntryUpdate
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? startTime = freezed,
Object? endTime = freezed,
Object? description = freezed,
Object? userId = freezed,
Object? projectId = freezed,
}) {
return _then(_$TimeEntryUpdateImpl(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
startTime: freezed == startTime
? _value.startTime
: startTime // ignore: cast_nullable_to_non_nullable
as DateTime?,
endTime: freezed == endTime
? _value.endTime
: endTime // ignore: cast_nullable_to_non_nullable
as DateTime?,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
userId: freezed == userId
? _value.userId
: userId // ignore: cast_nullable_to_non_nullable
as String?,
projectId: freezed == projectId
? _value.projectId
: projectId // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// @nodoc
@JsonSerializable()
class _$TimeEntryUpdateImpl implements _TimeEntryUpdate {
const _$TimeEntryUpdateImpl(
{required this.id,
this.startTime,
this.endTime,
this.description,
this.userId,
this.projectId});
factory _$TimeEntryUpdateImpl.fromJson(Map<String, dynamic> json) =>
_$$TimeEntryUpdateImplFromJson(json);
@override
final String id;
@override
final DateTime? startTime;
@override
final DateTime? endTime;
@override
final String? description;
@override
final String? userId;
@override
final String? projectId;
@override
String toString() {
return 'TimeEntryUpdate(id: $id, startTime: $startTime, endTime: $endTime, description: $description, userId: $userId, projectId: $projectId)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$TimeEntryUpdateImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.startTime, startTime) ||
other.startTime == startTime) &&
(identical(other.endTime, endTime) || other.endTime == endTime) &&
(identical(other.description, description) ||
other.description == description) &&
(identical(other.userId, userId) || other.userId == userId) &&
(identical(other.projectId, projectId) ||
other.projectId == projectId));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType, id, startTime, endTime, description, userId, projectId);
/// Create a copy of TimeEntryUpdate
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$TimeEntryUpdateImplCopyWith<_$TimeEntryUpdateImpl> get copyWith =>
__$$TimeEntryUpdateImplCopyWithImpl<_$TimeEntryUpdateImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$TimeEntryUpdateImplToJson(
this,
);
}
}
abstract class _TimeEntryUpdate implements TimeEntryUpdate {
const factory _TimeEntryUpdate(
{required final String id,
final DateTime? startTime,
final DateTime? endTime,
final String? description,
final String? userId,
final String? projectId}) = _$TimeEntryUpdateImpl;
factory _TimeEntryUpdate.fromJson(Map<String, dynamic> json) =
_$TimeEntryUpdateImpl.fromJson;
@override
String get id;
@override
DateTime? get startTime;
@override
DateTime? get endTime;
@override
String? get description;
@override
String? get userId;
@override
String? get projectId;
/// Create a copy of TimeEntryUpdate
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$TimeEntryUpdateImplCopyWith<_$TimeEntryUpdateImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -0,0 +1,79 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'time_entry.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$TimeEntryImpl _$$TimeEntryImplFromJson(Map<String, dynamic> json) =>
_$TimeEntryImpl(
id: json['id'] as String,
startTime: DateTime.parse(json['startTime'] as String),
endTime: DateTime.parse(json['endTime'] as String),
description: json['description'] as String?,
userId: json['userId'] as String,
projectId: json['projectId'] as String,
createdAt: DateTime.parse(json['createdAt'] as String),
updatedAt: DateTime.parse(json['updatedAt'] as String),
);
Map<String, dynamic> _$$TimeEntryImplToJson(_$TimeEntryImpl instance) =>
<String, dynamic>{
'id': instance.id,
'startTime': instance.startTime.toIso8601String(),
'endTime': instance.endTime.toIso8601String(),
'description': instance.description,
'userId': instance.userId,
'projectId': instance.projectId,
'createdAt': instance.createdAt.toIso8601String(),
'updatedAt': instance.updatedAt.toIso8601String(),
};
_$TimeEntryCreateImpl _$$TimeEntryCreateImplFromJson(
Map<String, dynamic> json) =>
_$TimeEntryCreateImpl(
id: json['id'] as String?,
startTime: DateTime.parse(json['startTime'] as String),
endTime: DateTime.parse(json['endTime'] as String),
description: json['description'] as String?,
userId: json['userId'] as String,
projectId: json['projectId'] as String,
);
Map<String, dynamic> _$$TimeEntryCreateImplToJson(
_$TimeEntryCreateImpl instance) =>
<String, dynamic>{
'id': instance.id,
'startTime': instance.startTime.toIso8601String(),
'endTime': instance.endTime.toIso8601String(),
'description': instance.description,
'userId': instance.userId,
'projectId': instance.projectId,
};
_$TimeEntryUpdateImpl _$$TimeEntryUpdateImplFromJson(
Map<String, dynamic> json) =>
_$TimeEntryUpdateImpl(
id: json['id'] as String,
startTime: json['startTime'] == null
? null
: DateTime.parse(json['startTime'] as String),
endTime: json['endTime'] == null
? null
: DateTime.parse(json['endTime'] as String),
description: json['description'] as String?,
userId: json['userId'] as String?,
projectId: json['projectId'] as String?,
);
Map<String, dynamic> _$$TimeEntryUpdateImplToJson(
_$TimeEntryUpdateImpl instance) =>
<String, dynamic>{
'id': instance.id,
'startTime': instance.startTime?.toIso8601String(),
'endTime': instance.endTime?.toIso8601String(),
'description': instance.description,
'userId': instance.userId,
'projectId': instance.projectId,
};
@@ -0,0 +1,20 @@
import 'package:fpdart/fpdart.dart';
import 'package:backend_dart/domain/entities/project.dart';
import 'package:backend_dart/domain/interface/error.dart';
abstract class ProjectRepository {
/// Creates a new project.
TaskEither<IError, Project> create(ProjectCreate project);
/// Finds a project by its unique ID.
TaskEither<IError, Project> findById(String id);
/// Updates an existing project.
TaskEither<IError, Project> update(ProjectUpdate project);
/// Deletes a project by its unique ID.
TaskEither<IError, void> delete(String id);
/// Finds all projects.
TaskEither<IError, List<Project>> findAll();
}
@@ -0,0 +1,23 @@
import 'package:fpdart/fpdart.dart';
import 'package:backend_dart/domain/entities/project_task.dart';
import 'package:backend_dart/domain/interface/error.dart';
abstract class ProjectTaskRepository {
/// Creates a new project task.
TaskEither<IError, ProjectTask> create(ProjectTaskCreate task);
/// Finds a project task by its unique ID.
TaskEither<IError, ProjectTask> findById(String id);
/// Finds all tasks for a specific project.
TaskEither<IError, List<ProjectTask>> findByProjectId(String projectId);
/// Updates an existing project task.
TaskEither<IError, ProjectTask> update(ProjectTaskUpdate task);
/// Deletes a project task by its unique ID.
TaskEither<IError, void> delete(String id);
/// Finds all project tasks.
TaskEither<IError, List<ProjectTask>> findAll();
}
@@ -0,0 +1,26 @@
import 'package:fpdart/fpdart.dart';
import 'package:backend_dart/domain/entities/time_entry.dart';
import 'package:backend_dart/domain/interface/error.dart';
abstract class TimeEntryRepository {
/// Creates a new time entry.
TaskEither<IError, TimeEntry> create(TimeEntryCreate timeEntry);
/// Finds a time entry by its unique ID.
TaskEither<IError, TimeEntry> findById(String id);
/// Finds all time entries for a specific user.
TaskEither<IError, List<TimeEntry>> findByUserId(String userId);
/// Finds all time entries for a specific project.
TaskEither<IError, List<TimeEntry>> findByProjectId(String projectId);
/// Updates an existing time entry.
TaskEither<IError, TimeEntry> update(TimeEntryUpdate timeEntry);
/// Deletes a time entry by its unique ID.
TaskEither<IError, void> delete(String id);
/// Finds all time entries.
TaskEither<IError, List<TimeEntry>> findAll();
}