From 10c72f22c5d37f71e1ae08f6c2e03a7c498454a7 Mon Sep 17 00:00:00 2001 From: Jean Jacques Avril Date: Wed, 1 Jan 2025 21:36:20 +0000 Subject: [PATCH] implemented other repos, services, objects ... --- .../repository/project_repository_impl.dart | 38 + .../project_task_repository_impl.dart | 43 + .../lib/application/repository/provider.dart | 21 + .../time_entry_repository_impl.dart | 48 + .../application/service/dto/project_dto.dart | 50 ++ .../service/dto/project_dto.freezed.dart | 741 ++++++++++++++++ .../service/dto/project_dto.g.dart | 67 ++ .../service/dto/project_task_dto.dart | 46 + .../service/dto/project_task_dto.freezed.dart | 654 ++++++++++++++ .../service/dto/project_task_dto.g.dart | 60 ++ .../service/dto/time_entry_dto.dart | 52 ++ .../service/dto/time_entry_dto.freezed.dart | 790 +++++++++++++++++ .../service/dto/time_entry_dto.g.dart | 75 ++ .../service/mapper/project_dto_mapper.dart | 38 + .../mapper/project_task_dto_mapper.dart | 38 + .../service/mapper/time_entry_dto_mapper.dart | 43 + .../service/mapper/user_dto_mapper.dart | 18 +- .../application/service/project_service.dart | 78 ++ .../service/project_service.g.dart | 37 + .../service/project_task_service.dart | 77 ++ .../service/project_task_service.g.dart | 37 + .../application/service/service_provider.dart | 26 + .../service/time_entry_service.dart | 77 ++ .../service/time_entry_service.g.dart | 37 + .../service/user_service_provider.dart | 8 - backend-dart/lib/domain/data/database.dart | 7 + .../lib/domain/data/project_data_source.dart | 15 +- .../domain/data/project_task_data_source.dart | 39 + .../domain/data/time_entry_data_source.dart | 44 + backend-dart/lib/domain/entities/project.dart | 1 + .../lib/domain/entities/project.freezed.dart | 38 +- .../lib/domain/entities/project_task.dart | 35 + .../domain/entities/project_task.freezed.dart | 622 +++++++++++++ .../lib/domain/entities/time_entry.dart | 51 ++ .../domain/entities/time_entry.freezed.dart | 829 ++++++++++++++++++ .../lib/domain/entities/time_entry.g.dart | 79 ++ .../domain/repository/project_repository.dart | 20 + .../repository/project_task_repository.dart | 23 + .../repository/time_entry_repository.dart | 26 + .../infrastructure/persistence/db/client.dart | 295 ++++--- .../infrastructure/persistence/db/model.dart | 18 +- .../infrastructure/persistence/db/prisma.dart | 607 +++++++------ .../mapper/project_dbo_mapper.dart | 21 +- .../mapper/project_task_dbo_mapper.dart | 52 ++ .../mapper/time_entry_dbo_mapper.dart | 69 ++ .../persistence/prisma_database.dart | 19 + .../prisma_project_data_source.dart | 32 +- .../prisma_project_task_data_source.dart | 139 +++ .../prisma_time_entry_data_source.dart | 150 ++++ backend-dart/lib/interfaces/http/router.dart | 8 +- backend-dart/prisma/schema.prisma | 4 +- 51 files changed, 5940 insertions(+), 502 deletions(-) create mode 100644 backend-dart/lib/application/repository/project_repository_impl.dart create mode 100644 backend-dart/lib/application/repository/project_task_repository_impl.dart create mode 100644 backend-dart/lib/application/repository/time_entry_repository_impl.dart create mode 100644 backend-dart/lib/application/service/dto/project_dto.dart create mode 100644 backend-dart/lib/application/service/dto/project_dto.freezed.dart create mode 100644 backend-dart/lib/application/service/dto/project_dto.g.dart create mode 100644 backend-dart/lib/application/service/dto/project_task_dto.dart create mode 100644 backend-dart/lib/application/service/dto/project_task_dto.freezed.dart create mode 100644 backend-dart/lib/application/service/dto/project_task_dto.g.dart create mode 100644 backend-dart/lib/application/service/dto/time_entry_dto.dart create mode 100644 backend-dart/lib/application/service/dto/time_entry_dto.freezed.dart create mode 100644 backend-dart/lib/application/service/dto/time_entry_dto.g.dart create mode 100644 backend-dart/lib/application/service/mapper/project_dto_mapper.dart create mode 100644 backend-dart/lib/application/service/mapper/project_task_dto_mapper.dart create mode 100644 backend-dart/lib/application/service/mapper/time_entry_dto_mapper.dart create mode 100644 backend-dart/lib/application/service/project_service.dart create mode 100644 backend-dart/lib/application/service/project_service.g.dart create mode 100644 backend-dart/lib/application/service/project_task_service.dart create mode 100644 backend-dart/lib/application/service/project_task_service.g.dart create mode 100644 backend-dart/lib/application/service/service_provider.dart create mode 100644 backend-dart/lib/application/service/time_entry_service.dart create mode 100644 backend-dart/lib/application/service/time_entry_service.g.dart delete mode 100644 backend-dart/lib/application/service/user_service_provider.dart create mode 100644 backend-dart/lib/domain/data/project_task_data_source.dart create mode 100644 backend-dart/lib/domain/data/time_entry_data_source.dart create mode 100644 backend-dart/lib/domain/entities/project_task.dart create mode 100644 backend-dart/lib/domain/entities/project_task.freezed.dart create mode 100644 backend-dart/lib/domain/entities/time_entry.dart create mode 100644 backend-dart/lib/domain/entities/time_entry.freezed.dart create mode 100644 backend-dart/lib/domain/entities/time_entry.g.dart create mode 100644 backend-dart/lib/domain/repository/project_repository.dart create mode 100644 backend-dart/lib/domain/repository/project_task_repository.dart create mode 100644 backend-dart/lib/domain/repository/time_entry_repository.dart create mode 100644 backend-dart/lib/infrastructure/persistence/mapper/project_task_dbo_mapper.dart create mode 100644 backend-dart/lib/infrastructure/persistence/mapper/time_entry_dbo_mapper.dart create mode 100644 backend-dart/lib/infrastructure/persistence/prisma_project_task_data_source.dart create mode 100644 backend-dart/lib/infrastructure/persistence/prisma_time_entry_data_source.dart diff --git a/backend-dart/lib/application/repository/project_repository_impl.dart b/backend-dart/lib/application/repository/project_repository_impl.dart new file mode 100644 index 0000000..28b8311 --- /dev/null +++ b/backend-dart/lib/application/repository/project_repository_impl.dart @@ -0,0 +1,38 @@ +import 'package:backend_dart/domain/data/database.dart'; +import 'package:backend_dart/domain/entities/project.dart'; +import 'package:backend_dart/domain/interface/error.dart'; +import 'package:backend_dart/domain/repository/project_repository.dart'; +import 'package:fpdart/fpdart.dart'; + +class ProjectRepositoryImpl implements ProjectRepository { + final IDatabase database; + ProjectRepositoryImpl(this.database); + + @override + TaskEither create(ProjectCreate project) { + return database.projects + .generateId() + .map((id) => project.copyWith(id: id)) + .flatMap(database.projects.create); + } + + @override + TaskEither findById(String id) { + return database.projects.findById(id); + } + + @override + TaskEither update(ProjectUpdate project) { + return database.projects.update(project); + } + + @override + TaskEither delete(String id) { + return database.projects.delete(id); + } + + @override + TaskEither> findAll() { + return database.projects.findAll(); + } +} diff --git a/backend-dart/lib/application/repository/project_task_repository_impl.dart b/backend-dart/lib/application/repository/project_task_repository_impl.dart new file mode 100644 index 0000000..7af4537 --- /dev/null +++ b/backend-dart/lib/application/repository/project_task_repository_impl.dart @@ -0,0 +1,43 @@ +import 'package:backend_dart/domain/data/database.dart'; +import 'package:backend_dart/domain/entities/project_task.dart'; +import 'package:backend_dart/domain/interface/error.dart'; +import 'package:backend_dart/domain/repository/project_task_repository.dart'; +import 'package:fpdart/fpdart.dart'; + +class ProjectTaskRepositoryImpl implements ProjectTaskRepository { + final IDatabase database; + ProjectTaskRepositoryImpl(this.database); + + @override + TaskEither create(ProjectTaskCreate task) { + return database.tasks + .generateId() + .map((id) => task.copyWith(id: id)) + .flatMap(database.tasks.create); + } + + @override + TaskEither findById(String id) { + return database.tasks.findById(id); + } + + @override + TaskEither> findByProjectId(String projectId) { + return database.tasks.findByProjectId(projectId); + } + + @override + TaskEither update(ProjectTaskUpdate task) { + return database.tasks.update(task); + } + + @override + TaskEither delete(String id) { + return database.tasks.delete(id); + } + + @override + TaskEither> findAll() { + return database.tasks.findAll(); + } +} diff --git a/backend-dart/lib/application/repository/provider.dart b/backend-dart/lib/application/repository/provider.dart index 13706b3..2f89b13 100644 --- a/backend-dart/lib/application/repository/provider.dart +++ b/backend-dart/lib/application/repository/provider.dart @@ -1,4 +1,10 @@ +import 'package:backend_dart/application/repository/project_repository_impl.dart'; +import 'package:backend_dart/application/repository/project_task_repository_impl.dart'; +import 'package:backend_dart/application/repository/time_entry_repository_impl.dart'; import 'package:backend_dart/application/repository/user_repository_impl.dart'; +import 'package:backend_dart/domain/repository/project_repository.dart'; +import 'package:backend_dart/domain/repository/project_task_repository.dart'; +import 'package:backend_dart/domain/repository/time_entry_repository.dart'; import 'package:backend_dart/domain/repository/user_repository.dart'; import 'package:backend_dart/infrastructure/persistence/database_provider.dart'; import 'package:riverpod/riverpod.dart'; @@ -7,3 +13,18 @@ final userRepoProvider = Provider((ref) { final database = ref.read(databaseProvider); return UserRepositoryImpl(database); }); + +final projectTaskProvider = Provider((ref) { + final database = ref.read(databaseProvider); + return ProjectTaskRepositoryImpl(database); +}); + +final projectProvider = Provider((ref) { + final database = ref.read(databaseProvider); + return ProjectRepositoryImpl(database); +}); + +final timeEntryProvider = Provider((ref) { + final database = ref.read(databaseProvider); + return TimeEntryRepositoryImpl(database); +}); diff --git a/backend-dart/lib/application/repository/time_entry_repository_impl.dart b/backend-dart/lib/application/repository/time_entry_repository_impl.dart new file mode 100644 index 0000000..5ab497a --- /dev/null +++ b/backend-dart/lib/application/repository/time_entry_repository_impl.dart @@ -0,0 +1,48 @@ +import 'package:backend_dart/domain/data/database.dart'; +import 'package:backend_dart/domain/entities/time_entry.dart'; +import 'package:backend_dart/domain/interface/error.dart'; +import 'package:backend_dart/domain/repository/time_entry_repository.dart'; +import 'package:fpdart/fpdart.dart'; + +class TimeEntryRepositoryImpl implements TimeEntryRepository { + final IDatabase database; + TimeEntryRepositoryImpl(this.database); + + @override + TaskEither create(TimeEntryCreate timeEntry) { + return database.timeEntries + .generateId() + .map((id) => timeEntry.copyWith(id: id)) + .flatMap(database.timeEntries.create); + } + + @override + TaskEither findById(String id) { + return database.timeEntries.findById(id); + } + + @override + TaskEither> findByUserId(String userId) { + return database.timeEntries.findByUserId(userId); + } + + @override + TaskEither> findByProjectId(String projectId) { + return database.timeEntries.findByProjectId(projectId); + } + + @override + TaskEither update(TimeEntryUpdate timeEntry) { + return database.timeEntries.update(timeEntry); + } + + @override + TaskEither delete(String id) { + return database.timeEntries.delete(id); + } + + @override + TaskEither> findAll() { + return database.timeEntries.findAll(); + } +} diff --git a/backend-dart/lib/application/service/dto/project_dto.dart b/backend-dart/lib/application/service/dto/project_dto.dart new file mode 100644 index 0000000..d155475 --- /dev/null +++ b/backend-dart/lib/application/service/dto/project_dto.dart @@ -0,0 +1,50 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'project_dto.freezed.dart'; +part 'project_dto.g.dart'; + +@freezed +class ProjectDto with _$ProjectDto { + const factory ProjectDto({ + required String id, + required String name, + String? description, + String? clientId, + required String userId, + required DateTime createdAt, + required DateTime updatedAt, + }) = _ProjectDto; + + /// JSON-Serialisierung + factory ProjectDto.fromJson(Map json) => + _$ProjectDtoFromJson(json); +} + +@freezed +class ProjectCreateDto with _$ProjectCreateDto { + const factory ProjectCreateDto({ + required String name, + String? description, + String? clientId, + required String userId, + }) = _ProjectCreateDto; + + /// JSON-Serialisierung + factory ProjectCreateDto.fromJson(Map json) => + _$ProjectCreateDtoFromJson(json); +} + +@freezed +class ProjectUpdateDto with _$ProjectUpdateDto { + const factory ProjectUpdateDto({ + required String id, + String? name, + String? description, + String? clientId, + String? userId, + }) = _ProjectUpdateDto; + + /// JSON-Serialisierung + factory ProjectUpdateDto.fromJson(Map json) => + _$ProjectUpdateDtoFromJson(json); +} diff --git a/backend-dart/lib/application/service/dto/project_dto.freezed.dart b/backend-dart/lib/application/service/dto/project_dto.freezed.dart new file mode 100644 index 0000000..55d5cde --- /dev/null +++ b/backend-dart/lib/application/service/dto/project_dto.freezed.dart @@ -0,0 +1,741 @@ +// 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_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(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'); + +ProjectDto _$ProjectDtoFromJson(Map json) { + return _ProjectDto.fromJson(json); +} + +/// @nodoc +mixin _$ProjectDto { + String get id => throw _privateConstructorUsedError; + String get name => throw _privateConstructorUsedError; + String? get description => throw _privateConstructorUsedError; + String? get clientId => throw _privateConstructorUsedError; + String get userId => throw _privateConstructorUsedError; + DateTime get createdAt => throw _privateConstructorUsedError; + DateTime get updatedAt => throw _privateConstructorUsedError; + + /// Serializes this ProjectDto to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of ProjectDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $ProjectDtoCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ProjectDtoCopyWith<$Res> { + factory $ProjectDtoCopyWith( + ProjectDto value, $Res Function(ProjectDto) then) = + _$ProjectDtoCopyWithImpl<$Res, ProjectDto>; + @useResult + $Res call( + {String id, + String name, + String? description, + String? clientId, + String userId, + DateTime createdAt, + DateTime updatedAt}); +} + +/// @nodoc +class _$ProjectDtoCopyWithImpl<$Res, $Val extends ProjectDto> + implements $ProjectDtoCopyWith<$Res> { + _$ProjectDtoCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of ProjectDto + /// 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? clientId = freezed, + Object? userId = 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?, + clientId: freezed == clientId + ? _value.clientId + : clientId // ignore: cast_nullable_to_non_nullable + as String?, + userId: null == userId + ? _value.userId + : userId // 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 _$$ProjectDtoImplCopyWith<$Res> + implements $ProjectDtoCopyWith<$Res> { + factory _$$ProjectDtoImplCopyWith( + _$ProjectDtoImpl value, $Res Function(_$ProjectDtoImpl) then) = + __$$ProjectDtoImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String id, + String name, + String? description, + String? clientId, + String userId, + DateTime createdAt, + DateTime updatedAt}); +} + +/// @nodoc +class __$$ProjectDtoImplCopyWithImpl<$Res> + extends _$ProjectDtoCopyWithImpl<$Res, _$ProjectDtoImpl> + implements _$$ProjectDtoImplCopyWith<$Res> { + __$$ProjectDtoImplCopyWithImpl( + _$ProjectDtoImpl _value, $Res Function(_$ProjectDtoImpl) _then) + : super(_value, _then); + + /// Create a copy of ProjectDto + /// 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? clientId = freezed, + Object? userId = null, + Object? createdAt = null, + Object? updatedAt = null, + }) { + return _then(_$ProjectDtoImpl( + 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?, + clientId: freezed == clientId + ? _value.clientId + : clientId // ignore: cast_nullable_to_non_nullable + as String?, + userId: null == userId + ? _value.userId + : userId // 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 _$ProjectDtoImpl implements _ProjectDto { + const _$ProjectDtoImpl( + {required this.id, + required this.name, + this.description, + this.clientId, + required this.userId, + required this.createdAt, + required this.updatedAt}); + + factory _$ProjectDtoImpl.fromJson(Map json) => + _$$ProjectDtoImplFromJson(json); + + @override + final String id; + @override + final String name; + @override + final String? description; + @override + final String? clientId; + @override + final String userId; + @override + final DateTime createdAt; + @override + final DateTime updatedAt; + + @override + String toString() { + return 'ProjectDto(id: $id, name: $name, description: $description, clientId: $clientId, userId: $userId, createdAt: $createdAt, updatedAt: $updatedAt)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ProjectDtoImpl && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name) && + (identical(other.description, description) || + other.description == description) && + (identical(other.clientId, clientId) || + other.clientId == clientId) && + (identical(other.userId, userId) || other.userId == userId) && + (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, name, description, clientId, + userId, createdAt, updatedAt); + + /// Create a copy of ProjectDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$ProjectDtoImplCopyWith<_$ProjectDtoImpl> get copyWith => + __$$ProjectDtoImplCopyWithImpl<_$ProjectDtoImpl>(this, _$identity); + + @override + Map toJson() { + return _$$ProjectDtoImplToJson( + this, + ); + } +} + +abstract class _ProjectDto implements ProjectDto { + const factory _ProjectDto( + {required final String id, + required final String name, + final String? description, + final String? clientId, + required final String userId, + required final DateTime createdAt, + required final DateTime updatedAt}) = _$ProjectDtoImpl; + + factory _ProjectDto.fromJson(Map json) = + _$ProjectDtoImpl.fromJson; + + @override + String get id; + @override + String get name; + @override + String? get description; + @override + String? get clientId; + @override + String get userId; + @override + DateTime get createdAt; + @override + DateTime get updatedAt; + + /// Create a copy of ProjectDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$ProjectDtoImplCopyWith<_$ProjectDtoImpl> get copyWith => + throw _privateConstructorUsedError; +} + +ProjectCreateDto _$ProjectCreateDtoFromJson(Map json) { + return _ProjectCreateDto.fromJson(json); +} + +/// @nodoc +mixin _$ProjectCreateDto { + String get name => throw _privateConstructorUsedError; + String? get description => throw _privateConstructorUsedError; + String? get clientId => throw _privateConstructorUsedError; + String get userId => throw _privateConstructorUsedError; + + /// Serializes this ProjectCreateDto to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of ProjectCreateDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $ProjectCreateDtoCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ProjectCreateDtoCopyWith<$Res> { + factory $ProjectCreateDtoCopyWith( + ProjectCreateDto value, $Res Function(ProjectCreateDto) then) = + _$ProjectCreateDtoCopyWithImpl<$Res, ProjectCreateDto>; + @useResult + $Res call( + {String name, String? description, String? clientId, String userId}); +} + +/// @nodoc +class _$ProjectCreateDtoCopyWithImpl<$Res, $Val extends ProjectCreateDto> + implements $ProjectCreateDtoCopyWith<$Res> { + _$ProjectCreateDtoCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of ProjectCreateDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = null, + Object? description = freezed, + Object? clientId = freezed, + Object? userId = null, + }) { + return _then(_value.copyWith( + 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?, + clientId: freezed == clientId + ? _value.clientId + : clientId // ignore: cast_nullable_to_non_nullable + as String?, + userId: null == userId + ? _value.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$ProjectCreateDtoImplCopyWith<$Res> + implements $ProjectCreateDtoCopyWith<$Res> { + factory _$$ProjectCreateDtoImplCopyWith(_$ProjectCreateDtoImpl value, + $Res Function(_$ProjectCreateDtoImpl) then) = + __$$ProjectCreateDtoImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String name, String? description, String? clientId, String userId}); +} + +/// @nodoc +class __$$ProjectCreateDtoImplCopyWithImpl<$Res> + extends _$ProjectCreateDtoCopyWithImpl<$Res, _$ProjectCreateDtoImpl> + implements _$$ProjectCreateDtoImplCopyWith<$Res> { + __$$ProjectCreateDtoImplCopyWithImpl(_$ProjectCreateDtoImpl _value, + $Res Function(_$ProjectCreateDtoImpl) _then) + : super(_value, _then); + + /// Create a copy of ProjectCreateDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = null, + Object? description = freezed, + Object? clientId = freezed, + Object? userId = null, + }) { + return _then(_$ProjectCreateDtoImpl( + 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?, + clientId: freezed == clientId + ? _value.clientId + : clientId // ignore: cast_nullable_to_non_nullable + as String?, + userId: null == userId + ? _value.userId + : userId // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$ProjectCreateDtoImpl implements _ProjectCreateDto { + const _$ProjectCreateDtoImpl( + {required this.name, + this.description, + this.clientId, + required this.userId}); + + factory _$ProjectCreateDtoImpl.fromJson(Map json) => + _$$ProjectCreateDtoImplFromJson(json); + + @override + final String name; + @override + final String? description; + @override + final String? clientId; + @override + final String userId; + + @override + String toString() { + return 'ProjectCreateDto(name: $name, description: $description, clientId: $clientId, userId: $userId)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ProjectCreateDtoImpl && + (identical(other.name, name) || other.name == name) && + (identical(other.description, description) || + other.description == description) && + (identical(other.clientId, clientId) || + other.clientId == clientId) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, name, description, clientId, userId); + + /// Create a copy of ProjectCreateDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$ProjectCreateDtoImplCopyWith<_$ProjectCreateDtoImpl> get copyWith => + __$$ProjectCreateDtoImplCopyWithImpl<_$ProjectCreateDtoImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$ProjectCreateDtoImplToJson( + this, + ); + } +} + +abstract class _ProjectCreateDto implements ProjectCreateDto { + const factory _ProjectCreateDto( + {required final String name, + final String? description, + final String? clientId, + required final String userId}) = _$ProjectCreateDtoImpl; + + factory _ProjectCreateDto.fromJson(Map json) = + _$ProjectCreateDtoImpl.fromJson; + + @override + String get name; + @override + String? get description; + @override + String? get clientId; + @override + String get userId; + + /// Create a copy of ProjectCreateDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$ProjectCreateDtoImplCopyWith<_$ProjectCreateDtoImpl> get copyWith => + throw _privateConstructorUsedError; +} + +ProjectUpdateDto _$ProjectUpdateDtoFromJson(Map json) { + return _ProjectUpdateDto.fromJson(json); +} + +/// @nodoc +mixin _$ProjectUpdateDto { + String get id => throw _privateConstructorUsedError; + String? get name => throw _privateConstructorUsedError; + String? get description => throw _privateConstructorUsedError; + String? get clientId => throw _privateConstructorUsedError; + String? get userId => throw _privateConstructorUsedError; + + /// Serializes this ProjectUpdateDto to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of ProjectUpdateDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $ProjectUpdateDtoCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ProjectUpdateDtoCopyWith<$Res> { + factory $ProjectUpdateDtoCopyWith( + ProjectUpdateDto value, $Res Function(ProjectUpdateDto) then) = + _$ProjectUpdateDtoCopyWithImpl<$Res, ProjectUpdateDto>; + @useResult + $Res call( + {String id, + String? name, + String? description, + String? clientId, + String? userId}); +} + +/// @nodoc +class _$ProjectUpdateDtoCopyWithImpl<$Res, $Val extends ProjectUpdateDto> + implements $ProjectUpdateDtoCopyWith<$Res> { + _$ProjectUpdateDtoCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of ProjectUpdateDto + /// 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? clientId = freezed, + Object? userId = 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?, + clientId: freezed == clientId + ? _value.clientId + : clientId // ignore: cast_nullable_to_non_nullable + as String?, + userId: freezed == userId + ? _value.userId + : userId // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$ProjectUpdateDtoImplCopyWith<$Res> + implements $ProjectUpdateDtoCopyWith<$Res> { + factory _$$ProjectUpdateDtoImplCopyWith(_$ProjectUpdateDtoImpl value, + $Res Function(_$ProjectUpdateDtoImpl) then) = + __$$ProjectUpdateDtoImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String id, + String? name, + String? description, + String? clientId, + String? userId}); +} + +/// @nodoc +class __$$ProjectUpdateDtoImplCopyWithImpl<$Res> + extends _$ProjectUpdateDtoCopyWithImpl<$Res, _$ProjectUpdateDtoImpl> + implements _$$ProjectUpdateDtoImplCopyWith<$Res> { + __$$ProjectUpdateDtoImplCopyWithImpl(_$ProjectUpdateDtoImpl _value, + $Res Function(_$ProjectUpdateDtoImpl) _then) + : super(_value, _then); + + /// Create a copy of ProjectUpdateDto + /// 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? clientId = freezed, + Object? userId = freezed, + }) { + return _then(_$ProjectUpdateDtoImpl( + 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?, + clientId: freezed == clientId + ? _value.clientId + : clientId // ignore: cast_nullable_to_non_nullable + as String?, + userId: freezed == userId + ? _value.userId + : userId // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$ProjectUpdateDtoImpl implements _ProjectUpdateDto { + const _$ProjectUpdateDtoImpl( + {required this.id, + this.name, + this.description, + this.clientId, + this.userId}); + + factory _$ProjectUpdateDtoImpl.fromJson(Map json) => + _$$ProjectUpdateDtoImplFromJson(json); + + @override + final String id; + @override + final String? name; + @override + final String? description; + @override + final String? clientId; + @override + final String? userId; + + @override + String toString() { + return 'ProjectUpdateDto(id: $id, name: $name, description: $description, clientId: $clientId, userId: $userId)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ProjectUpdateDtoImpl && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name) && + (identical(other.description, description) || + other.description == description) && + (identical(other.clientId, clientId) || + other.clientId == clientId) && + (identical(other.userId, userId) || other.userId == userId)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => + Object.hash(runtimeType, id, name, description, clientId, userId); + + /// Create a copy of ProjectUpdateDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$ProjectUpdateDtoImplCopyWith<_$ProjectUpdateDtoImpl> get copyWith => + __$$ProjectUpdateDtoImplCopyWithImpl<_$ProjectUpdateDtoImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$ProjectUpdateDtoImplToJson( + this, + ); + } +} + +abstract class _ProjectUpdateDto implements ProjectUpdateDto { + const factory _ProjectUpdateDto( + {required final String id, + final String? name, + final String? description, + final String? clientId, + final String? userId}) = _$ProjectUpdateDtoImpl; + + factory _ProjectUpdateDto.fromJson(Map json) = + _$ProjectUpdateDtoImpl.fromJson; + + @override + String get id; + @override + String? get name; + @override + String? get description; + @override + String? get clientId; + @override + String? get userId; + + /// Create a copy of ProjectUpdateDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$ProjectUpdateDtoImplCopyWith<_$ProjectUpdateDtoImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/backend-dart/lib/application/service/dto/project_dto.g.dart b/backend-dart/lib/application/service/dto/project_dto.g.dart new file mode 100644 index 0000000..98b1d01 --- /dev/null +++ b/backend-dart/lib/application/service/dto/project_dto.g.dart @@ -0,0 +1,67 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'project_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$ProjectDtoImpl _$$ProjectDtoImplFromJson(Map json) => + _$ProjectDtoImpl( + id: json['id'] as String, + name: json['name'] as String, + description: json['description'] as String?, + clientId: json['clientId'] as String?, + userId: json['userId'] as String, + createdAt: DateTime.parse(json['createdAt'] as String), + updatedAt: DateTime.parse(json['updatedAt'] as String), + ); + +Map _$$ProjectDtoImplToJson(_$ProjectDtoImpl instance) => + { + 'id': instance.id, + 'name': instance.name, + 'description': instance.description, + 'clientId': instance.clientId, + 'userId': instance.userId, + 'createdAt': instance.createdAt.toIso8601String(), + 'updatedAt': instance.updatedAt.toIso8601String(), + }; + +_$ProjectCreateDtoImpl _$$ProjectCreateDtoImplFromJson( + Map json) => + _$ProjectCreateDtoImpl( + name: json['name'] as String, + description: json['description'] as String?, + clientId: json['clientId'] as String?, + userId: json['userId'] as String, + ); + +Map _$$ProjectCreateDtoImplToJson( + _$ProjectCreateDtoImpl instance) => + { + 'name': instance.name, + 'description': instance.description, + 'clientId': instance.clientId, + 'userId': instance.userId, + }; + +_$ProjectUpdateDtoImpl _$$ProjectUpdateDtoImplFromJson( + Map json) => + _$ProjectUpdateDtoImpl( + id: json['id'] as String, + name: json['name'] as String?, + description: json['description'] as String?, + clientId: json['clientId'] as String?, + userId: json['userId'] as String?, + ); + +Map _$$ProjectUpdateDtoImplToJson( + _$ProjectUpdateDtoImpl instance) => + { + 'id': instance.id, + 'name': instance.name, + 'description': instance.description, + 'clientId': instance.clientId, + 'userId': instance.userId, + }; diff --git a/backend-dart/lib/application/service/dto/project_task_dto.dart b/backend-dart/lib/application/service/dto/project_task_dto.dart new file mode 100644 index 0000000..1155df2 --- /dev/null +++ b/backend-dart/lib/application/service/dto/project_task_dto.dart @@ -0,0 +1,46 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'project_task_dto.freezed.dart'; +part 'project_task_dto.g.dart'; + +@freezed +class ProjectTaskDto with _$ProjectTaskDto { + const factory ProjectTaskDto({ + required String id, + required String name, + String? description, + required String projectId, + required DateTime createdAt, + required DateTime updatedAt, + }) = _ProjectTaskDto; + + /// JSON-Serialisierung + factory ProjectTaskDto.fromJson(Map json) => + _$ProjectTaskDtoFromJson(json); +} + +@freezed +class ProjectTaskCreateDto with _$ProjectTaskCreateDto { + const factory ProjectTaskCreateDto({ + required String name, + String? description, + required String projectId, + }) = _ProjectTaskCreateDto; + + /// JSON-Serialisierung + factory ProjectTaskCreateDto.fromJson(Map json) => + _$ProjectTaskCreateDtoFromJson(json); +} + +@freezed +class ProjectTaskUpdateDto with _$ProjectTaskUpdateDto { + const factory ProjectTaskUpdateDto({ + String? name, + String? description, + String? projectId, + }) = _ProjectTaskUpdateDto; + + /// JSON-Serialisierung + factory ProjectTaskUpdateDto.fromJson(Map json) => + _$ProjectTaskUpdateDtoFromJson(json); +} diff --git a/backend-dart/lib/application/service/dto/project_task_dto.freezed.dart b/backend-dart/lib/application/service/dto/project_task_dto.freezed.dart new file mode 100644 index 0000000..a24ebc1 --- /dev/null +++ b/backend-dart/lib/application/service/dto/project_task_dto.freezed.dart @@ -0,0 +1,654 @@ +// 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_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(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'); + +ProjectTaskDto _$ProjectTaskDtoFromJson(Map json) { + return _ProjectTaskDto.fromJson(json); +} + +/// @nodoc +mixin _$ProjectTaskDto { + 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; + + /// Serializes this ProjectTaskDto to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of ProjectTaskDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $ProjectTaskDtoCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ProjectTaskDtoCopyWith<$Res> { + factory $ProjectTaskDtoCopyWith( + ProjectTaskDto value, $Res Function(ProjectTaskDto) then) = + _$ProjectTaskDtoCopyWithImpl<$Res, ProjectTaskDto>; + @useResult + $Res call( + {String id, + String name, + String? description, + String projectId, + DateTime createdAt, + DateTime updatedAt}); +} + +/// @nodoc +class _$ProjectTaskDtoCopyWithImpl<$Res, $Val extends ProjectTaskDto> + implements $ProjectTaskDtoCopyWith<$Res> { + _$ProjectTaskDtoCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of ProjectTaskDto + /// 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 _$$ProjectTaskDtoImplCopyWith<$Res> + implements $ProjectTaskDtoCopyWith<$Res> { + factory _$$ProjectTaskDtoImplCopyWith(_$ProjectTaskDtoImpl value, + $Res Function(_$ProjectTaskDtoImpl) then) = + __$$ProjectTaskDtoImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String id, + String name, + String? description, + String projectId, + DateTime createdAt, + DateTime updatedAt}); +} + +/// @nodoc +class __$$ProjectTaskDtoImplCopyWithImpl<$Res> + extends _$ProjectTaskDtoCopyWithImpl<$Res, _$ProjectTaskDtoImpl> + implements _$$ProjectTaskDtoImplCopyWith<$Res> { + __$$ProjectTaskDtoImplCopyWithImpl( + _$ProjectTaskDtoImpl _value, $Res Function(_$ProjectTaskDtoImpl) _then) + : super(_value, _then); + + /// Create a copy of ProjectTaskDto + /// 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(_$ProjectTaskDtoImpl( + 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 +@JsonSerializable() +class _$ProjectTaskDtoImpl implements _ProjectTaskDto { + const _$ProjectTaskDtoImpl( + {required this.id, + required this.name, + this.description, + required this.projectId, + required this.createdAt, + required this.updatedAt}); + + factory _$ProjectTaskDtoImpl.fromJson(Map json) => + _$$ProjectTaskDtoImplFromJson(json); + + @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 'ProjectTaskDto(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 _$ProjectTaskDtoImpl && + (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)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash( + runtimeType, id, name, description, projectId, createdAt, updatedAt); + + /// Create a copy of ProjectTaskDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$ProjectTaskDtoImplCopyWith<_$ProjectTaskDtoImpl> get copyWith => + __$$ProjectTaskDtoImplCopyWithImpl<_$ProjectTaskDtoImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$ProjectTaskDtoImplToJson( + this, + ); + } +} + +abstract class _ProjectTaskDto implements ProjectTaskDto { + const factory _ProjectTaskDto( + {required final String id, + required final String name, + final String? description, + required final String projectId, + required final DateTime createdAt, + required final DateTime updatedAt}) = _$ProjectTaskDtoImpl; + + factory _ProjectTaskDto.fromJson(Map json) = + _$ProjectTaskDtoImpl.fromJson; + + @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 ProjectTaskDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$ProjectTaskDtoImplCopyWith<_$ProjectTaskDtoImpl> get copyWith => + throw _privateConstructorUsedError; +} + +ProjectTaskCreateDto _$ProjectTaskCreateDtoFromJson(Map json) { + return _ProjectTaskCreateDto.fromJson(json); +} + +/// @nodoc +mixin _$ProjectTaskCreateDto { + String get name => throw _privateConstructorUsedError; + String? get description => throw _privateConstructorUsedError; + String get projectId => throw _privateConstructorUsedError; + + /// Serializes this ProjectTaskCreateDto to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of ProjectTaskCreateDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $ProjectTaskCreateDtoCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ProjectTaskCreateDtoCopyWith<$Res> { + factory $ProjectTaskCreateDtoCopyWith(ProjectTaskCreateDto value, + $Res Function(ProjectTaskCreateDto) then) = + _$ProjectTaskCreateDtoCopyWithImpl<$Res, ProjectTaskCreateDto>; + @useResult + $Res call({String name, String? description, String projectId}); +} + +/// @nodoc +class _$ProjectTaskCreateDtoCopyWithImpl<$Res, + $Val extends ProjectTaskCreateDto> + implements $ProjectTaskCreateDtoCopyWith<$Res> { + _$ProjectTaskCreateDtoCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of ProjectTaskCreateDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = null, + Object? description = freezed, + Object? projectId = null, + }) { + return _then(_value.copyWith( + 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 _$$ProjectTaskCreateDtoImplCopyWith<$Res> + implements $ProjectTaskCreateDtoCopyWith<$Res> { + factory _$$ProjectTaskCreateDtoImplCopyWith(_$ProjectTaskCreateDtoImpl value, + $Res Function(_$ProjectTaskCreateDtoImpl) then) = + __$$ProjectTaskCreateDtoImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({String name, String? description, String projectId}); +} + +/// @nodoc +class __$$ProjectTaskCreateDtoImplCopyWithImpl<$Res> + extends _$ProjectTaskCreateDtoCopyWithImpl<$Res, _$ProjectTaskCreateDtoImpl> + implements _$$ProjectTaskCreateDtoImplCopyWith<$Res> { + __$$ProjectTaskCreateDtoImplCopyWithImpl(_$ProjectTaskCreateDtoImpl _value, + $Res Function(_$ProjectTaskCreateDtoImpl) _then) + : super(_value, _then); + + /// Create a copy of ProjectTaskCreateDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = null, + Object? description = freezed, + Object? projectId = null, + }) { + return _then(_$ProjectTaskCreateDtoImpl( + 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 +@JsonSerializable() +class _$ProjectTaskCreateDtoImpl implements _ProjectTaskCreateDto { + const _$ProjectTaskCreateDtoImpl( + {required this.name, this.description, required this.projectId}); + + factory _$ProjectTaskCreateDtoImpl.fromJson(Map json) => + _$$ProjectTaskCreateDtoImplFromJson(json); + + @override + final String name; + @override + final String? description; + @override + final String projectId; + + @override + String toString() { + return 'ProjectTaskCreateDto(name: $name, description: $description, projectId: $projectId)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ProjectTaskCreateDtoImpl && + (identical(other.name, name) || other.name == name) && + (identical(other.description, description) || + other.description == description) && + (identical(other.projectId, projectId) || + other.projectId == projectId)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, name, description, projectId); + + /// Create a copy of ProjectTaskCreateDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$ProjectTaskCreateDtoImplCopyWith<_$ProjectTaskCreateDtoImpl> + get copyWith => + __$$ProjectTaskCreateDtoImplCopyWithImpl<_$ProjectTaskCreateDtoImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$ProjectTaskCreateDtoImplToJson( + this, + ); + } +} + +abstract class _ProjectTaskCreateDto implements ProjectTaskCreateDto { + const factory _ProjectTaskCreateDto( + {required final String name, + final String? description, + required final String projectId}) = _$ProjectTaskCreateDtoImpl; + + factory _ProjectTaskCreateDto.fromJson(Map json) = + _$ProjectTaskCreateDtoImpl.fromJson; + + @override + String get name; + @override + String? get description; + @override + String get projectId; + + /// Create a copy of ProjectTaskCreateDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$ProjectTaskCreateDtoImplCopyWith<_$ProjectTaskCreateDtoImpl> + get copyWith => throw _privateConstructorUsedError; +} + +ProjectTaskUpdateDto _$ProjectTaskUpdateDtoFromJson(Map json) { + return _ProjectTaskUpdateDto.fromJson(json); +} + +/// @nodoc +mixin _$ProjectTaskUpdateDto { + String? get name => throw _privateConstructorUsedError; + String? get description => throw _privateConstructorUsedError; + String? get projectId => throw _privateConstructorUsedError; + + /// Serializes this ProjectTaskUpdateDto to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of ProjectTaskUpdateDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $ProjectTaskUpdateDtoCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ProjectTaskUpdateDtoCopyWith<$Res> { + factory $ProjectTaskUpdateDtoCopyWith(ProjectTaskUpdateDto value, + $Res Function(ProjectTaskUpdateDto) then) = + _$ProjectTaskUpdateDtoCopyWithImpl<$Res, ProjectTaskUpdateDto>; + @useResult + $Res call({String? name, String? description, String? projectId}); +} + +/// @nodoc +class _$ProjectTaskUpdateDtoCopyWithImpl<$Res, + $Val extends ProjectTaskUpdateDto> + implements $ProjectTaskUpdateDtoCopyWith<$Res> { + _$ProjectTaskUpdateDtoCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of ProjectTaskUpdateDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = freezed, + Object? description = freezed, + Object? projectId = freezed, + }) { + return _then(_value.copyWith( + 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 _$$ProjectTaskUpdateDtoImplCopyWith<$Res> + implements $ProjectTaskUpdateDtoCopyWith<$Res> { + factory _$$ProjectTaskUpdateDtoImplCopyWith(_$ProjectTaskUpdateDtoImpl value, + $Res Function(_$ProjectTaskUpdateDtoImpl) then) = + __$$ProjectTaskUpdateDtoImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({String? name, String? description, String? projectId}); +} + +/// @nodoc +class __$$ProjectTaskUpdateDtoImplCopyWithImpl<$Res> + extends _$ProjectTaskUpdateDtoCopyWithImpl<$Res, _$ProjectTaskUpdateDtoImpl> + implements _$$ProjectTaskUpdateDtoImplCopyWith<$Res> { + __$$ProjectTaskUpdateDtoImplCopyWithImpl(_$ProjectTaskUpdateDtoImpl _value, + $Res Function(_$ProjectTaskUpdateDtoImpl) _then) + : super(_value, _then); + + /// Create a copy of ProjectTaskUpdateDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = freezed, + Object? description = freezed, + Object? projectId = freezed, + }) { + return _then(_$ProjectTaskUpdateDtoImpl( + 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 +@JsonSerializable() +class _$ProjectTaskUpdateDtoImpl implements _ProjectTaskUpdateDto { + const _$ProjectTaskUpdateDtoImpl( + {this.name, this.description, this.projectId}); + + factory _$ProjectTaskUpdateDtoImpl.fromJson(Map json) => + _$$ProjectTaskUpdateDtoImplFromJson(json); + + @override + final String? name; + @override + final String? description; + @override + final String? projectId; + + @override + String toString() { + return 'ProjectTaskUpdateDto(name: $name, description: $description, projectId: $projectId)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ProjectTaskUpdateDtoImpl && + (identical(other.name, name) || other.name == name) && + (identical(other.description, description) || + other.description == description) && + (identical(other.projectId, projectId) || + other.projectId == projectId)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, name, description, projectId); + + /// Create a copy of ProjectTaskUpdateDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$ProjectTaskUpdateDtoImplCopyWith<_$ProjectTaskUpdateDtoImpl> + get copyWith => + __$$ProjectTaskUpdateDtoImplCopyWithImpl<_$ProjectTaskUpdateDtoImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$ProjectTaskUpdateDtoImplToJson( + this, + ); + } +} + +abstract class _ProjectTaskUpdateDto implements ProjectTaskUpdateDto { + const factory _ProjectTaskUpdateDto( + {final String? name, + final String? description, + final String? projectId}) = _$ProjectTaskUpdateDtoImpl; + + factory _ProjectTaskUpdateDto.fromJson(Map json) = + _$ProjectTaskUpdateDtoImpl.fromJson; + + @override + String? get name; + @override + String? get description; + @override + String? get projectId; + + /// Create a copy of ProjectTaskUpdateDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$ProjectTaskUpdateDtoImplCopyWith<_$ProjectTaskUpdateDtoImpl> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/backend-dart/lib/application/service/dto/project_task_dto.g.dart b/backend-dart/lib/application/service/dto/project_task_dto.g.dart new file mode 100644 index 0000000..b73a625 --- /dev/null +++ b/backend-dart/lib/application/service/dto/project_task_dto.g.dart @@ -0,0 +1,60 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'project_task_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$ProjectTaskDtoImpl _$$ProjectTaskDtoImplFromJson(Map json) => + _$ProjectTaskDtoImpl( + id: json['id'] as String, + name: json['name'] as String, + description: json['description'] as String?, + projectId: json['projectId'] as String, + createdAt: DateTime.parse(json['createdAt'] as String), + updatedAt: DateTime.parse(json['updatedAt'] as String), + ); + +Map _$$ProjectTaskDtoImplToJson( + _$ProjectTaskDtoImpl instance) => + { + 'id': instance.id, + 'name': instance.name, + 'description': instance.description, + 'projectId': instance.projectId, + 'createdAt': instance.createdAt.toIso8601String(), + 'updatedAt': instance.updatedAt.toIso8601String(), + }; + +_$ProjectTaskCreateDtoImpl _$$ProjectTaskCreateDtoImplFromJson( + Map json) => + _$ProjectTaskCreateDtoImpl( + name: json['name'] as String, + description: json['description'] as String?, + projectId: json['projectId'] as String, + ); + +Map _$$ProjectTaskCreateDtoImplToJson( + _$ProjectTaskCreateDtoImpl instance) => + { + 'name': instance.name, + 'description': instance.description, + 'projectId': instance.projectId, + }; + +_$ProjectTaskUpdateDtoImpl _$$ProjectTaskUpdateDtoImplFromJson( + Map json) => + _$ProjectTaskUpdateDtoImpl( + name: json['name'] as String?, + description: json['description'] as String?, + projectId: json['projectId'] as String?, + ); + +Map _$$ProjectTaskUpdateDtoImplToJson( + _$ProjectTaskUpdateDtoImpl instance) => + { + 'name': instance.name, + 'description': instance.description, + 'projectId': instance.projectId, + }; diff --git a/backend-dart/lib/application/service/dto/time_entry_dto.dart b/backend-dart/lib/application/service/dto/time_entry_dto.dart new file mode 100644 index 0000000..c5d6975 --- /dev/null +++ b/backend-dart/lib/application/service/dto/time_entry_dto.dart @@ -0,0 +1,52 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'time_entry_dto.freezed.dart'; +part 'time_entry_dto.g.dart'; + +@freezed +class TimeEntryDto with _$TimeEntryDto { + const factory TimeEntryDto({ + required String id, + required DateTime startTime, + required DateTime endTime, + String? description, + required String userId, + required String projectId, + required DateTime createdAt, + required DateTime updatedAt, + }) = _TimeEntryDto; + + /// JSON-Serialisierung + factory TimeEntryDto.fromJson(Map json) => + _$TimeEntryDtoFromJson(json); +} + +@freezed +class TimeEntryCreateDto with _$TimeEntryCreateDto { + const factory TimeEntryCreateDto({ + required DateTime startTime, + required DateTime endTime, + String? description, + required String userId, + required String projectId, + }) = _TimeEntryCreateDto; + + /// JSON-Serialisierung + factory TimeEntryCreateDto.fromJson(Map json) => + _$TimeEntryCreateDtoFromJson(json); +} + +@freezed +class TimeEntryUpdateDto with _$TimeEntryUpdateDto { + const factory TimeEntryUpdateDto({ + DateTime? startTime, + DateTime? endTime, + String? description, + String? userId, + String? projectId, + }) = _TimeEntryUpdateDto; + + /// JSON-Serialisierung + factory TimeEntryUpdateDto.fromJson(Map json) => + _$TimeEntryUpdateDtoFromJson(json); +} diff --git a/backend-dart/lib/application/service/dto/time_entry_dto.freezed.dart b/backend-dart/lib/application/service/dto/time_entry_dto.freezed.dart new file mode 100644 index 0000000..9e04412 --- /dev/null +++ b/backend-dart/lib/application/service/dto/time_entry_dto.freezed.dart @@ -0,0 +1,790 @@ +// 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_dto.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(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'); + +TimeEntryDto _$TimeEntryDtoFromJson(Map json) { + return _TimeEntryDto.fromJson(json); +} + +/// @nodoc +mixin _$TimeEntryDto { + 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 TimeEntryDto to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of TimeEntryDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $TimeEntryDtoCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $TimeEntryDtoCopyWith<$Res> { + factory $TimeEntryDtoCopyWith( + TimeEntryDto value, $Res Function(TimeEntryDto) then) = + _$TimeEntryDtoCopyWithImpl<$Res, TimeEntryDto>; + @useResult + $Res call( + {String id, + DateTime startTime, + DateTime endTime, + String? description, + String userId, + String projectId, + DateTime createdAt, + DateTime updatedAt}); +} + +/// @nodoc +class _$TimeEntryDtoCopyWithImpl<$Res, $Val extends TimeEntryDto> + implements $TimeEntryDtoCopyWith<$Res> { + _$TimeEntryDtoCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of TimeEntryDto + /// 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 _$$TimeEntryDtoImplCopyWith<$Res> + implements $TimeEntryDtoCopyWith<$Res> { + factory _$$TimeEntryDtoImplCopyWith( + _$TimeEntryDtoImpl value, $Res Function(_$TimeEntryDtoImpl) then) = + __$$TimeEntryDtoImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String id, + DateTime startTime, + DateTime endTime, + String? description, + String userId, + String projectId, + DateTime createdAt, + DateTime updatedAt}); +} + +/// @nodoc +class __$$TimeEntryDtoImplCopyWithImpl<$Res> + extends _$TimeEntryDtoCopyWithImpl<$Res, _$TimeEntryDtoImpl> + implements _$$TimeEntryDtoImplCopyWith<$Res> { + __$$TimeEntryDtoImplCopyWithImpl( + _$TimeEntryDtoImpl _value, $Res Function(_$TimeEntryDtoImpl) _then) + : super(_value, _then); + + /// Create a copy of TimeEntryDto + /// 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(_$TimeEntryDtoImpl( + 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 _$TimeEntryDtoImpl implements _TimeEntryDto { + const _$TimeEntryDtoImpl( + {required this.id, + required this.startTime, + required this.endTime, + this.description, + required this.userId, + required this.projectId, + required this.createdAt, + required this.updatedAt}); + + factory _$TimeEntryDtoImpl.fromJson(Map json) => + _$$TimeEntryDtoImplFromJson(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 'TimeEntryDto(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 _$TimeEntryDtoImpl && + (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 TimeEntryDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$TimeEntryDtoImplCopyWith<_$TimeEntryDtoImpl> get copyWith => + __$$TimeEntryDtoImplCopyWithImpl<_$TimeEntryDtoImpl>(this, _$identity); + + @override + Map toJson() { + return _$$TimeEntryDtoImplToJson( + this, + ); + } +} + +abstract class _TimeEntryDto implements TimeEntryDto { + const factory _TimeEntryDto( + {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}) = _$TimeEntryDtoImpl; + + factory _TimeEntryDto.fromJson(Map json) = + _$TimeEntryDtoImpl.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 TimeEntryDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$TimeEntryDtoImplCopyWith<_$TimeEntryDtoImpl> get copyWith => + throw _privateConstructorUsedError; +} + +TimeEntryCreateDto _$TimeEntryCreateDtoFromJson(Map json) { + return _TimeEntryCreateDto.fromJson(json); +} + +/// @nodoc +mixin _$TimeEntryCreateDto { + 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 TimeEntryCreateDto to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of TimeEntryCreateDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $TimeEntryCreateDtoCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $TimeEntryCreateDtoCopyWith<$Res> { + factory $TimeEntryCreateDtoCopyWith( + TimeEntryCreateDto value, $Res Function(TimeEntryCreateDto) then) = + _$TimeEntryCreateDtoCopyWithImpl<$Res, TimeEntryCreateDto>; + @useResult + $Res call( + {DateTime startTime, + DateTime endTime, + String? description, + String userId, + String projectId}); +} + +/// @nodoc +class _$TimeEntryCreateDtoCopyWithImpl<$Res, $Val extends TimeEntryCreateDto> + implements $TimeEntryCreateDtoCopyWith<$Res> { + _$TimeEntryCreateDtoCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of TimeEntryCreateDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? startTime = null, + Object? endTime = null, + Object? description = freezed, + Object? userId = null, + Object? projectId = null, + }) { + return _then(_value.copyWith( + 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 _$$TimeEntryCreateDtoImplCopyWith<$Res> + implements $TimeEntryCreateDtoCopyWith<$Res> { + factory _$$TimeEntryCreateDtoImplCopyWith(_$TimeEntryCreateDtoImpl value, + $Res Function(_$TimeEntryCreateDtoImpl) then) = + __$$TimeEntryCreateDtoImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {DateTime startTime, + DateTime endTime, + String? description, + String userId, + String projectId}); +} + +/// @nodoc +class __$$TimeEntryCreateDtoImplCopyWithImpl<$Res> + extends _$TimeEntryCreateDtoCopyWithImpl<$Res, _$TimeEntryCreateDtoImpl> + implements _$$TimeEntryCreateDtoImplCopyWith<$Res> { + __$$TimeEntryCreateDtoImplCopyWithImpl(_$TimeEntryCreateDtoImpl _value, + $Res Function(_$TimeEntryCreateDtoImpl) _then) + : super(_value, _then); + + /// Create a copy of TimeEntryCreateDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? startTime = null, + Object? endTime = null, + Object? description = freezed, + Object? userId = null, + Object? projectId = null, + }) { + return _then(_$TimeEntryCreateDtoImpl( + 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 _$TimeEntryCreateDtoImpl implements _TimeEntryCreateDto { + const _$TimeEntryCreateDtoImpl( + {required this.startTime, + required this.endTime, + this.description, + required this.userId, + required this.projectId}); + + factory _$TimeEntryCreateDtoImpl.fromJson(Map json) => + _$$TimeEntryCreateDtoImplFromJson(json); + + @override + final DateTime startTime; + @override + final DateTime endTime; + @override + final String? description; + @override + final String userId; + @override + final String projectId; + + @override + String toString() { + return 'TimeEntryCreateDto(startTime: $startTime, endTime: $endTime, description: $description, userId: $userId, projectId: $projectId)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$TimeEntryCreateDtoImpl && + (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, startTime, endTime, description, userId, projectId); + + /// Create a copy of TimeEntryCreateDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$TimeEntryCreateDtoImplCopyWith<_$TimeEntryCreateDtoImpl> get copyWith => + __$$TimeEntryCreateDtoImplCopyWithImpl<_$TimeEntryCreateDtoImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$TimeEntryCreateDtoImplToJson( + this, + ); + } +} + +abstract class _TimeEntryCreateDto implements TimeEntryCreateDto { + const factory _TimeEntryCreateDto( + {required final DateTime startTime, + required final DateTime endTime, + final String? description, + required final String userId, + required final String projectId}) = _$TimeEntryCreateDtoImpl; + + factory _TimeEntryCreateDto.fromJson(Map json) = + _$TimeEntryCreateDtoImpl.fromJson; + + @override + DateTime get startTime; + @override + DateTime get endTime; + @override + String? get description; + @override + String get userId; + @override + String get projectId; + + /// Create a copy of TimeEntryCreateDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$TimeEntryCreateDtoImplCopyWith<_$TimeEntryCreateDtoImpl> get copyWith => + throw _privateConstructorUsedError; +} + +TimeEntryUpdateDto _$TimeEntryUpdateDtoFromJson(Map json) { + return _TimeEntryUpdateDto.fromJson(json); +} + +/// @nodoc +mixin _$TimeEntryUpdateDto { + 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 TimeEntryUpdateDto to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of TimeEntryUpdateDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $TimeEntryUpdateDtoCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $TimeEntryUpdateDtoCopyWith<$Res> { + factory $TimeEntryUpdateDtoCopyWith( + TimeEntryUpdateDto value, $Res Function(TimeEntryUpdateDto) then) = + _$TimeEntryUpdateDtoCopyWithImpl<$Res, TimeEntryUpdateDto>; + @useResult + $Res call( + {DateTime? startTime, + DateTime? endTime, + String? description, + String? userId, + String? projectId}); +} + +/// @nodoc +class _$TimeEntryUpdateDtoCopyWithImpl<$Res, $Val extends TimeEntryUpdateDto> + implements $TimeEntryUpdateDtoCopyWith<$Res> { + _$TimeEntryUpdateDtoCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of TimeEntryUpdateDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? startTime = freezed, + Object? endTime = freezed, + Object? description = freezed, + Object? userId = freezed, + Object? projectId = freezed, + }) { + return _then(_value.copyWith( + 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 _$$TimeEntryUpdateDtoImplCopyWith<$Res> + implements $TimeEntryUpdateDtoCopyWith<$Res> { + factory _$$TimeEntryUpdateDtoImplCopyWith(_$TimeEntryUpdateDtoImpl value, + $Res Function(_$TimeEntryUpdateDtoImpl) then) = + __$$TimeEntryUpdateDtoImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {DateTime? startTime, + DateTime? endTime, + String? description, + String? userId, + String? projectId}); +} + +/// @nodoc +class __$$TimeEntryUpdateDtoImplCopyWithImpl<$Res> + extends _$TimeEntryUpdateDtoCopyWithImpl<$Res, _$TimeEntryUpdateDtoImpl> + implements _$$TimeEntryUpdateDtoImplCopyWith<$Res> { + __$$TimeEntryUpdateDtoImplCopyWithImpl(_$TimeEntryUpdateDtoImpl _value, + $Res Function(_$TimeEntryUpdateDtoImpl) _then) + : super(_value, _then); + + /// Create a copy of TimeEntryUpdateDto + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? startTime = freezed, + Object? endTime = freezed, + Object? description = freezed, + Object? userId = freezed, + Object? projectId = freezed, + }) { + return _then(_$TimeEntryUpdateDtoImpl( + 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 _$TimeEntryUpdateDtoImpl implements _TimeEntryUpdateDto { + const _$TimeEntryUpdateDtoImpl( + {this.startTime, + this.endTime, + this.description, + this.userId, + this.projectId}); + + factory _$TimeEntryUpdateDtoImpl.fromJson(Map json) => + _$$TimeEntryUpdateDtoImplFromJson(json); + + @override + final DateTime? startTime; + @override + final DateTime? endTime; + @override + final String? description; + @override + final String? userId; + @override + final String? projectId; + + @override + String toString() { + return 'TimeEntryUpdateDto(startTime: $startTime, endTime: $endTime, description: $description, userId: $userId, projectId: $projectId)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$TimeEntryUpdateDtoImpl && + (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, startTime, endTime, description, userId, projectId); + + /// Create a copy of TimeEntryUpdateDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$TimeEntryUpdateDtoImplCopyWith<_$TimeEntryUpdateDtoImpl> get copyWith => + __$$TimeEntryUpdateDtoImplCopyWithImpl<_$TimeEntryUpdateDtoImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$TimeEntryUpdateDtoImplToJson( + this, + ); + } +} + +abstract class _TimeEntryUpdateDto implements TimeEntryUpdateDto { + const factory _TimeEntryUpdateDto( + {final DateTime? startTime, + final DateTime? endTime, + final String? description, + final String? userId, + final String? projectId}) = _$TimeEntryUpdateDtoImpl; + + factory _TimeEntryUpdateDto.fromJson(Map json) = + _$TimeEntryUpdateDtoImpl.fromJson; + + @override + DateTime? get startTime; + @override + DateTime? get endTime; + @override + String? get description; + @override + String? get userId; + @override + String? get projectId; + + /// Create a copy of TimeEntryUpdateDto + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$TimeEntryUpdateDtoImplCopyWith<_$TimeEntryUpdateDtoImpl> get copyWith => + throw _privateConstructorUsedError; +} diff --git a/backend-dart/lib/application/service/dto/time_entry_dto.g.dart b/backend-dart/lib/application/service/dto/time_entry_dto.g.dart new file mode 100644 index 0000000..26722fc --- /dev/null +++ b/backend-dart/lib/application/service/dto/time_entry_dto.g.dart @@ -0,0 +1,75 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'time_entry_dto.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$TimeEntryDtoImpl _$$TimeEntryDtoImplFromJson(Map json) => + _$TimeEntryDtoImpl( + 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 _$$TimeEntryDtoImplToJson(_$TimeEntryDtoImpl instance) => + { + '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(), + }; + +_$TimeEntryCreateDtoImpl _$$TimeEntryCreateDtoImplFromJson( + Map json) => + _$TimeEntryCreateDtoImpl( + 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 _$$TimeEntryCreateDtoImplToJson( + _$TimeEntryCreateDtoImpl instance) => + { + 'startTime': instance.startTime.toIso8601String(), + 'endTime': instance.endTime.toIso8601String(), + 'description': instance.description, + 'userId': instance.userId, + 'projectId': instance.projectId, + }; + +_$TimeEntryUpdateDtoImpl _$$TimeEntryUpdateDtoImplFromJson( + Map json) => + _$TimeEntryUpdateDtoImpl( + 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 _$$TimeEntryUpdateDtoImplToJson( + _$TimeEntryUpdateDtoImpl instance) => + { + 'startTime': instance.startTime?.toIso8601String(), + 'endTime': instance.endTime?.toIso8601String(), + 'description': instance.description, + 'userId': instance.userId, + 'projectId': instance.projectId, + }; diff --git a/backend-dart/lib/application/service/mapper/project_dto_mapper.dart b/backend-dart/lib/application/service/mapper/project_dto_mapper.dart new file mode 100644 index 0000000..5260f39 --- /dev/null +++ b/backend-dart/lib/application/service/mapper/project_dto_mapper.dart @@ -0,0 +1,38 @@ +import 'package:backend_dart/application/service/dto/project_dto.dart'; +import 'package:backend_dart/domain/entities/project.dart'; +import 'package:backend_dart/domain/interface/error.dart'; +import 'package:fpdart/fpdart.dart'; + +class ProjectDtoMapper { + TaskEither to(Project entity) => TaskEither.of(ProjectDto( + id: entity.id, + name: entity.name, + description: entity.description, + clientId: entity.clientId, + userId: entity.userId, + createdAt: entity.createdAt, + updatedAt: entity.updatedAt, + )); + + TaskEither> listTo(Iterable origins) { + return TaskEither.traverseList(origins.toList(), to); + } + + TaskEither fromCreateTo(ProjectCreateDto origin) => + TaskEither.of(ProjectCreate( + name: origin.name, + description: origin.description, + clientId: origin.clientId, + userId: origin.userId, + )); + + TaskEither fromUpdateTo( + ProjectUpdateDto origin, String id) => + TaskEither.of(ProjectUpdate( + id: id, + name: origin.name, + description: origin.description, + clientId: origin.clientId, + userId: origin.userId, + )); +} diff --git a/backend-dart/lib/application/service/mapper/project_task_dto_mapper.dart b/backend-dart/lib/application/service/mapper/project_task_dto_mapper.dart new file mode 100644 index 0000000..749d69a --- /dev/null +++ b/backend-dart/lib/application/service/mapper/project_task_dto_mapper.dart @@ -0,0 +1,38 @@ +import 'package:backend_dart/application/service/dto/project_task_dto.dart'; +import 'package:backend_dart/domain/entities/project_task.dart'; +import 'package:backend_dart/domain/interface/error.dart'; +import 'package:fpdart/fpdart.dart'; + +class ProjectTaskDtoMapper { + TaskEither to(ProjectTask entity) => + TaskEither.of(ProjectTaskDto( + id: entity.id, + name: entity.name, + description: entity.description, + projectId: entity.projectId, + createdAt: entity.createdAt, + updatedAt: entity.updatedAt, + )); + + TaskEither> listTo( + Iterable origins) { + return TaskEither.traverseList(origins.toList(), to); + } + + TaskEither fromCreateTo( + ProjectTaskCreateDto origin) => + TaskEither.of(ProjectTaskCreate( + name: origin.name, + description: origin.description, + projectId: origin.projectId, + )); + + TaskEither fromUpdateTo( + ProjectTaskUpdateDto origin, String id) => + TaskEither.of(ProjectTaskUpdate( + id: id, + name: origin.name, + description: origin.description, + projectId: origin.projectId, + )); +} diff --git a/backend-dart/lib/application/service/mapper/time_entry_dto_mapper.dart b/backend-dart/lib/application/service/mapper/time_entry_dto_mapper.dart new file mode 100644 index 0000000..39c6017 --- /dev/null +++ b/backend-dart/lib/application/service/mapper/time_entry_dto_mapper.dart @@ -0,0 +1,43 @@ +import 'package:backend_dart/application/service/dto/time_entry_dto.dart'; +import 'package:backend_dart/domain/entities/time_entry.dart'; +import 'package:backend_dart/domain/interface/error.dart'; +import 'package:fpdart/fpdart.dart'; + +class TimeEntryDtoMapper { + TaskEither to(TimeEntry entity) => TaskEither.of( + TimeEntryDto( + id: entity.id, + startTime: entity.startTime, + endTime: entity.endTime, + description: entity.description, + userId: entity.userId, + projectId: entity.projectId, + createdAt: entity.createdAt, + updatedAt: entity.updatedAt, + ), + ); + + TaskEither> listTo(Iterable origins) { + return TaskEither.traverseList(origins.toList(), to); + } + + TaskEither fromCreateTo(TimeEntryCreateDto origin) => + TaskEither.of(TimeEntryCreate( + startTime: origin.startTime, + endTime: origin.endTime, + description: origin.description, + userId: origin.userId, + projectId: origin.projectId, + )); + + TaskEither fromUpdateTo( + TimeEntryUpdateDto origin, String id) => + TaskEither.of(TimeEntryUpdate( + id: id, + startTime: origin.startTime, + endTime: origin.endTime, + description: origin.description, + userId: origin.userId, + projectId: origin.projectId, + )); +} diff --git a/backend-dart/lib/application/service/mapper/user_dto_mapper.dart b/backend-dart/lib/application/service/mapper/user_dto_mapper.dart index 72e5315..46f293d 100644 --- a/backend-dart/lib/application/service/mapper/user_dto_mapper.dart +++ b/backend-dart/lib/application/service/mapper/user_dto_mapper.dart @@ -1,11 +1,9 @@ import 'package:backend_dart/application/service/dto/user_dto.dart'; import 'package:backend_dart/domain/entities/user.dart'; import 'package:backend_dart/domain/interface/error.dart'; -import 'package:backend_dart/domain/interface/mapper.dart'; import 'package:fpdart/fpdart.dart'; -class UserDtoMapper implements IMapper { - @override +class UserDtoMapper { TaskEither to(User entity) => TaskEither.of(UserDto( id: entity.id, name: entity.name, @@ -13,21 +11,7 @@ class UserDtoMapper implements IMapper { createdAt: entity.createdAt, updatedAt: entity.updatedAt, )); - @override - TaskEither from(UserDto dto) => TaskEither.of(User( - id: dto.id, - name: dto.name, - email: dto.email, - createdAt: dto.createdAt, - updatedAt: dto.updatedAt, - )); - @override - TaskEither> listFrom(Iterable targets) { - return TaskEither.traverseList(targets.toList(), from); - } - - @override TaskEither> listTo(Iterable origins) { return TaskEither.traverseList(origins.toList(), to); } diff --git a/backend-dart/lib/application/service/project_service.dart b/backend-dart/lib/application/service/project_service.dart new file mode 100644 index 0000000..5c2f682 --- /dev/null +++ b/backend-dart/lib/application/service/project_service.dart @@ -0,0 +1,78 @@ +import 'dart:convert'; + +import 'package:backend_dart/application/service/dto/project_dto.dart'; +import 'package:backend_dart/application/service/mapper/project_dto_mapper.dart'; +import 'package:backend_dart/common/request_helper.dart'; +import 'package:backend_dart/common/response_helpers.dart'; +import 'package:backend_dart/common/validation.dart'; +import 'package:backend_dart/domain/repository/project_repository.dart'; +import 'package:shelf/shelf.dart'; +import 'package:shelf_router/shelf_router.dart'; + +part 'project_service.g.dart'; // generated with 'pub run build_runner build' + +class ProjectService { + final ProjectRepository projects; + final ProjectDtoMapper mapper = ProjectDtoMapper(); + ProjectService(this.projects); + + @Route.get('/') + Future listProjects(Request request) async { + return projects + .findAll() + .flatMap(mapper.listTo) + .map((projects) => projects.map((project) => project.toJson()).toList()) + .match((left) => ResponseHelpers.fromError(left), + (right) => Response.ok(jsonEncode(right))) + .run(); + } + + @Route.get('/') + Future fetchProject(Request request, String projectId) async { + return projects + .findById(projectId) + .flatMap(mapper.to) + .match((left) => ResponseHelpers.fromError(left), + (right) => ResponseHelpers.jsonOk(right.toJson())) + .run(); + } + + @Route.post('/') + Future createProject(Request request) async { + return requestToJson(request) + .flatMap((json) => + validateJsonKeys(json, ['name', 'userId'])) // Add required fields + .flatMap((json) => decodeJson(json, ProjectCreateDto.fromJson)) + .flatMap(mapper.fromCreateTo) + .flatMap(projects.create) + .flatMap(mapper.to) + .match((left) => ResponseHelpers.fromError(left), + (right) => ResponseHelpers.jsonOk(right.toJson())) + .run(); + } + + @Route.put('/') + Future updateProject(Request request, String projectId) async { + return requestToJson(request) + .flatMap((json) => validateJsonKeys(json, [])) + .flatMap((json) => decodeJson(json, ProjectUpdateDto.fromJson)) + .flatMap((dto) => mapper.fromUpdateTo(dto, projectId)) + .flatMap(projects.update) + .flatMap(mapper.to) + .match((left) => ResponseHelpers.fromError(left), + (right) => ResponseHelpers.jsonOk(right.toJson())) + .run(); + } + + @Route.delete('/') + Future deleteProject(Request request, String projectId) async { + return projects + .delete(projectId) + .match((left) => ResponseHelpers.fromError(left), + (right) => Response.ok('project deleted')) + .run(); + } + + // Create router using the generate function defined in 'project_service.g.dart'. + Router get router => _$ProjectServiceRouter(this); +} diff --git a/backend-dart/lib/application/service/project_service.g.dart b/backend-dart/lib/application/service/project_service.g.dart new file mode 100644 index 0000000..6058e91 --- /dev/null +++ b/backend-dart/lib/application/service/project_service.g.dart @@ -0,0 +1,37 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'project_service.dart'; + +// ************************************************************************** +// ShelfRouterGenerator +// ************************************************************************** + +Router _$ProjectServiceRouter(ProjectService service) { + final router = Router(); + router.add( + 'GET', + r'/', + service.listProjects, + ); + router.add( + 'GET', + r'/', + service.fetchProject, + ); + router.add( + 'POST', + r'/', + service.createProject, + ); + router.add( + 'PUT', + r'/', + service.updateProject, + ); + router.add( + 'DELETE', + r'/', + service.deleteProject, + ); + return router; +} diff --git a/backend-dart/lib/application/service/project_task_service.dart b/backend-dart/lib/application/service/project_task_service.dart new file mode 100644 index 0000000..9ba4c8b --- /dev/null +++ b/backend-dart/lib/application/service/project_task_service.dart @@ -0,0 +1,77 @@ +import 'dart:convert'; + +import 'package:backend_dart/application/service/dto/project_task_dto.dart'; +import 'package:backend_dart/application/service/mapper/project_task_dto_mapper.dart'; +import 'package:backend_dart/common/request_helper.dart'; +import 'package:backend_dart/common/response_helpers.dart'; +import 'package:backend_dart/common/validation.dart'; +import 'package:backend_dart/domain/repository/project_task_repository.dart'; +import 'package:shelf/shelf.dart'; +import 'package:shelf_router/shelf_router.dart'; + +part 'project_task_service.g.dart'; // Generated with 'pub run build_runner build' + +class ProjectTaskService { + final ProjectTaskRepository tasks; + final ProjectTaskDtoMapper mapper = ProjectTaskDtoMapper(); + ProjectTaskService(this.tasks); + + @Route.get('/') + Future listTasks(Request request) async { + return tasks + .findAll() + .flatMap(mapper.listTo) + .map((tasks) => tasks.map((task) => task.toJson()).toList()) + .match((left) => ResponseHelpers.fromError(left), + (right) => Response.ok(jsonEncode(right))) + .run(); + } + + @Route.get('/') + Future fetchTask(Request request, String taskId) async { + return tasks + .findById(taskId) + .flatMap(mapper.to) + .match((left) => ResponseHelpers.fromError(left), + (right) => ResponseHelpers.jsonOk(right.toJson())) + .run(); + } + + @Route.post('/') + Future createTask(Request request) async { + return requestToJson(request) + .flatMap((json) => + validateJsonKeys(json, ['name', 'projectId'])) // Add required fields + .flatMap((json) => decodeJson(json, ProjectTaskCreateDto.fromJson)) + .flatMap(mapper.fromCreateTo) + .flatMap(tasks.create) + .flatMap(mapper.to) + .match((left) => ResponseHelpers.fromError(left), + (right) => ResponseHelpers.jsonOk(right.toJson())) + .run(); + } + + @Route.put('/') + Future updateTask(Request request, String taskId) async { + return requestToJson(request) + .flatMap((json) => validateJsonKeys(json, [])) + .flatMap((json) => decodeJson(json, ProjectTaskUpdateDto.fromJson)) + .flatMap((dto) => mapper.fromUpdateTo(dto, taskId)) + .flatMap(tasks.update) + .flatMap(mapper.to) + .match((left) => ResponseHelpers.fromError(left), + (right) => ResponseHelpers.jsonOk(right.toJson())) + .run(); + } + + @Route.delete('/') + Future deleteTask(Request request, String taskId) async { + return tasks + .delete(taskId) + .match((left) => ResponseHelpers.fromError(left), + (right) => Response.ok('Task deleted')) + .run(); + } + + Router get router => _$ProjectTaskServiceRouter(this); +} diff --git a/backend-dart/lib/application/service/project_task_service.g.dart b/backend-dart/lib/application/service/project_task_service.g.dart new file mode 100644 index 0000000..23c826d --- /dev/null +++ b/backend-dart/lib/application/service/project_task_service.g.dart @@ -0,0 +1,37 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'project_task_service.dart'; + +// ************************************************************************** +// ShelfRouterGenerator +// ************************************************************************** + +Router _$ProjectTaskServiceRouter(ProjectTaskService service) { + final router = Router(); + router.add( + 'GET', + r'/', + service.listTasks, + ); + router.add( + 'GET', + r'/', + service.fetchTask, + ); + router.add( + 'POST', + r'/', + service.createTask, + ); + router.add( + 'PUT', + r'/', + service.updateTask, + ); + router.add( + 'DELETE', + r'/', + service.deleteTask, + ); + return router; +} diff --git a/backend-dart/lib/application/service/service_provider.dart b/backend-dart/lib/application/service/service_provider.dart new file mode 100644 index 0000000..6aa0605 --- /dev/null +++ b/backend-dart/lib/application/service/service_provider.dart @@ -0,0 +1,26 @@ +import 'package:backend_dart/application/repository/provider.dart'; +import 'package:backend_dart/application/service/project_service.dart'; +import 'package:backend_dart/application/service/project_task_service.dart'; +import 'package:backend_dart/application/service/time_entry_service.dart'; +import 'package:backend_dart/application/service/user_service.dart'; +import 'package:riverpod/riverpod.dart'; + +final userServiceProvider = Provider((ref) { + final database = ref.read(userRepoProvider); + return UserService(database); +}); + +final projectServiceProvider = Provider((ref) { + final database = ref.read(projectProvider); + return ProjectService(database); +}); + +final projectTaskServiceProvider = Provider((ref) { + final database = ref.read(projectTaskProvider); + return ProjectTaskService(database); +}); + +final timeEntryServiceProvider = Provider((ref) { + final database = ref.read(timeEntryProvider); + return TimeEntryService(database); +}); \ No newline at end of file diff --git a/backend-dart/lib/application/service/time_entry_service.dart b/backend-dart/lib/application/service/time_entry_service.dart new file mode 100644 index 0000000..b36650f --- /dev/null +++ b/backend-dart/lib/application/service/time_entry_service.dart @@ -0,0 +1,77 @@ +import 'dart:convert'; + +import 'package:backend_dart/application/service/dto/time_entry_dto.dart'; +import 'package:backend_dart/application/service/mapper/time_entry_dto_mapper.dart'; +import 'package:backend_dart/common/request_helper.dart'; +import 'package:backend_dart/common/response_helpers.dart'; +import 'package:backend_dart/common/validation.dart'; +import 'package:backend_dart/domain/repository/time_entry_repository.dart'; +import 'package:shelf/shelf.dart'; +import 'package:shelf_router/shelf_router.dart'; + +part 'time_entry_service.g.dart'; // Generated with 'pub run build_runner build' + +class TimeEntryService { + final TimeEntryRepository entries; + final TimeEntryDtoMapper mapper = TimeEntryDtoMapper(); + TimeEntryService(this.entries); + + @Route.get('/') + Future listEntries(Request request) async { + return entries + .findAll() + .flatMap(mapper.listTo) + .map((entries) => entries.map((entry) => entry.toJson()).toList()) + .match((left) => ResponseHelpers.fromError(left), + (right) => Response.ok(jsonEncode(right))) + .run(); + } + + @Route.get('/') + Future fetchEntry(Request request, String entryId) async { + return entries + .findById(entryId) + .flatMap(mapper.to) + .match((left) => ResponseHelpers.fromError(left), + (right) => ResponseHelpers.jsonOk(right.toJson())) + .run(); + } + + @Route.post('/') + Future createEntry(Request request) async { + return requestToJson(request) + .flatMap((json) => validateJsonKeys( + json, ['startTime', 'endTime', 'userId', 'projectId'])) + .flatMap((json) => decodeJson(json, TimeEntryCreateDto.fromJson)) + .flatMap(mapper.fromCreateTo) + .flatMap(entries.create) + .flatMap(mapper.to) + .match((left) => ResponseHelpers.fromError(left), + (right) => ResponseHelpers.jsonOk(right.toJson())) + .run(); + } + + @Route.put('/') + Future updateEntry(Request request, String entryId) async { + return requestToJson(request) + .flatMap((json) => validateJsonKeys(json, [])) + .flatMap((json) => decodeJson(json, TimeEntryUpdateDto.fromJson)) + .flatMap((dto) => mapper.fromUpdateTo(dto, entryId)) + .flatMap(entries.update) + .flatMap(mapper.to) + .match((left) => ResponseHelpers.fromError(left), + (right) => ResponseHelpers.jsonOk(right.toJson())) + .run(); + } + + @Route.delete('/') + Future deleteEntry(Request request, String entryId) async { + return entries + .delete(entryId) + .match((left) => ResponseHelpers.fromError(left), + (right) => Response.ok('Entry deleted')) + .run(); + } + + Router get router => _$TimeEntryServiceRouter(this); +} diff --git a/backend-dart/lib/application/service/time_entry_service.g.dart b/backend-dart/lib/application/service/time_entry_service.g.dart new file mode 100644 index 0000000..fd43680 --- /dev/null +++ b/backend-dart/lib/application/service/time_entry_service.g.dart @@ -0,0 +1,37 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'time_entry_service.dart'; + +// ************************************************************************** +// ShelfRouterGenerator +// ************************************************************************** + +Router _$TimeEntryServiceRouter(TimeEntryService service) { + final router = Router(); + router.add( + 'GET', + r'/', + service.listEntries, + ); + router.add( + 'GET', + r'/', + service.fetchEntry, + ); + router.add( + 'POST', + r'/', + service.createEntry, + ); + router.add( + 'PUT', + r'/', + service.updateEntry, + ); + router.add( + 'DELETE', + r'/', + service.deleteEntry, + ); + return router; +} diff --git a/backend-dart/lib/application/service/user_service_provider.dart b/backend-dart/lib/application/service/user_service_provider.dart deleted file mode 100644 index a248727..0000000 --- a/backend-dart/lib/application/service/user_service_provider.dart +++ /dev/null @@ -1,8 +0,0 @@ -import 'package:backend_dart/application/repository/provider.dart'; -import 'package:backend_dart/application/service/user_service.dart'; -import 'package:riverpod/riverpod.dart'; - -final userServiceProvider = Provider((ref) { - final database = ref.read(userRepoProvider); - return UserService(database); -}); diff --git a/backend-dart/lib/domain/data/database.dart b/backend-dart/lib/domain/data/database.dart index 1d81e04..0e683e7 100644 --- a/backend-dart/lib/domain/data/database.dart +++ b/backend-dart/lib/domain/data/database.dart @@ -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 close(); } diff --git a/backend-dart/lib/domain/data/project_data_source.dart b/backend-dart/lib/domain/data/project_data_source.dart index b5e084a..78b0423 100644 --- a/backend-dart/lib/domain/data/project_data_source.dart +++ b/backend-dart/lib/domain/data/project_data_source.dart @@ -7,30 +7,33 @@ abstract class ProjectDataSource { /// Creates a new project in the data source. /// /// Throws an error if the creation fails. - TaskEither createProject(ProjectCreate project); + TaskEither create(ProjectCreate project); /// Retrieves a project by its unique ID. /// /// Returns `null` if no project is found. - TaskEither findProjectById(String id); + TaskEither findById(String id); /// Retrieves all projects associated with a specific user. /// /// Returns an empty list if no projects are found. - TaskEither> findProjectsByUserId(String userId); + TaskEither> findByUserId(String userId); /// Updates an existing project in the data source. /// /// Throws an error if the update fails. - TaskEither updateProject(ProjectUpdate project); + TaskEither update(ProjectUpdate project); /// Deletes a project by its unique ID. /// /// Throws an error if the deletion fails. - TaskEither deleteProject(String id); + TaskEither delete(String id); /// Retrieves all projects in the data source. /// /// Returns an empty list if no projects exist. - TaskEither> findAllProjects(); + TaskEither> findAll(); + + /// Generates a new unique ID for a task. + TaskEither generateId(); } diff --git a/backend-dart/lib/domain/data/project_task_data_source.dart b/backend-dart/lib/domain/data/project_task_data_source.dart new file mode 100644 index 0000000..42db459 --- /dev/null +++ b/backend-dart/lib/domain/data/project_task_data_source.dart @@ -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 create(ProjectTaskCreate task); + + /// Retrieves a task by its unique ID. + /// + /// Returns `null` if no task is found. + TaskEither findById(String id); + + /// Retrieves all tasks for a specific project. + /// + /// Returns an empty list if no tasks are found. + TaskEither> findByProjectId(String projectId); + + /// Updates an existing task in the data source. + /// + /// Throws an error if the update fails. + TaskEither update(ProjectTaskUpdate task); + + /// Deletes a task by its unique ID. + /// + /// Throws an error if the deletion fails. + TaskEither delete(String id); + + /// Retrieves all tasks in the data source. + /// + /// Returns an empty list if no tasks exist. + TaskEither> findAll(); + + /// Generates a new unique ID for a task. + TaskEither generateId(); +} diff --git a/backend-dart/lib/domain/data/time_entry_data_source.dart b/backend-dart/lib/domain/data/time_entry_data_source.dart new file mode 100644 index 0000000..3e72ffa --- /dev/null +++ b/backend-dart/lib/domain/data/time_entry_data_source.dart @@ -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 create(TimeEntryCreate timeEntry); + + /// Retrieves a time entry by its unique ID. + /// + /// Returns `null` if no time entry is found. + TaskEither findById(String id); + + /// Retrieves all time entries for a specific user. + /// + /// Returns an empty list if no time entries are found. + TaskEither> findByUserId(String userId); + + /// Retrieves all time entries for a specific project. + /// + /// Returns an empty list if no time entries are found. + TaskEither> findByProjectId(String projectId); + + /// Updates an existing time entry in the data source. + /// + /// Throws an error if the update fails. + TaskEither update(TimeEntryUpdate timeEntry); + + /// Deletes a time entry by its unique ID. + /// + /// Throws an error if the deletion fails. + TaskEither delete(String id); + + /// Retrieves all time entries in the data source. + /// + /// Returns an empty list if no time entries exist. + TaskEither> findAll(); + + /// Generates a new unique ID for a time entry. + TaskEither generateId(); +} diff --git a/backend-dart/lib/domain/entities/project.dart b/backend-dart/lib/domain/entities/project.dart index d5040da..0aa762d 100644 --- a/backend-dart/lib/domain/entities/project.dart +++ b/backend-dart/lib/domain/entities/project.dart @@ -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, diff --git a/backend-dart/lib/domain/entities/project.freezed.dart b/backend-dart/lib/domain/entities/project.freezed.dart index 6b67f3e..ac5272b 100644 --- a/backend-dart/lib/domain/entities/project.freezed.dart +++ b/backend-dart/lib/domain/entities/project.freezed.dart @@ -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 diff --git a/backend-dart/lib/domain/entities/project_task.dart b/backend-dart/lib/domain/entities/project_task.dart new file mode 100644 index 0000000..296d8a5 --- /dev/null +++ b/backend-dart/lib/domain/entities/project_task.dart @@ -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; +} diff --git a/backend-dart/lib/domain/entities/project_task.freezed.dart b/backend-dart/lib/domain/entities/project_task.freezed.dart new file mode 100644 index 0000000..d996f22 --- /dev/null +++ b/backend-dart/lib/domain/entities/project_task.freezed.dart @@ -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 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 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 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 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; +} diff --git a/backend-dart/lib/domain/entities/time_entry.dart b/backend-dart/lib/domain/entities/time_entry.dart new file mode 100644 index 0000000..b7f233e --- /dev/null +++ b/backend-dart/lib/domain/entities/time_entry.dart @@ -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 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 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 json) => + _$TimeEntryUpdateFromJson(json); +} diff --git a/backend-dart/lib/domain/entities/time_entry.freezed.dart b/backend-dart/lib/domain/entities/time_entry.freezed.dart new file mode 100644 index 0000000..044fd81 --- /dev/null +++ b/backend-dart/lib/domain/entities/time_entry.freezed.dart @@ -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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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; +} diff --git a/backend-dart/lib/domain/entities/time_entry.g.dart b/backend-dart/lib/domain/entities/time_entry.g.dart new file mode 100644 index 0000000..7c78d1a --- /dev/null +++ b/backend-dart/lib/domain/entities/time_entry.g.dart @@ -0,0 +1,79 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'time_entry.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$TimeEntryImpl _$$TimeEntryImplFromJson(Map 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 _$$TimeEntryImplToJson(_$TimeEntryImpl instance) => + { + '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 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 _$$TimeEntryCreateImplToJson( + _$TimeEntryCreateImpl instance) => + { + 'id': instance.id, + 'startTime': instance.startTime.toIso8601String(), + 'endTime': instance.endTime.toIso8601String(), + 'description': instance.description, + 'userId': instance.userId, + 'projectId': instance.projectId, + }; + +_$TimeEntryUpdateImpl _$$TimeEntryUpdateImplFromJson( + Map 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 _$$TimeEntryUpdateImplToJson( + _$TimeEntryUpdateImpl instance) => + { + 'id': instance.id, + 'startTime': instance.startTime?.toIso8601String(), + 'endTime': instance.endTime?.toIso8601String(), + 'description': instance.description, + 'userId': instance.userId, + 'projectId': instance.projectId, + }; diff --git a/backend-dart/lib/domain/repository/project_repository.dart b/backend-dart/lib/domain/repository/project_repository.dart new file mode 100644 index 0000000..eaeed75 --- /dev/null +++ b/backend-dart/lib/domain/repository/project_repository.dart @@ -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 create(ProjectCreate project); + + /// Finds a project by its unique ID. + TaskEither findById(String id); + + /// Updates an existing project. + TaskEither update(ProjectUpdate project); + + /// Deletes a project by its unique ID. + TaskEither delete(String id); + + /// Finds all projects. + TaskEither> findAll(); +} diff --git a/backend-dart/lib/domain/repository/project_task_repository.dart b/backend-dart/lib/domain/repository/project_task_repository.dart new file mode 100644 index 0000000..e834d7e --- /dev/null +++ b/backend-dart/lib/domain/repository/project_task_repository.dart @@ -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 create(ProjectTaskCreate task); + + /// Finds a project task by its unique ID. + TaskEither findById(String id); + + /// Finds all tasks for a specific project. + TaskEither> findByProjectId(String projectId); + + /// Updates an existing project task. + TaskEither update(ProjectTaskUpdate task); + + /// Deletes a project task by its unique ID. + TaskEither delete(String id); + + /// Finds all project tasks. + TaskEither> findAll(); +} diff --git a/backend-dart/lib/domain/repository/time_entry_repository.dart b/backend-dart/lib/domain/repository/time_entry_repository.dart new file mode 100644 index 0000000..c138fa0 --- /dev/null +++ b/backend-dart/lib/domain/repository/time_entry_repository.dart @@ -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 create(TimeEntryCreate timeEntry); + + /// Finds a time entry by its unique ID. + TaskEither findById(String id); + + /// Finds all time entries for a specific user. + TaskEither> findByUserId(String userId); + + /// Finds all time entries for a specific project. + TaskEither> findByProjectId(String projectId); + + /// Updates an existing time entry. + TaskEither update(TimeEntryUpdate timeEntry); + + /// Deletes a time entry by its unique ID. + TaskEither delete(String id); + + /// Finds all time entries. + TaskEither> findAll(); +} diff --git a/backend-dart/lib/infrastructure/persistence/db/client.dart b/backend-dart/lib/infrastructure/persistence/db/client.dart index 9728959..5ce97cb 100755 --- a/backend-dart/lib/infrastructure/persistence/db/client.dart +++ b/backend-dart/lib/infrastructure/persistence/db/client.dart @@ -1501,15 +1501,15 @@ class TimeEntryDboDelegate { } } -class TaskDboDelegate { - const TaskDboDelegate._(this._client); +class ProjectTaskDboDelegate { + const ProjectTaskDboDelegate._(this._client); final PrismaClient _client; - _i1.ActionClient<_i2.TaskDbo?> findUnique({ - required _i3.TaskDboWhereUniqueInput where, - _i3.TaskDboSelect? select, - _i3.TaskDboInclude? include, + _i1.ActionClient<_i2.ProjectTaskDbo?> findUnique({ + required _i3.ProjectTaskDboWhereUniqueInput where, + _i3.ProjectTaskDboSelect? select, + _i3.ProjectTaskDboInclude? include, }) { final args = { 'where': where, @@ -1518,7 +1518,7 @@ class TaskDboDelegate { }; final query = _i1.serializeJsonQuery( args: args, - modelName: 'TaskDbo', + modelName: 'ProjectTaskDbo', action: _i1.JsonQueryAction.findUnique, datamodel: PrismaClient.datamodel, ); @@ -1527,17 +1527,17 @@ class TaskDboDelegate { headers: _client.$transaction.headers, transaction: _client.$transaction.transaction, ); - return _i1.ActionClient<_i2.TaskDbo?>( - action: 'findUniqueTaskDbo', + return _i1.ActionClient<_i2.ProjectTaskDbo?>( + action: 'findUniqueProjectTaskDbo', result: result, - factory: (e) => e != null ? _i2.TaskDbo.fromJson(e) : null, + factory: (e) => e != null ? _i2.ProjectTaskDbo.fromJson(e) : null, ); } - _i1.ActionClient<_i2.TaskDbo> findUniqueOrThrow({ - required _i3.TaskDboWhereUniqueInput where, - _i3.TaskDboSelect? select, - _i3.TaskDboInclude? include, + _i1.ActionClient<_i2.ProjectTaskDbo> findUniqueOrThrow({ + required _i3.ProjectTaskDboWhereUniqueInput where, + _i3.ProjectTaskDboSelect? select, + _i3.ProjectTaskDboInclude? include, }) { final args = { 'where': where, @@ -1546,7 +1546,7 @@ class TaskDboDelegate { }; final query = _i1.serializeJsonQuery( args: args, - modelName: 'TaskDbo', + modelName: 'ProjectTaskDbo', action: _i1.JsonQueryAction.findUniqueOrThrow, datamodel: PrismaClient.datamodel, ); @@ -1555,24 +1555,26 @@ class TaskDboDelegate { headers: _client.$transaction.headers, transaction: _client.$transaction.transaction, ); - return _i1.ActionClient<_i2.TaskDbo>( - action: 'findUniqueTaskDboOrThrow', + return _i1.ActionClient<_i2.ProjectTaskDbo>( + action: 'findUniqueProjectTaskDboOrThrow', result: result, - factory: (e) => _i2.TaskDbo.fromJson(e), + factory: (e) => _i2.ProjectTaskDbo.fromJson(e), ); } - _i1.ActionClient<_i2.TaskDbo?> findFirst({ - _i3.TaskDboWhereInput? where, - _i1.PrismaUnion, - _i3.TaskDboOrderByWithRelationInput>? + _i1.ActionClient<_i2.ProjectTaskDbo?> findFirst({ + _i3.ProjectTaskDboWhereInput? where, + _i1.PrismaUnion, + _i3.ProjectTaskDboOrderByWithRelationInput>? orderBy, - _i3.TaskDboWhereUniqueInput? cursor, + _i3.ProjectTaskDboWhereUniqueInput? cursor, int? take, int? skip, - _i1.PrismaUnion<_i3.TaskDboScalar, Iterable<_i3.TaskDboScalar>>? distinct, - _i3.TaskDboSelect? select, - _i3.TaskDboInclude? include, + _i1.PrismaUnion<_i3.ProjectTaskDboScalar, + Iterable<_i3.ProjectTaskDboScalar>>? + distinct, + _i3.ProjectTaskDboSelect? select, + _i3.ProjectTaskDboInclude? include, }) { final args = { 'where': where, @@ -1586,7 +1588,7 @@ class TaskDboDelegate { }; final query = _i1.serializeJsonQuery( args: args, - modelName: 'TaskDbo', + modelName: 'ProjectTaskDbo', action: _i1.JsonQueryAction.findFirst, datamodel: PrismaClient.datamodel, ); @@ -1595,24 +1597,26 @@ class TaskDboDelegate { headers: _client.$transaction.headers, transaction: _client.$transaction.transaction, ); - return _i1.ActionClient<_i2.TaskDbo?>( - action: 'findFirstTaskDbo', + return _i1.ActionClient<_i2.ProjectTaskDbo?>( + action: 'findFirstProjectTaskDbo', result: result, - factory: (e) => e != null ? _i2.TaskDbo.fromJson(e) : null, + factory: (e) => e != null ? _i2.ProjectTaskDbo.fromJson(e) : null, ); } - _i1.ActionClient<_i2.TaskDbo> findFirstOrThrow({ - _i3.TaskDboWhereInput? where, - _i1.PrismaUnion, - _i3.TaskDboOrderByWithRelationInput>? + _i1.ActionClient<_i2.ProjectTaskDbo> findFirstOrThrow({ + _i3.ProjectTaskDboWhereInput? where, + _i1.PrismaUnion, + _i3.ProjectTaskDboOrderByWithRelationInput>? orderBy, - _i3.TaskDboWhereUniqueInput? cursor, + _i3.ProjectTaskDboWhereUniqueInput? cursor, int? take, int? skip, - _i1.PrismaUnion<_i3.TaskDboScalar, Iterable<_i3.TaskDboScalar>>? distinct, - _i3.TaskDboSelect? select, - _i3.TaskDboInclude? include, + _i1.PrismaUnion<_i3.ProjectTaskDboScalar, + Iterable<_i3.ProjectTaskDboScalar>>? + distinct, + _i3.ProjectTaskDboSelect? select, + _i3.ProjectTaskDboInclude? include, }) { final args = { 'where': where, @@ -1626,7 +1630,7 @@ class TaskDboDelegate { }; final query = _i1.serializeJsonQuery( args: args, - modelName: 'TaskDbo', + modelName: 'ProjectTaskDbo', action: _i1.JsonQueryAction.findFirstOrThrow, datamodel: PrismaClient.datamodel, ); @@ -1635,24 +1639,26 @@ class TaskDboDelegate { headers: _client.$transaction.headers, transaction: _client.$transaction.transaction, ); - return _i1.ActionClient<_i2.TaskDbo>( - action: 'findFirstTaskDboOrThrow', + return _i1.ActionClient<_i2.ProjectTaskDbo>( + action: 'findFirstProjectTaskDboOrThrow', result: result, - factory: (e) => _i2.TaskDbo.fromJson(e), + factory: (e) => _i2.ProjectTaskDbo.fromJson(e), ); } - _i1.ActionClient> findMany({ - _i3.TaskDboWhereInput? where, - _i1.PrismaUnion, - _i3.TaskDboOrderByWithRelationInput>? + _i1.ActionClient> findMany({ + _i3.ProjectTaskDboWhereInput? where, + _i1.PrismaUnion, + _i3.ProjectTaskDboOrderByWithRelationInput>? orderBy, - _i3.TaskDboWhereUniqueInput? cursor, + _i3.ProjectTaskDboWhereUniqueInput? cursor, int? take, int? skip, - _i1.PrismaUnion<_i3.TaskDboScalar, Iterable<_i3.TaskDboScalar>>? distinct, - _i3.TaskDboSelect? select, - _i3.TaskDboInclude? include, + _i1.PrismaUnion<_i3.ProjectTaskDboScalar, + Iterable<_i3.ProjectTaskDboScalar>>? + distinct, + _i3.ProjectTaskDboSelect? select, + _i3.ProjectTaskDboInclude? include, }) { final args = { 'where': where, @@ -1666,7 +1672,7 @@ class TaskDboDelegate { }; final query = _i1.serializeJsonQuery( args: args, - modelName: 'TaskDbo', + modelName: 'ProjectTaskDbo', action: _i1.JsonQueryAction.findMany, datamodel: PrismaClient.datamodel, ); @@ -1675,20 +1681,20 @@ class TaskDboDelegate { headers: _client.$transaction.headers, transaction: _client.$transaction.transaction, ); - return _i1.ActionClient>( - action: 'findManyTaskDbo', + return _i1.ActionClient>( + action: 'findManyProjectTaskDbo', result: result, factory: (values) => - (values as Iterable).map((e) => _i2.TaskDbo.fromJson(e)), + (values as Iterable).map((e) => _i2.ProjectTaskDbo.fromJson(e)), ); } - _i1.ActionClient<_i2.TaskDbo> create({ - required _i1 - .PrismaUnion<_i3.TaskDboCreateInput, _i3.TaskDboUncheckedCreateInput> + _i1.ActionClient<_i2.ProjectTaskDbo> create({ + required _i1.PrismaUnion<_i3.ProjectTaskDboCreateInput, + _i3.ProjectTaskDboUncheckedCreateInput> data, - _i3.TaskDboSelect? select, - _i3.TaskDboInclude? include, + _i3.ProjectTaskDboSelect? select, + _i3.ProjectTaskDboInclude? include, }) { final args = { 'data': data, @@ -1697,7 +1703,7 @@ class TaskDboDelegate { }; final query = _i1.serializeJsonQuery( args: args, - modelName: 'TaskDbo', + modelName: 'ProjectTaskDbo', action: _i1.JsonQueryAction.createOne, datamodel: PrismaClient.datamodel, ); @@ -1706,16 +1712,16 @@ class TaskDboDelegate { headers: _client.$transaction.headers, transaction: _client.$transaction.transaction, ); - return _i1.ActionClient<_i2.TaskDbo>( - action: 'createOneTaskDbo', + return _i1.ActionClient<_i2.ProjectTaskDbo>( + action: 'createOneProjectTaskDbo', result: result, - factory: (e) => _i2.TaskDbo.fromJson(e), + factory: (e) => _i2.ProjectTaskDbo.fromJson(e), ); } _i1.ActionClient<_i3.AffectedRowsOutput> createMany({ - required _i1.PrismaUnion<_i3.TaskDboCreateManyInput, - Iterable<_i3.TaskDboCreateManyInput>> + required _i1.PrismaUnion<_i3.ProjectTaskDboCreateManyInput, + Iterable<_i3.ProjectTaskDboCreateManyInput>> data, bool? skipDuplicates, }) { @@ -1725,7 +1731,7 @@ class TaskDboDelegate { }; final query = _i1.serializeJsonQuery( args: args, - modelName: 'TaskDbo', + modelName: 'ProjectTaskDbo', action: _i1.JsonQueryAction.createMany, datamodel: PrismaClient.datamodel, ); @@ -1735,20 +1741,20 @@ class TaskDboDelegate { transaction: _client.$transaction.transaction, ); return _i1.ActionClient<_i3.AffectedRowsOutput>( - action: 'createManyTaskDbo', + action: 'createManyProjectTaskDbo', result: result, factory: (e) => _i3.AffectedRowsOutput.fromJson(e), ); } - _i1.ActionClient> + _i1.ActionClient> createManyAndReturn({ - required _i1.PrismaUnion<_i3.TaskDboCreateManyInput, - Iterable<_i3.TaskDboCreateManyInput>> + required _i1.PrismaUnion<_i3.ProjectTaskDboCreateManyInput, + Iterable<_i3.ProjectTaskDboCreateManyInput>> data, bool? skipDuplicates, - _i3.CreateManyTaskDboAndReturnOutputTypeSelect? select, - _i3.CreateManyTaskDboAndReturnOutputTypeInclude? include, + _i3.CreateManyProjectTaskDboAndReturnOutputTypeSelect? select, + _i3.CreateManyProjectTaskDboAndReturnOutputTypeInclude? include, }) { final args = { 'data': data, @@ -1758,7 +1764,7 @@ class TaskDboDelegate { }; final query = _i1.serializeJsonQuery( args: args, - modelName: 'TaskDbo', + modelName: 'ProjectTaskDbo', action: _i1.JsonQueryAction.createManyAndReturn, datamodel: PrismaClient.datamodel, ); @@ -1767,21 +1773,22 @@ class TaskDboDelegate { headers: _client.$transaction.headers, transaction: _client.$transaction.transaction, ); - return _i1.ActionClient>( - action: 'createManyTaskDboAndReturn', + return _i1.ActionClient< + Iterable<_i2.CreateManyProjectTaskDboAndReturnOutputType>>( + action: 'createManyProjectTaskDboAndReturn', result: result, - factory: (values) => (values as Iterable) - .map((e) => _i2.CreateManyTaskDboAndReturnOutputType.fromJson(e)), + factory: (values) => (values as Iterable).map( + (e) => _i2.CreateManyProjectTaskDboAndReturnOutputType.fromJson(e)), ); } - _i1.ActionClient<_i2.TaskDbo?> update({ - required _i1 - .PrismaUnion<_i3.TaskDboUpdateInput, _i3.TaskDboUncheckedUpdateInput> + _i1.ActionClient<_i2.ProjectTaskDbo?> update({ + required _i1.PrismaUnion<_i3.ProjectTaskDboUpdateInput, + _i3.ProjectTaskDboUncheckedUpdateInput> data, - required _i3.TaskDboWhereUniqueInput where, - _i3.TaskDboSelect? select, - _i3.TaskDboInclude? include, + required _i3.ProjectTaskDboWhereUniqueInput where, + _i3.ProjectTaskDboSelect? select, + _i3.ProjectTaskDboInclude? include, }) { final args = { 'data': data, @@ -1791,7 +1798,7 @@ class TaskDboDelegate { }; final query = _i1.serializeJsonQuery( args: args, - modelName: 'TaskDbo', + modelName: 'ProjectTaskDbo', action: _i1.JsonQueryAction.updateOne, datamodel: PrismaClient.datamodel, ); @@ -1800,18 +1807,18 @@ class TaskDboDelegate { headers: _client.$transaction.headers, transaction: _client.$transaction.transaction, ); - return _i1.ActionClient<_i2.TaskDbo?>( - action: 'updateOneTaskDbo', + return _i1.ActionClient<_i2.ProjectTaskDbo?>( + action: 'updateOneProjectTaskDbo', result: result, - factory: (e) => e != null ? _i2.TaskDbo.fromJson(e) : null, + factory: (e) => e != null ? _i2.ProjectTaskDbo.fromJson(e) : null, ); } _i1.ActionClient<_i3.AffectedRowsOutput> updateMany({ - required _i1.PrismaUnion<_i3.TaskDboUpdateManyMutationInput, - _i3.TaskDboUncheckedUpdateManyInput> + required _i1.PrismaUnion<_i3.ProjectTaskDboUpdateManyMutationInput, + _i3.ProjectTaskDboUncheckedUpdateManyInput> data, - _i3.TaskDboWhereInput? where, + _i3.ProjectTaskDboWhereInput? where, }) { final args = { 'data': data, @@ -1819,7 +1826,7 @@ class TaskDboDelegate { }; final query = _i1.serializeJsonQuery( args: args, - modelName: 'TaskDbo', + modelName: 'ProjectTaskDbo', action: _i1.JsonQueryAction.updateMany, datamodel: PrismaClient.datamodel, ); @@ -1829,22 +1836,22 @@ class TaskDboDelegate { transaction: _client.$transaction.transaction, ); return _i1.ActionClient<_i3.AffectedRowsOutput>( - action: 'updateManyTaskDbo', + action: 'updateManyProjectTaskDbo', result: result, factory: (e) => _i3.AffectedRowsOutput.fromJson(e), ); } - _i1.ActionClient<_i2.TaskDbo> upsert({ - required _i3.TaskDboWhereUniqueInput where, - required _i1 - .PrismaUnion<_i3.TaskDboCreateInput, _i3.TaskDboUncheckedCreateInput> + _i1.ActionClient<_i2.ProjectTaskDbo> upsert({ + required _i3.ProjectTaskDboWhereUniqueInput where, + required _i1.PrismaUnion<_i3.ProjectTaskDboCreateInput, + _i3.ProjectTaskDboUncheckedCreateInput> create, - required _i1 - .PrismaUnion<_i3.TaskDboUpdateInput, _i3.TaskDboUncheckedUpdateInput> + required _i1.PrismaUnion<_i3.ProjectTaskDboUpdateInput, + _i3.ProjectTaskDboUncheckedUpdateInput> update, - _i3.TaskDboSelect? select, - _i3.TaskDboInclude? include, + _i3.ProjectTaskDboSelect? select, + _i3.ProjectTaskDboInclude? include, }) { final args = { 'where': where, @@ -1855,7 +1862,7 @@ class TaskDboDelegate { }; final query = _i1.serializeJsonQuery( args: args, - modelName: 'TaskDbo', + modelName: 'ProjectTaskDbo', action: _i1.JsonQueryAction.upsertOne, datamodel: PrismaClient.datamodel, ); @@ -1864,17 +1871,17 @@ class TaskDboDelegate { headers: _client.$transaction.headers, transaction: _client.$transaction.transaction, ); - return _i1.ActionClient<_i2.TaskDbo>( - action: 'upsertOneTaskDbo', + return _i1.ActionClient<_i2.ProjectTaskDbo>( + action: 'upsertOneProjectTaskDbo', result: result, - factory: (e) => _i2.TaskDbo.fromJson(e), + factory: (e) => _i2.ProjectTaskDbo.fromJson(e), ); } - _i1.ActionClient<_i2.TaskDbo?> delete({ - required _i3.TaskDboWhereUniqueInput where, - _i3.TaskDboSelect? select, - _i3.TaskDboInclude? include, + _i1.ActionClient<_i2.ProjectTaskDbo?> delete({ + required _i3.ProjectTaskDboWhereUniqueInput where, + _i3.ProjectTaskDboSelect? select, + _i3.ProjectTaskDboInclude? include, }) { final args = { 'where': where, @@ -1883,7 +1890,7 @@ class TaskDboDelegate { }; final query = _i1.serializeJsonQuery( args: args, - modelName: 'TaskDbo', + modelName: 'ProjectTaskDbo', action: _i1.JsonQueryAction.deleteOne, datamodel: PrismaClient.datamodel, ); @@ -1892,19 +1899,19 @@ class TaskDboDelegate { headers: _client.$transaction.headers, transaction: _client.$transaction.transaction, ); - return _i1.ActionClient<_i2.TaskDbo?>( - action: 'deleteOneTaskDbo', + return _i1.ActionClient<_i2.ProjectTaskDbo?>( + action: 'deleteOneProjectTaskDbo', result: result, - factory: (e) => e != null ? _i2.TaskDbo.fromJson(e) : null, + factory: (e) => e != null ? _i2.ProjectTaskDbo.fromJson(e) : null, ); } _i1.ActionClient<_i3.AffectedRowsOutput> deleteMany( - {_i3.TaskDboWhereInput? where}) { + {_i3.ProjectTaskDboWhereInput? where}) { final args = {'where': where}; final query = _i1.serializeJsonQuery( args: args, - modelName: 'TaskDbo', + modelName: 'ProjectTaskDbo', action: _i1.JsonQueryAction.deleteMany, datamodel: PrismaClient.datamodel, ); @@ -1914,22 +1921,24 @@ class TaskDboDelegate { transaction: _client.$transaction.transaction, ); return _i1.ActionClient<_i3.AffectedRowsOutput>( - action: 'deleteManyTaskDbo', + action: 'deleteManyProjectTaskDbo', result: result, factory: (e) => _i3.AffectedRowsOutput.fromJson(e), ); } - _i1.ActionClient> groupBy({ - _i3.TaskDboWhereInput? where, - _i1.PrismaUnion, - _i3.TaskDboOrderByWithAggregationInput>? + _i1.ActionClient> groupBy({ + _i3.ProjectTaskDboWhereInput? where, + _i1.PrismaUnion, + _i3.ProjectTaskDboOrderByWithAggregationInput>? orderBy, - required _i1.PrismaUnion, _i3.TaskDboScalar> by, - _i3.TaskDboScalarWhereWithAggregatesInput? having, + required _i1.PrismaUnion, + _i3.ProjectTaskDboScalar> + by, + _i3.ProjectTaskDboScalarWhereWithAggregatesInput? having, int? take, int? skip, - _i3.TaskDboGroupByOutputTypeSelect? select, + _i3.ProjectTaskDboGroupByOutputTypeSelect? select, }) { final args = { 'where': where, @@ -1942,7 +1951,7 @@ class TaskDboDelegate { }; final query = _i1.serializeJsonQuery( args: args, - modelName: 'TaskDbo', + modelName: 'ProjectTaskDbo', action: _i1.JsonQueryAction.groupBy, datamodel: PrismaClient.datamodel, ); @@ -1951,23 +1960,23 @@ class TaskDboDelegate { headers: _client.$transaction.headers, transaction: _client.$transaction.transaction, ); - return _i1.ActionClient>( - action: 'groupByTaskDbo', + return _i1.ActionClient>( + action: 'groupByProjectTaskDbo', result: result, factory: (values) => (values as Iterable) - .map((e) => _i3.TaskDboGroupByOutputType.fromJson(e)), + .map((e) => _i3.ProjectTaskDboGroupByOutputType.fromJson(e)), ); } - _i1.ActionClient<_i3.AggregateTaskDbo> aggregate({ - _i3.TaskDboWhereInput? where, - _i1.PrismaUnion, - _i3.TaskDboOrderByWithRelationInput>? + _i1.ActionClient<_i3.AggregateProjectTaskDbo> aggregate({ + _i3.ProjectTaskDboWhereInput? where, + _i1.PrismaUnion, + _i3.ProjectTaskDboOrderByWithRelationInput>? orderBy, - _i3.TaskDboWhereUniqueInput? cursor, + _i3.ProjectTaskDboWhereUniqueInput? cursor, int? take, int? skip, - _i3.AggregateTaskDboSelect? select, + _i3.AggregateProjectTaskDboSelect? select, }) { final args = { 'where': where, @@ -1979,7 +1988,7 @@ class TaskDboDelegate { }; final query = _i1.serializeJsonQuery( args: args, - modelName: 'TaskDbo', + modelName: 'ProjectTaskDbo', action: _i1.JsonQueryAction.aggregate, datamodel: PrismaClient.datamodel, ); @@ -1988,10 +1997,10 @@ class TaskDboDelegate { headers: _client.$transaction.headers, transaction: _client.$transaction.transaction, ); - return _i1.ActionClient<_i3.AggregateTaskDbo>( - action: 'aggregateTaskDbo', + return _i1.ActionClient<_i3.AggregateProjectTaskDbo>( + action: 'aggregateProjectTaskDbo', result: result, - factory: (e) => _i3.AggregateTaskDbo.fromJson(e), + factory: (e) => _i3.AggregateProjectTaskDbo.fromJson(e), ); } } @@ -2219,9 +2228,9 @@ class PrismaClient extends _i1.BasePrismaClient { 'isId': false, 'isReadOnly': false, 'hasDefaultValue': false, - 'type': 'TaskDbo', + 'type': 'ProjectTaskDbo', 'nativeType': null, - 'relationName': 'ProjectDboToTaskDbo', + 'relationName': 'ProjectDboToProjectTaskDbo', 'relationFromFields': [], 'relationToFields': [], 'isGenerated': false, @@ -2479,7 +2488,7 @@ class PrismaClient extends _i1.BasePrismaClient { 'isGenerated': false, }, { - 'name': 'TaskDbo', + 'name': 'ProjectTaskDbo', 'dbName': null, 'schema': null, 'fields': [ @@ -2540,7 +2549,7 @@ class PrismaClient extends _i1.BasePrismaClient { 'hasDefaultValue': false, 'type': 'ProjectDbo', 'nativeType': null, - 'relationName': 'ProjectDboToTaskDbo', + 'relationName': 'ProjectDboToProjectTaskDbo', 'relationFromFields': ['projectId'], 'relationToFields': ['id'], 'isGenerated': false, @@ -2634,7 +2643,7 @@ class PrismaClient extends _i1.BasePrismaClient { ], }, { - 'model': 'TaskDbo', + 'model': 'ProjectTaskDbo', 'type': 'id', 'isDefinedOnField': true, 'fields': [ @@ -2671,7 +2680,7 @@ class PrismaClient extends _i1.BasePrismaClient { @override get $engine => _engine ??= _i5.BinaryEngine( schema: - 'generator dartClient {\n provider = "dart run orm"\n output = "../lib/infrastructure/persistence/db"\n}\n\ndatasource db {\n provider = "postgresql"\n url = env("DATABASE_URL")\n}\n\n// User Model\nmodel UserDbo {\n id String @id @default(uuid())\n name String\n email String @unique\n password String\n projects ProjectDbo[] // Beziehung zu Projekten\n timeEntries TimeEntryDbo[] // Beziehung zu Zeiteinträgen\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// Project Model\nmodel ProjectDbo {\n id String @id @default(uuid())\n name String\n description String?\n clientId String?\n tasks TaskDbo[] // Beziehung zu Aufgaben\n timeEntries TimeEntryDbo[] // Beziehung zu Zeiteinträgen\n user UserDbo @relation(fields: [userId], references: [id])\n userId String\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// TimeEntry Model\nmodel TimeEntryDbo {\n id String @id @default(uuid())\n startTime DateTime\n endTime DateTime\n description String?\n user UserDbo @relation(fields: [userId], references: [id])\n userId String\n project ProjectDbo @relation(fields: [projectId], references: [id])\n projectId String\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// Task Model (optional)\nmodel TaskDbo {\n id String @id @default(uuid())\n name String\n description String?\n project ProjectDbo @relation(fields: [projectId], references: [id])\n projectId String\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n', + 'generator dartClient {\n provider = "dart run orm"\n output = "../lib/infrastructure/persistence/db"\n}\n\ndatasource db {\n provider = "postgresql"\n url = env("DATABASE_URL")\n}\n\n// User Model\nmodel UserDbo {\n id String @id @default(uuid())\n name String\n email String @unique\n password String\n projects ProjectDbo[] // Beziehung zu Projekten\n timeEntries TimeEntryDbo[] // Beziehung zu Zeiteinträgen\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// Project Model\nmodel ProjectDbo {\n id String @id @default(uuid())\n name String\n description String?\n clientId String?\n tasks ProjectTaskDbo[] // Beziehung zu Aufgaben\n timeEntries TimeEntryDbo[] // Beziehung zu Zeiteinträgen\n user UserDbo @relation(fields: [userId], references: [id])\n userId String\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// TimeEntry Model\nmodel TimeEntryDbo {\n id String @id @default(uuid())\n startTime DateTime\n endTime DateTime\n description String?\n user UserDbo @relation(fields: [userId], references: [id])\n userId String\n project ProjectDbo @relation(fields: [projectId], references: [id])\n projectId String\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// Task Model (optional)\nmodel ProjectTaskDbo {\n id String @id @default(uuid())\n name String\n description String?\n project ProjectDbo @relation(fields: [projectId], references: [id])\n projectId String\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n', datasources: const { 'db': _i1.Datasource( _i1.DatasourceType.environment, @@ -2690,5 +2699,5 @@ class PrismaClient extends _i1.BasePrismaClient { TimeEntryDboDelegate get timeEntryDbo => TimeEntryDboDelegate._(this); - TaskDboDelegate get taskDbo => TaskDboDelegate._(this); + ProjectTaskDboDelegate get projectTaskDbo => ProjectTaskDboDelegate._(this); } diff --git a/backend-dart/lib/infrastructure/persistence/db/model.dart b/backend-dart/lib/infrastructure/persistence/db/model.dart index a08c43d..5c812af 100755 --- a/backend-dart/lib/infrastructure/persistence/db/model.dart +++ b/backend-dart/lib/infrastructure/persistence/db/model.dart @@ -2,8 +2,8 @@ import 'model.dart' as _i1; import 'prisma.dart' as _i2; -class TaskDbo { - const TaskDbo({ +class ProjectTaskDbo { + const ProjectTaskDbo({ this.id, this.name, this.description, @@ -13,7 +13,7 @@ class TaskDbo { this.project, }); - factory TaskDbo.fromJson(Map json) => TaskDbo( + factory ProjectTaskDbo.fromJson(Map json) => ProjectTaskDbo( id: json['id'], name: json['name'], description: json['description'], @@ -169,7 +169,7 @@ class ProjectDbo { _ => json['updatedAt'] }, tasks: (json['tasks'] as Iterable?) - ?.map((json) => _i1.TaskDbo.fromJson(json)), + ?.map((json) => _i1.ProjectTaskDbo.fromJson(json)), timeEntries: (json['timeEntries'] as Iterable?) ?.map((json) => _i1.TimeEntryDbo.fromJson(json)), user: json['user'] is Map ? _i1.UserDbo.fromJson(json['user']) : null, @@ -192,7 +192,7 @@ class ProjectDbo { final DateTime? updatedAt; - final Iterable<_i1.TaskDbo>? tasks; + final Iterable<_i1.ProjectTaskDbo>? tasks; final Iterable<_i1.TimeEntryDbo>? timeEntries; @@ -473,8 +473,8 @@ class CreateManyTimeEntryDboAndReturnOutputType { }; } -class CreateManyTaskDboAndReturnOutputType { - const CreateManyTaskDboAndReturnOutputType({ +class CreateManyProjectTaskDboAndReturnOutputType { + const CreateManyProjectTaskDboAndReturnOutputType({ this.id, this.name, this.description, @@ -484,8 +484,8 @@ class CreateManyTaskDboAndReturnOutputType { this.project, }); - factory CreateManyTaskDboAndReturnOutputType.fromJson(Map json) => - CreateManyTaskDboAndReturnOutputType( + factory CreateManyProjectTaskDboAndReturnOutputType.fromJson(Map json) => + CreateManyProjectTaskDboAndReturnOutputType( id: json['id'], name: json['name'], description: json['description'], diff --git a/backend-dart/lib/infrastructure/persistence/db/prisma.dart b/backend-dart/lib/infrastructure/persistence/db/prisma.dart index d9899a8..146546c 100755 --- a/backend-dart/lib/infrastructure/persistence/db/prisma.dart +++ b/backend-dart/lib/infrastructure/persistence/db/prisma.dart @@ -395,8 +395,9 @@ class ProjectDboScalarRelationFilter }; } -class TaskDboWhereInput implements _i1.JsonConvertible> { - const TaskDboWhereInput({ +class ProjectTaskDboWhereInput + implements _i1.JsonConvertible> { + const ProjectTaskDboWhereInput({ this.AND, this.OR, this.NOT, @@ -409,13 +410,13 @@ class TaskDboWhereInput implements _i1.JsonConvertible> { this.project, }); - final _i1.PrismaUnion<_i2.TaskDboWhereInput, Iterable<_i2.TaskDboWhereInput>>? - AND; + final _i1.PrismaUnion<_i2.ProjectTaskDboWhereInput, + Iterable<_i2.ProjectTaskDboWhereInput>>? AND; - final Iterable<_i2.TaskDboWhereInput>? OR; + final Iterable<_i2.ProjectTaskDboWhereInput>? OR; - final _i1.PrismaUnion<_i2.TaskDboWhereInput, Iterable<_i2.TaskDboWhereInput>>? - NOT; + final _i1.PrismaUnion<_i2.ProjectTaskDboWhereInput, + Iterable<_i2.ProjectTaskDboWhereInput>>? NOT; final _i1.PrismaUnion<_i2.StringFilter, String>? id; @@ -448,19 +449,19 @@ class TaskDboWhereInput implements _i1.JsonConvertible> { }; } -class TaskDboListRelationFilter +class ProjectTaskDboListRelationFilter implements _i1.JsonConvertible> { - const TaskDboListRelationFilter({ + const ProjectTaskDboListRelationFilter({ this.every, this.some, this.none, }); - final _i2.TaskDboWhereInput? every; + final _i2.ProjectTaskDboWhereInput? every; - final _i2.TaskDboWhereInput? some; + final _i2.ProjectTaskDboWhereInput? some; - final _i2.TaskDboWhereInput? none; + final _i2.ProjectTaskDboWhereInput? none; @override Map toJson() => { @@ -619,7 +620,7 @@ class ProjectDboWhereInput final _i1.PrismaUnion<_i2.DateTimeFilter, DateTime>? updatedAt; - final _i2.TaskDboListRelationFilter? tasks; + final _i2.ProjectTaskDboListRelationFilter? tasks; final _i2.TimeEntryDboListRelationFilter? timeEntries; @@ -777,8 +778,9 @@ class UserDboWhereUniqueInput }; } -class TaskDboProjectArgs implements _i1.JsonConvertible> { - const TaskDboProjectArgs({ +class ProjectTaskDboProjectArgs + implements _i1.JsonConvertible> { + const ProjectTaskDboProjectArgs({ this.select, this.include, }); @@ -794,10 +796,11 @@ class TaskDboProjectArgs implements _i1.JsonConvertible> { }; } -class TaskDboInclude implements _i1.JsonConvertible> { - const TaskDboInclude({this.project}); +class ProjectTaskDboInclude + implements _i1.JsonConvertible> { + const ProjectTaskDboInclude({this.project}); - final _i1.PrismaUnion? project; + final _i1.PrismaUnion? project; @override Map toJson() => {'project': project}; @@ -840,9 +843,9 @@ class SortOrderInput implements _i1.JsonConvertible> { }; } -class TaskDboOrderByRelationAggregateInput +class ProjectTaskDboOrderByRelationAggregateInput implements _i1.JsonConvertible> { - const TaskDboOrderByRelationAggregateInput({this.$count}); + const ProjectTaskDboOrderByRelationAggregateInput({this.$count}); final _i2.SortOrder? $count; @@ -941,7 +944,7 @@ class ProjectDboOrderByWithRelationInput final _i2.SortOrder? updatedAt; - final _i2.TaskDboOrderByRelationAggregateInput? tasks; + final _i2.ProjectTaskDboOrderByRelationAggregateInput? tasks; final _i2.TimeEntryDboOrderByRelationAggregateInput? timeEntries; @@ -962,9 +965,9 @@ class ProjectDboOrderByWithRelationInput }; } -class TaskDboOrderByWithRelationInput +class ProjectTaskDboOrderByWithRelationInput implements _i1.JsonConvertible> { - const TaskDboOrderByWithRelationInput({ + const ProjectTaskDboOrderByWithRelationInput({ this.id, this.name, this.description, @@ -1000,9 +1003,9 @@ class TaskDboOrderByWithRelationInput }; } -class TaskDboWhereUniqueInput +class ProjectTaskDboWhereUniqueInput implements _i1.JsonConvertible> { - const TaskDboWhereUniqueInput({ + const ProjectTaskDboWhereUniqueInput({ this.id, this.AND, this.OR, @@ -1017,13 +1020,13 @@ class TaskDboWhereUniqueInput final String? id; - final _i1.PrismaUnion<_i2.TaskDboWhereInput, Iterable<_i2.TaskDboWhereInput>>? - AND; + final _i1.PrismaUnion<_i2.ProjectTaskDboWhereInput, + Iterable<_i2.ProjectTaskDboWhereInput>>? AND; - final Iterable<_i2.TaskDboWhereInput>? OR; + final Iterable<_i2.ProjectTaskDboWhereInput>? OR; - final _i1.PrismaUnion<_i2.TaskDboWhereInput, Iterable<_i2.TaskDboWhereInput>>? - NOT; + final _i1.PrismaUnion<_i2.ProjectTaskDboWhereInput, + Iterable<_i2.ProjectTaskDboWhereInput>>? NOT; final _i1.PrismaUnion<_i2.StringFilter, String>? name; @@ -1054,15 +1057,15 @@ class TaskDboWhereUniqueInput }; } -enum TaskDboScalar implements _i1.PrismaEnum, _i1.Reference { - id('id', 'TaskDbo'), - name$('name', 'TaskDbo'), - description('description', 'TaskDbo'), - projectId('projectId', 'TaskDbo'), - createdAt('createdAt', 'TaskDbo'), - updatedAt('updatedAt', 'TaskDbo'); +enum ProjectTaskDboScalar implements _i1.PrismaEnum, _i1.Reference { + id('id', 'ProjectTaskDbo'), + name$('name', 'ProjectTaskDbo'), + description('description', 'ProjectTaskDbo'), + projectId('projectId', 'ProjectTaskDbo'), + createdAt('createdAt', 'ProjectTaskDbo'), + updatedAt('updatedAt', 'ProjectTaskDbo'); - const TaskDboScalar( + const ProjectTaskDboScalar( this.name, this.model, ); @@ -1086,23 +1089,23 @@ class ProjectDboTasksArgs implements _i1.JsonConvertible> { this.include, }); - final _i2.TaskDboWhereInput? where; + final _i2.ProjectTaskDboWhereInput? where; - final _i1.PrismaUnion, - _i2.TaskDboOrderByWithRelationInput>? orderBy; + final _i1.PrismaUnion, + _i2.ProjectTaskDboOrderByWithRelationInput>? orderBy; - final _i2.TaskDboWhereUniqueInput? cursor; + final _i2.ProjectTaskDboWhereUniqueInput? cursor; final int? take; final int? skip; - final _i1.PrismaUnion<_i2.TaskDboScalar, Iterable<_i2.TaskDboScalar>>? - distinct; + final _i1.PrismaUnion<_i2.ProjectTaskDboScalar, + Iterable<_i2.ProjectTaskDboScalar>>? distinct; - final _i2.TaskDboSelect? select; + final _i2.ProjectTaskDboSelect? select; - final _i2.TaskDboInclude? include; + final _i2.ProjectTaskDboInclude? include; @override Map toJson() => { @@ -1159,7 +1162,7 @@ class ProjectDboWhereUniqueInput final _i1.PrismaUnion<_i2.DateTimeFilter, DateTime>? updatedAt; - final _i2.TaskDboListRelationFilter? tasks; + final _i2.ProjectTaskDboListRelationFilter? tasks; final _i2.TimeEntryDboListRelationFilter? timeEntries; @@ -1696,8 +1699,9 @@ class ProjectDboInclude implements _i1.JsonConvertible> { }; } -class TaskDboSelect implements _i1.JsonConvertible> { - const TaskDboSelect({ +class ProjectTaskDboSelect + implements _i1.JsonConvertible> { + const ProjectTaskDboSelect({ this.id, this.name, this.description, @@ -1719,7 +1723,7 @@ class TaskDboSelect implements _i1.JsonConvertible> { final bool? updatedAt; - final _i1.PrismaUnion? project; + final _i1.PrismaUnion? project; @override Map toJson() => { @@ -1851,9 +1855,9 @@ enum UserDboScalar implements _i1.PrismaEnum, _i1.Reference { final String model; } -class TaskDboCreateWithoutProjectInput +class ProjectTaskDboCreateWithoutProjectInput implements _i1.JsonConvertible> { - const TaskDboCreateWithoutProjectInput({ + const ProjectTaskDboCreateWithoutProjectInput({ this.id, required this.name, this.description, @@ -1881,9 +1885,9 @@ class TaskDboCreateWithoutProjectInput }; } -class TaskDboUncheckedCreateWithoutProjectInput +class ProjectTaskDboUncheckedCreateWithoutProjectInput implements _i1.JsonConvertible> { - const TaskDboUncheckedCreateWithoutProjectInput({ + const ProjectTaskDboUncheckedCreateWithoutProjectInput({ this.id, required this.name, this.description, @@ -1911,17 +1915,17 @@ class TaskDboUncheckedCreateWithoutProjectInput }; } -class TaskDboCreateOrConnectWithoutProjectInput +class ProjectTaskDboCreateOrConnectWithoutProjectInput implements _i1.JsonConvertible> { - const TaskDboCreateOrConnectWithoutProjectInput({ + const ProjectTaskDboCreateOrConnectWithoutProjectInput({ required this.where, required this.create, }); - final _i2.TaskDboWhereUniqueInput where; + final _i2.ProjectTaskDboWhereUniqueInput where; - final _i1.PrismaUnion<_i2.TaskDboCreateWithoutProjectInput, - _i2.TaskDboUncheckedCreateWithoutProjectInput> create; + final _i1.PrismaUnion<_i2.ProjectTaskDboCreateWithoutProjectInput, + _i2.ProjectTaskDboUncheckedCreateWithoutProjectInput> create; @override Map toJson() => { @@ -1930,9 +1934,9 @@ class TaskDboCreateOrConnectWithoutProjectInput }; } -class TaskDboCreateManyProjectInput +class ProjectTaskDboCreateManyProjectInput implements _i1.JsonConvertible> { - const TaskDboCreateManyProjectInput({ + const ProjectTaskDboCreateManyProjectInput({ this.id, required this.name, this.description, @@ -1960,15 +1964,15 @@ class TaskDboCreateManyProjectInput }; } -class TaskDboCreateManyProjectInputEnvelope +class ProjectTaskDboCreateManyProjectInputEnvelope implements _i1.JsonConvertible> { - const TaskDboCreateManyProjectInputEnvelope({ + const ProjectTaskDboCreateManyProjectInputEnvelope({ required this.data, this.skipDuplicates, }); - final _i1.PrismaUnion<_i2.TaskDboCreateManyProjectInput, - Iterable<_i2.TaskDboCreateManyProjectInput>> data; + final _i1.PrismaUnion<_i2.ProjectTaskDboCreateManyProjectInput, + Iterable<_i2.ProjectTaskDboCreateManyProjectInput>> data; final bool? skipDuplicates; @@ -1979,9 +1983,9 @@ class TaskDboCreateManyProjectInputEnvelope }; } -class TaskDboCreateNestedManyWithoutProjectInput +class ProjectTaskDboCreateNestedManyWithoutProjectInput implements _i1.JsonConvertible> { - const TaskDboCreateNestedManyWithoutProjectInput({ + const ProjectTaskDboCreateNestedManyWithoutProjectInput({ this.create, this.connectOrCreate, this.createMany, @@ -1989,20 +1993,23 @@ class TaskDboCreateNestedManyWithoutProjectInput }); final _i1.PrismaUnion< - _i2.TaskDboCreateWithoutProjectInput, + _i2.ProjectTaskDboCreateWithoutProjectInput, _i1.PrismaUnion< - Iterable<_i2.TaskDboCreateWithoutProjectInput>, - _i1.PrismaUnion<_i2.TaskDboUncheckedCreateWithoutProjectInput, - Iterable<_i2.TaskDboUncheckedCreateWithoutProjectInput>>>>? + Iterable<_i2.ProjectTaskDboCreateWithoutProjectInput>, + _i1.PrismaUnion< + _i2.ProjectTaskDboUncheckedCreateWithoutProjectInput, + Iterable< + _i2.ProjectTaskDboUncheckedCreateWithoutProjectInput>>>>? create; - final _i1.PrismaUnion<_i2.TaskDboCreateOrConnectWithoutProjectInput, - Iterable<_i2.TaskDboCreateOrConnectWithoutProjectInput>>? connectOrCreate; + final _i1.PrismaUnion<_i2.ProjectTaskDboCreateOrConnectWithoutProjectInput, + Iterable<_i2.ProjectTaskDboCreateOrConnectWithoutProjectInput>>? + connectOrCreate; - final _i2.TaskDboCreateManyProjectInputEnvelope? createMany; + final _i2.ProjectTaskDboCreateManyProjectInputEnvelope? createMany; - final _i1.PrismaUnion<_i2.TaskDboWhereUniqueInput, - Iterable<_i2.TaskDboWhereUniqueInput>>? connect; + final _i1.PrismaUnion<_i2.ProjectTaskDboWhereUniqueInput, + Iterable<_i2.ProjectTaskDboWhereUniqueInput>>? connect; @override Map toJson() => { @@ -2051,9 +2058,9 @@ class UserDboCreateWithoutTimeEntriesInput }; } -class TaskDboUncheckedCreateNestedManyWithoutProjectInput +class ProjectTaskDboUncheckedCreateNestedManyWithoutProjectInput implements _i1.JsonConvertible> { - const TaskDboUncheckedCreateNestedManyWithoutProjectInput({ + const ProjectTaskDboUncheckedCreateNestedManyWithoutProjectInput({ this.create, this.connectOrCreate, this.createMany, @@ -2061,20 +2068,23 @@ class TaskDboUncheckedCreateNestedManyWithoutProjectInput }); final _i1.PrismaUnion< - _i2.TaskDboCreateWithoutProjectInput, + _i2.ProjectTaskDboCreateWithoutProjectInput, _i1.PrismaUnion< - Iterable<_i2.TaskDboCreateWithoutProjectInput>, - _i1.PrismaUnion<_i2.TaskDboUncheckedCreateWithoutProjectInput, - Iterable<_i2.TaskDboUncheckedCreateWithoutProjectInput>>>>? + Iterable<_i2.ProjectTaskDboCreateWithoutProjectInput>, + _i1.PrismaUnion< + _i2.ProjectTaskDboUncheckedCreateWithoutProjectInput, + Iterable< + _i2.ProjectTaskDboUncheckedCreateWithoutProjectInput>>>>? create; - final _i1.PrismaUnion<_i2.TaskDboCreateOrConnectWithoutProjectInput, - Iterable<_i2.TaskDboCreateOrConnectWithoutProjectInput>>? connectOrCreate; + final _i1.PrismaUnion<_i2.ProjectTaskDboCreateOrConnectWithoutProjectInput, + Iterable<_i2.ProjectTaskDboCreateOrConnectWithoutProjectInput>>? + connectOrCreate; - final _i2.TaskDboCreateManyProjectInputEnvelope? createMany; + final _i2.ProjectTaskDboCreateManyProjectInputEnvelope? createMany; - final _i1.PrismaUnion<_i2.TaskDboWhereUniqueInput, - Iterable<_i2.TaskDboWhereUniqueInput>>? connect; + final _i1.PrismaUnion<_i2.ProjectTaskDboWhereUniqueInput, + Iterable<_i2.ProjectTaskDboWhereUniqueInput>>? connect; @override Map toJson() => { @@ -2261,7 +2271,7 @@ class ProjectDboUncheckedCreateWithoutUserInput final DateTime? updatedAt; - final _i2.TaskDboUncheckedCreateNestedManyWithoutProjectInput? tasks; + final _i2.ProjectTaskDboUncheckedCreateNestedManyWithoutProjectInput? tasks; final _i2.TimeEntryDboUncheckedCreateNestedManyWithoutProjectInput? timeEntries; @@ -2565,7 +2575,7 @@ class ProjectDboCreateWithoutUserInput final DateTime? updatedAt; - final _i2.TaskDboCreateNestedManyWithoutProjectInput? tasks; + final _i2.ProjectTaskDboCreateNestedManyWithoutProjectInput? tasks; final _i2.TimeEntryDboCreateNestedManyWithoutProjectInput? timeEntries; @@ -2908,7 +2918,7 @@ class ProjectDboCreateWithoutTimeEntriesInput final DateTime? updatedAt; - final _i2.TaskDboCreateNestedManyWithoutProjectInput? tasks; + final _i2.ProjectTaskDboCreateNestedManyWithoutProjectInput? tasks; final _i2.UserDboCreateNestedOneWithoutProjectsInput user; @@ -2952,7 +2962,7 @@ class ProjectDboUncheckedCreateWithoutTimeEntriesInput final DateTime? updatedAt; - final _i2.TaskDboUncheckedCreateNestedManyWithoutProjectInput? tasks; + final _i2.ProjectTaskDboUncheckedCreateNestedManyWithoutProjectInput? tasks; @override Map toJson() => { @@ -3274,9 +3284,9 @@ class NullableStringFieldUpdateOperationsInput Map toJson() => {'set': set}; } -class TaskDboUpdateWithoutProjectInput +class ProjectTaskDboUpdateWithoutProjectInput implements _i1.JsonConvertible> { - const TaskDboUpdateWithoutProjectInput({ + const ProjectTaskDboUpdateWithoutProjectInput({ this.id, this.name, this.description, @@ -3309,9 +3319,9 @@ class TaskDboUpdateWithoutProjectInput }; } -class TaskDboUncheckedUpdateWithoutProjectInput +class ProjectTaskDboUncheckedUpdateWithoutProjectInput implements _i1.JsonConvertible> { - const TaskDboUncheckedUpdateWithoutProjectInput({ + const ProjectTaskDboUncheckedUpdateWithoutProjectInput({ this.id, this.name, this.description, @@ -3344,21 +3354,21 @@ class TaskDboUncheckedUpdateWithoutProjectInput }; } -class TaskDboUpsertWithWhereUniqueWithoutProjectInput +class ProjectTaskDboUpsertWithWhereUniqueWithoutProjectInput implements _i1.JsonConvertible> { - const TaskDboUpsertWithWhereUniqueWithoutProjectInput({ + const ProjectTaskDboUpsertWithWhereUniqueWithoutProjectInput({ required this.where, required this.update, required this.create, }); - final _i2.TaskDboWhereUniqueInput where; + final _i2.ProjectTaskDboWhereUniqueInput where; - final _i1.PrismaUnion<_i2.TaskDboUpdateWithoutProjectInput, - _i2.TaskDboUncheckedUpdateWithoutProjectInput> update; + final _i1.PrismaUnion<_i2.ProjectTaskDboUpdateWithoutProjectInput, + _i2.ProjectTaskDboUncheckedUpdateWithoutProjectInput> update; - final _i1.PrismaUnion<_i2.TaskDboCreateWithoutProjectInput, - _i2.TaskDboUncheckedCreateWithoutProjectInput> create; + final _i1.PrismaUnion<_i2.ProjectTaskDboCreateWithoutProjectInput, + _i2.ProjectTaskDboUncheckedCreateWithoutProjectInput> create; @override Map toJson() => { @@ -3368,17 +3378,17 @@ class TaskDboUpsertWithWhereUniqueWithoutProjectInput }; } -class TaskDboUpdateWithWhereUniqueWithoutProjectInput +class ProjectTaskDboUpdateWithWhereUniqueWithoutProjectInput implements _i1.JsonConvertible> { - const TaskDboUpdateWithWhereUniqueWithoutProjectInput({ + const ProjectTaskDboUpdateWithWhereUniqueWithoutProjectInput({ required this.where, required this.data, }); - final _i2.TaskDboWhereUniqueInput where; + final _i2.ProjectTaskDboWhereUniqueInput where; - final _i1.PrismaUnion<_i2.TaskDboUpdateWithoutProjectInput, - _i2.TaskDboUncheckedUpdateWithoutProjectInput> data; + final _i1.PrismaUnion<_i2.ProjectTaskDboUpdateWithoutProjectInput, + _i2.ProjectTaskDboUncheckedUpdateWithoutProjectInput> data; @override Map toJson() => { @@ -3387,9 +3397,9 @@ class TaskDboUpdateWithWhereUniqueWithoutProjectInput }; } -class TaskDboScalarWhereInput +class ProjectTaskDboScalarWhereInput implements _i1.JsonConvertible> { - const TaskDboScalarWhereInput({ + const ProjectTaskDboScalarWhereInput({ this.AND, this.OR, this.NOT, @@ -3401,13 +3411,13 @@ class TaskDboScalarWhereInput this.updatedAt, }); - final _i1.PrismaUnion<_i2.TaskDboScalarWhereInput, - Iterable<_i2.TaskDboScalarWhereInput>>? AND; + final _i1.PrismaUnion<_i2.ProjectTaskDboScalarWhereInput, + Iterable<_i2.ProjectTaskDboScalarWhereInput>>? AND; - final Iterable<_i2.TaskDboScalarWhereInput>? OR; + final Iterable<_i2.ProjectTaskDboScalarWhereInput>? OR; - final _i1.PrismaUnion<_i2.TaskDboScalarWhereInput, - Iterable<_i2.TaskDboScalarWhereInput>>? NOT; + final _i1.PrismaUnion<_i2.ProjectTaskDboScalarWhereInput, + Iterable<_i2.ProjectTaskDboScalarWhereInput>>? NOT; final _i1.PrismaUnion<_i2.StringFilter, String>? id; @@ -3436,9 +3446,9 @@ class TaskDboScalarWhereInput }; } -class TaskDboUpdateManyMutationInput +class ProjectTaskDboUpdateManyMutationInput implements _i1.JsonConvertible> { - const TaskDboUpdateManyMutationInput({ + const ProjectTaskDboUpdateManyMutationInput({ this.id, this.name, this.description, @@ -3471,9 +3481,9 @@ class TaskDboUpdateManyMutationInput }; } -class TaskDboUncheckedUpdateManyWithoutProjectInput +class ProjectTaskDboUncheckedUpdateManyWithoutProjectInput implements _i1.JsonConvertible> { - const TaskDboUncheckedUpdateManyWithoutProjectInput({ + const ProjectTaskDboUncheckedUpdateManyWithoutProjectInput({ this.id, this.name, this.description, @@ -3506,17 +3516,17 @@ class TaskDboUncheckedUpdateManyWithoutProjectInput }; } -class TaskDboUpdateManyWithWhereWithoutProjectInput +class ProjectTaskDboUpdateManyWithWhereWithoutProjectInput implements _i1.JsonConvertible> { - const TaskDboUpdateManyWithWhereWithoutProjectInput({ + const ProjectTaskDboUpdateManyWithWhereWithoutProjectInput({ required this.where, required this.data, }); - final _i2.TaskDboScalarWhereInput where; + final _i2.ProjectTaskDboScalarWhereInput where; - final _i1.PrismaUnion<_i2.TaskDboUpdateManyMutationInput, - _i2.TaskDboUncheckedUpdateManyWithoutProjectInput> data; + final _i1.PrismaUnion<_i2.ProjectTaskDboUpdateManyMutationInput, + _i2.ProjectTaskDboUncheckedUpdateManyWithoutProjectInput> data; @override Map toJson() => { @@ -3525,9 +3535,9 @@ class TaskDboUpdateManyWithWhereWithoutProjectInput }; } -class TaskDboUpdateManyWithoutProjectNestedInput +class ProjectTaskDboUpdateManyWithoutProjectNestedInput implements _i1.JsonConvertible> { - const TaskDboUpdateManyWithoutProjectNestedInput({ + const ProjectTaskDboUpdateManyWithoutProjectNestedInput({ this.create, this.connectOrCreate, this.upsert, @@ -3542,41 +3552,50 @@ class TaskDboUpdateManyWithoutProjectNestedInput }); final _i1.PrismaUnion< - _i2.TaskDboCreateWithoutProjectInput, + _i2.ProjectTaskDboCreateWithoutProjectInput, _i1.PrismaUnion< - Iterable<_i2.TaskDboCreateWithoutProjectInput>, - _i1.PrismaUnion<_i2.TaskDboUncheckedCreateWithoutProjectInput, - Iterable<_i2.TaskDboUncheckedCreateWithoutProjectInput>>>>? + Iterable<_i2.ProjectTaskDboCreateWithoutProjectInput>, + _i1.PrismaUnion< + _i2.ProjectTaskDboUncheckedCreateWithoutProjectInput, + Iterable< + _i2.ProjectTaskDboUncheckedCreateWithoutProjectInput>>>>? create; - final _i1.PrismaUnion<_i2.TaskDboCreateOrConnectWithoutProjectInput, - Iterable<_i2.TaskDboCreateOrConnectWithoutProjectInput>>? connectOrCreate; + final _i1.PrismaUnion<_i2.ProjectTaskDboCreateOrConnectWithoutProjectInput, + Iterable<_i2.ProjectTaskDboCreateOrConnectWithoutProjectInput>>? + connectOrCreate; - final _i1.PrismaUnion<_i2.TaskDboUpsertWithWhereUniqueWithoutProjectInput, - Iterable<_i2.TaskDboUpsertWithWhereUniqueWithoutProjectInput>>? upsert; + final _i1.PrismaUnion< + _i2.ProjectTaskDboUpsertWithWhereUniqueWithoutProjectInput, + Iterable<_i2.ProjectTaskDboUpsertWithWhereUniqueWithoutProjectInput>>? + upsert; - final _i2.TaskDboCreateManyProjectInputEnvelope? createMany; + final _i2.ProjectTaskDboCreateManyProjectInputEnvelope? createMany; - final _i1.PrismaUnion<_i2.TaskDboWhereUniqueInput, - Iterable<_i2.TaskDboWhereUniqueInput>>? set; + final _i1.PrismaUnion<_i2.ProjectTaskDboWhereUniqueInput, + Iterable<_i2.ProjectTaskDboWhereUniqueInput>>? set; - final _i1.PrismaUnion<_i2.TaskDboWhereUniqueInput, - Iterable<_i2.TaskDboWhereUniqueInput>>? disconnect; + final _i1.PrismaUnion<_i2.ProjectTaskDboWhereUniqueInput, + Iterable<_i2.ProjectTaskDboWhereUniqueInput>>? disconnect; - final _i1.PrismaUnion<_i2.TaskDboWhereUniqueInput, - Iterable<_i2.TaskDboWhereUniqueInput>>? delete; + final _i1.PrismaUnion<_i2.ProjectTaskDboWhereUniqueInput, + Iterable<_i2.ProjectTaskDboWhereUniqueInput>>? delete; - final _i1.PrismaUnion<_i2.TaskDboWhereUniqueInput, - Iterable<_i2.TaskDboWhereUniqueInput>>? connect; + final _i1.PrismaUnion<_i2.ProjectTaskDboWhereUniqueInput, + Iterable<_i2.ProjectTaskDboWhereUniqueInput>>? connect; - final _i1.PrismaUnion<_i2.TaskDboUpdateWithWhereUniqueWithoutProjectInput, - Iterable<_i2.TaskDboUpdateWithWhereUniqueWithoutProjectInput>>? update; + final _i1.PrismaUnion< + _i2.ProjectTaskDboUpdateWithWhereUniqueWithoutProjectInput, + Iterable<_i2.ProjectTaskDboUpdateWithWhereUniqueWithoutProjectInput>>? + update; - final _i1.PrismaUnion<_i2.TaskDboUpdateManyWithWhereWithoutProjectInput, - Iterable<_i2.TaskDboUpdateManyWithWhereWithoutProjectInput>>? updateMany; + final _i1.PrismaUnion< + _i2.ProjectTaskDboUpdateManyWithWhereWithoutProjectInput, + Iterable<_i2.ProjectTaskDboUpdateManyWithWhereWithoutProjectInput>>? + updateMany; - final _i1.PrismaUnion<_i2.TaskDboScalarWhereInput, - Iterable<_i2.TaskDboScalarWhereInput>>? deleteMany; + final _i1.PrismaUnion<_i2.ProjectTaskDboScalarWhereInput, + Iterable<_i2.ProjectTaskDboScalarWhereInput>>? deleteMany; @override Map toJson() => { @@ -3634,9 +3653,9 @@ class UserDboUpdateWithoutTimeEntriesInput }; } -class TaskDboUncheckedUpdateManyWithoutProjectNestedInput +class ProjectTaskDboUncheckedUpdateManyWithoutProjectNestedInput implements _i1.JsonConvertible> { - const TaskDboUncheckedUpdateManyWithoutProjectNestedInput({ + const ProjectTaskDboUncheckedUpdateManyWithoutProjectNestedInput({ this.create, this.connectOrCreate, this.upsert, @@ -3651,41 +3670,50 @@ class TaskDboUncheckedUpdateManyWithoutProjectNestedInput }); final _i1.PrismaUnion< - _i2.TaskDboCreateWithoutProjectInput, + _i2.ProjectTaskDboCreateWithoutProjectInput, _i1.PrismaUnion< - Iterable<_i2.TaskDboCreateWithoutProjectInput>, - _i1.PrismaUnion<_i2.TaskDboUncheckedCreateWithoutProjectInput, - Iterable<_i2.TaskDboUncheckedCreateWithoutProjectInput>>>>? + Iterable<_i2.ProjectTaskDboCreateWithoutProjectInput>, + _i1.PrismaUnion< + _i2.ProjectTaskDboUncheckedCreateWithoutProjectInput, + Iterable< + _i2.ProjectTaskDboUncheckedCreateWithoutProjectInput>>>>? create; - final _i1.PrismaUnion<_i2.TaskDboCreateOrConnectWithoutProjectInput, - Iterable<_i2.TaskDboCreateOrConnectWithoutProjectInput>>? connectOrCreate; + final _i1.PrismaUnion<_i2.ProjectTaskDboCreateOrConnectWithoutProjectInput, + Iterable<_i2.ProjectTaskDboCreateOrConnectWithoutProjectInput>>? + connectOrCreate; - final _i1.PrismaUnion<_i2.TaskDboUpsertWithWhereUniqueWithoutProjectInput, - Iterable<_i2.TaskDboUpsertWithWhereUniqueWithoutProjectInput>>? upsert; + final _i1.PrismaUnion< + _i2.ProjectTaskDboUpsertWithWhereUniqueWithoutProjectInput, + Iterable<_i2.ProjectTaskDboUpsertWithWhereUniqueWithoutProjectInput>>? + upsert; - final _i2.TaskDboCreateManyProjectInputEnvelope? createMany; + final _i2.ProjectTaskDboCreateManyProjectInputEnvelope? createMany; - final _i1.PrismaUnion<_i2.TaskDboWhereUniqueInput, - Iterable<_i2.TaskDboWhereUniqueInput>>? set; + final _i1.PrismaUnion<_i2.ProjectTaskDboWhereUniqueInput, + Iterable<_i2.ProjectTaskDboWhereUniqueInput>>? set; - final _i1.PrismaUnion<_i2.TaskDboWhereUniqueInput, - Iterable<_i2.TaskDboWhereUniqueInput>>? disconnect; + final _i1.PrismaUnion<_i2.ProjectTaskDboWhereUniqueInput, + Iterable<_i2.ProjectTaskDboWhereUniqueInput>>? disconnect; - final _i1.PrismaUnion<_i2.TaskDboWhereUniqueInput, - Iterable<_i2.TaskDboWhereUniqueInput>>? delete; + final _i1.PrismaUnion<_i2.ProjectTaskDboWhereUniqueInput, + Iterable<_i2.ProjectTaskDboWhereUniqueInput>>? delete; - final _i1.PrismaUnion<_i2.TaskDboWhereUniqueInput, - Iterable<_i2.TaskDboWhereUniqueInput>>? connect; + final _i1.PrismaUnion<_i2.ProjectTaskDboWhereUniqueInput, + Iterable<_i2.ProjectTaskDboWhereUniqueInput>>? connect; - final _i1.PrismaUnion<_i2.TaskDboUpdateWithWhereUniqueWithoutProjectInput, - Iterable<_i2.TaskDboUpdateWithWhereUniqueWithoutProjectInput>>? update; + final _i1.PrismaUnion< + _i2.ProjectTaskDboUpdateWithWhereUniqueWithoutProjectInput, + Iterable<_i2.ProjectTaskDboUpdateWithWhereUniqueWithoutProjectInput>>? + update; - final _i1.PrismaUnion<_i2.TaskDboUpdateManyWithWhereWithoutProjectInput, - Iterable<_i2.TaskDboUpdateManyWithWhereWithoutProjectInput>>? updateMany; + final _i1.PrismaUnion< + _i2.ProjectTaskDboUpdateManyWithWhereWithoutProjectInput, + Iterable<_i2.ProjectTaskDboUpdateManyWithWhereWithoutProjectInput>>? + updateMany; - final _i1.PrismaUnion<_i2.TaskDboScalarWhereInput, - Iterable<_i2.TaskDboScalarWhereInput>>? deleteMany; + final _i1.PrismaUnion<_i2.ProjectTaskDboScalarWhereInput, + Iterable<_i2.ProjectTaskDboScalarWhereInput>>? deleteMany; @override Map toJson() => { @@ -4039,7 +4067,7 @@ class ProjectDboUncheckedUpdateWithoutUserInput final _i1.PrismaUnion? updatedAt; - final _i2.TaskDboUncheckedUpdateManyWithoutProjectNestedInput? tasks; + final _i2.ProjectTaskDboUncheckedUpdateManyWithoutProjectNestedInput? tasks; final _i2.TimeEntryDboUncheckedUpdateManyWithoutProjectNestedInput? timeEntries; @@ -4598,7 +4626,7 @@ class ProjectDboUpdateWithoutUserInput final _i1.PrismaUnion? updatedAt; - final _i2.TaskDboUpdateManyWithoutProjectNestedInput? tasks; + final _i2.ProjectTaskDboUpdateManyWithoutProjectNestedInput? tasks; final _i2.TimeEntryDboUpdateManyWithoutProjectNestedInput? timeEntries; @@ -5099,7 +5127,7 @@ class ProjectDboUpdateWithoutTimeEntriesInput final _i1.PrismaUnion? updatedAt; - final _i2.TaskDboUpdateManyWithoutProjectNestedInput? tasks; + final _i2.ProjectTaskDboUpdateManyWithoutProjectNestedInput? tasks; final _i2.UserDboUpdateOneRequiredWithoutProjectsNestedInput? user; @@ -5151,7 +5179,7 @@ class ProjectDboUncheckedUpdateWithoutTimeEntriesInput final _i1.PrismaUnion? updatedAt; - final _i2.TaskDboUncheckedUpdateManyWithoutProjectNestedInput? tasks; + final _i2.ProjectTaskDboUncheckedUpdateManyWithoutProjectNestedInput? tasks; @override Map toJson() => { @@ -6539,7 +6567,7 @@ class ProjectDboCreateInput final DateTime? updatedAt; - final _i2.TaskDboCreateNestedManyWithoutProjectInput? tasks; + final _i2.ProjectTaskDboCreateNestedManyWithoutProjectInput? tasks; final _i2.TimeEntryDboCreateNestedManyWithoutProjectInput? timeEntries; @@ -6587,7 +6615,7 @@ class ProjectDboUncheckedCreateInput final DateTime? updatedAt; - final _i2.TaskDboUncheckedCreateNestedManyWithoutProjectInput? tasks; + final _i2.ProjectTaskDboUncheckedCreateNestedManyWithoutProjectInput? tasks; final _i2.TimeEntryDboUncheckedCreateNestedManyWithoutProjectInput? timeEntries; @@ -6752,7 +6780,7 @@ class ProjectDboUpdateInput final _i1.PrismaUnion? updatedAt; - final _i2.TaskDboUpdateManyWithoutProjectNestedInput? tasks; + final _i2.ProjectTaskDboUpdateManyWithoutProjectNestedInput? tasks; final _i2.TimeEntryDboUpdateManyWithoutProjectNestedInput? timeEntries; @@ -6808,7 +6836,7 @@ class ProjectDboUncheckedUpdateInput final _i1.PrismaUnion? updatedAt; - final _i2.TaskDboUncheckedUpdateManyWithoutProjectNestedInput? tasks; + final _i2.ProjectTaskDboUncheckedUpdateManyWithoutProjectNestedInput? tasks; final _i2.TimeEntryDboUncheckedUpdateManyWithoutProjectNestedInput? timeEntries; @@ -9136,8 +9164,9 @@ class ProjectDboCreateNestedOneWithoutTasksInput }; } -class TaskDboCreateInput implements _i1.JsonConvertible> { - const TaskDboCreateInput({ +class ProjectTaskDboCreateInput + implements _i1.JsonConvertible> { + const ProjectTaskDboCreateInput({ this.id, required this.name, this.description, @@ -9169,9 +9198,9 @@ class TaskDboCreateInput implements _i1.JsonConvertible> { }; } -class TaskDboUncheckedCreateInput +class ProjectTaskDboUncheckedCreateInput implements _i1.JsonConvertible> { - const TaskDboUncheckedCreateInput({ + const ProjectTaskDboUncheckedCreateInput({ this.id, required this.name, this.description, @@ -9203,9 +9232,9 @@ class TaskDboUncheckedCreateInput }; } -class TaskDboCreateManyInput +class ProjectTaskDboCreateManyInput implements _i1.JsonConvertible> { - const TaskDboCreateManyInput({ + const ProjectTaskDboCreateManyInput({ this.id, required this.name, this.description, @@ -9237,9 +9266,9 @@ class TaskDboCreateManyInput }; } -class CreateManyTaskDboAndReturnOutputTypeProjectArgs +class CreateManyProjectTaskDboAndReturnOutputTypeProjectArgs implements _i1.JsonConvertible> { - const CreateManyTaskDboAndReturnOutputTypeProjectArgs({ + const CreateManyProjectTaskDboAndReturnOutputTypeProjectArgs({ this.select, this.include, }); @@ -9255,9 +9284,9 @@ class CreateManyTaskDboAndReturnOutputTypeProjectArgs }; } -class CreateManyTaskDboAndReturnOutputTypeSelect +class CreateManyProjectTaskDboAndReturnOutputTypeSelect implements _i1.JsonConvertible> { - const CreateManyTaskDboAndReturnOutputTypeSelect({ + const CreateManyProjectTaskDboAndReturnOutputTypeSelect({ this.id, this.name, this.description, @@ -9279,9 +9308,8 @@ class CreateManyTaskDboAndReturnOutputTypeSelect final bool? updatedAt; - final _i1 - .PrismaUnion? - project; + final _i1.PrismaUnion? project; @override Map toJson() => { @@ -9295,13 +9323,12 @@ class CreateManyTaskDboAndReturnOutputTypeSelect }; } -class CreateManyTaskDboAndReturnOutputTypeInclude +class CreateManyProjectTaskDboAndReturnOutputTypeInclude implements _i1.JsonConvertible> { - const CreateManyTaskDboAndReturnOutputTypeInclude({this.project}); + const CreateManyProjectTaskDboAndReturnOutputTypeInclude({this.project}); - final _i1 - .PrismaUnion? - project; + final _i1.PrismaUnion? project; @override Map toJson() => {'project': project}; @@ -9485,8 +9512,9 @@ class ProjectDboUpdateOneRequiredWithoutTasksNestedInput }; } -class TaskDboUpdateInput implements _i1.JsonConvertible> { - const TaskDboUpdateInput({ +class ProjectTaskDboUpdateInput + implements _i1.JsonConvertible> { + const ProjectTaskDboUpdateInput({ this.id, this.name, this.description, @@ -9523,9 +9551,9 @@ class TaskDboUpdateInput implements _i1.JsonConvertible> { }; } -class TaskDboUncheckedUpdateInput +class ProjectTaskDboUncheckedUpdateInput implements _i1.JsonConvertible> { - const TaskDboUncheckedUpdateInput({ + const ProjectTaskDboUncheckedUpdateInput({ this.id, this.name, this.description, @@ -9563,9 +9591,9 @@ class TaskDboUncheckedUpdateInput }; } -class TaskDboUncheckedUpdateManyInput +class ProjectTaskDboUncheckedUpdateManyInput implements _i1.JsonConvertible> { - const TaskDboUncheckedUpdateManyInput({ + const ProjectTaskDboUncheckedUpdateManyInput({ this.id, this.name, this.description, @@ -9603,8 +9631,8 @@ class TaskDboUncheckedUpdateManyInput }; } -class TaskDboCountAggregateOutputType { - const TaskDboCountAggregateOutputType({ +class ProjectTaskDboCountAggregateOutputType { + const ProjectTaskDboCountAggregateOutputType({ this.id, this.name, this.description, @@ -9614,8 +9642,8 @@ class TaskDboCountAggregateOutputType { this.$all, }); - factory TaskDboCountAggregateOutputType.fromJson(Map json) => - TaskDboCountAggregateOutputType( + factory ProjectTaskDboCountAggregateOutputType.fromJson(Map json) => + ProjectTaskDboCountAggregateOutputType( id: json['id'], name: json['name'], description: json['description'], @@ -9650,8 +9678,8 @@ class TaskDboCountAggregateOutputType { }; } -class TaskDboMinAggregateOutputType { - const TaskDboMinAggregateOutputType({ +class ProjectTaskDboMinAggregateOutputType { + const ProjectTaskDboMinAggregateOutputType({ this.id, this.name, this.description, @@ -9660,8 +9688,8 @@ class TaskDboMinAggregateOutputType { this.updatedAt, }); - factory TaskDboMinAggregateOutputType.fromJson(Map json) => - TaskDboMinAggregateOutputType( + factory ProjectTaskDboMinAggregateOutputType.fromJson(Map json) => + ProjectTaskDboMinAggregateOutputType( id: json['id'], name: json['name'], description: json['description'], @@ -9700,8 +9728,8 @@ class TaskDboMinAggregateOutputType { }; } -class TaskDboMaxAggregateOutputType { - const TaskDboMaxAggregateOutputType({ +class ProjectTaskDboMaxAggregateOutputType { + const ProjectTaskDboMaxAggregateOutputType({ this.id, this.name, this.description, @@ -9710,8 +9738,8 @@ class TaskDboMaxAggregateOutputType { this.updatedAt, }); - factory TaskDboMaxAggregateOutputType.fromJson(Map json) => - TaskDboMaxAggregateOutputType( + factory ProjectTaskDboMaxAggregateOutputType.fromJson(Map json) => + ProjectTaskDboMaxAggregateOutputType( id: json['id'], name: json['name'], description: json['description'], @@ -9750,8 +9778,8 @@ class TaskDboMaxAggregateOutputType { }; } -class TaskDboGroupByOutputType { - const TaskDboGroupByOutputType({ +class ProjectTaskDboGroupByOutputType { + const ProjectTaskDboGroupByOutputType({ this.id, this.name, this.description, @@ -9763,8 +9791,8 @@ class TaskDboGroupByOutputType { this.$max, }); - factory TaskDboGroupByOutputType.fromJson(Map json) => - TaskDboGroupByOutputType( + factory ProjectTaskDboGroupByOutputType.fromJson(Map json) => + ProjectTaskDboGroupByOutputType( id: json['id'], name: json['name'], description: json['description'], @@ -9780,13 +9808,14 @@ class TaskDboGroupByOutputType { _ => json['updatedAt'] }, $count: json['_count'] is Map - ? _i2.TaskDboCountAggregateOutputType.fromJson(json['_count']) + ? _i2.ProjectTaskDboCountAggregateOutputType.fromJson( + json['_count']) : null, $min: json['_min'] is Map - ? _i2.TaskDboMinAggregateOutputType.fromJson(json['_min']) + ? _i2.ProjectTaskDboMinAggregateOutputType.fromJson(json['_min']) : null, $max: json['_max'] is Map - ? _i2.TaskDboMaxAggregateOutputType.fromJson(json['_max']) + ? _i2.ProjectTaskDboMaxAggregateOutputType.fromJson(json['_max']) : null, ); @@ -9802,11 +9831,11 @@ class TaskDboGroupByOutputType { final DateTime? updatedAt; - final _i2.TaskDboCountAggregateOutputType? $count; + final _i2.ProjectTaskDboCountAggregateOutputType? $count; - final _i2.TaskDboMinAggregateOutputType? $min; + final _i2.ProjectTaskDboMinAggregateOutputType? $min; - final _i2.TaskDboMaxAggregateOutputType? $max; + final _i2.ProjectTaskDboMaxAggregateOutputType? $max; Map toJson() => { 'id': id, @@ -9821,9 +9850,9 @@ class TaskDboGroupByOutputType { }; } -class TaskDboCountOrderByAggregateInput +class ProjectTaskDboCountOrderByAggregateInput implements _i1.JsonConvertible> { - const TaskDboCountOrderByAggregateInput({ + const ProjectTaskDboCountOrderByAggregateInput({ this.id, this.name, this.description, @@ -9855,9 +9884,9 @@ class TaskDboCountOrderByAggregateInput }; } -class TaskDboMaxOrderByAggregateInput +class ProjectTaskDboMaxOrderByAggregateInput implements _i1.JsonConvertible> { - const TaskDboMaxOrderByAggregateInput({ + const ProjectTaskDboMaxOrderByAggregateInput({ this.id, this.name, this.description, @@ -9889,9 +9918,9 @@ class TaskDboMaxOrderByAggregateInput }; } -class TaskDboMinOrderByAggregateInput +class ProjectTaskDboMinOrderByAggregateInput implements _i1.JsonConvertible> { - const TaskDboMinOrderByAggregateInput({ + const ProjectTaskDboMinOrderByAggregateInput({ this.id, this.name, this.description, @@ -9923,9 +9952,9 @@ class TaskDboMinOrderByAggregateInput }; } -class TaskDboOrderByWithAggregationInput +class ProjectTaskDboOrderByWithAggregationInput implements _i1.JsonConvertible> { - const TaskDboOrderByWithAggregationInput({ + const ProjectTaskDboOrderByWithAggregationInput({ this.id, this.name, this.description, @@ -9949,11 +9978,11 @@ class TaskDboOrderByWithAggregationInput final _i2.SortOrder? updatedAt; - final _i2.TaskDboCountOrderByAggregateInput? $count; + final _i2.ProjectTaskDboCountOrderByAggregateInput? $count; - final _i2.TaskDboMaxOrderByAggregateInput? $max; + final _i2.ProjectTaskDboMaxOrderByAggregateInput? $max; - final _i2.TaskDboMinOrderByAggregateInput? $min; + final _i2.ProjectTaskDboMinOrderByAggregateInput? $min; @override Map toJson() => { @@ -9969,9 +9998,9 @@ class TaskDboOrderByWithAggregationInput }; } -class TaskDboScalarWhereWithAggregatesInput +class ProjectTaskDboScalarWhereWithAggregatesInput implements _i1.JsonConvertible> { - const TaskDboScalarWhereWithAggregatesInput({ + const ProjectTaskDboScalarWhereWithAggregatesInput({ this.AND, this.OR, this.NOT, @@ -9983,13 +10012,13 @@ class TaskDboScalarWhereWithAggregatesInput this.updatedAt, }); - final _i1.PrismaUnion<_i2.TaskDboScalarWhereWithAggregatesInput, - Iterable<_i2.TaskDboScalarWhereWithAggregatesInput>>? AND; + final _i1.PrismaUnion<_i2.ProjectTaskDboScalarWhereWithAggregatesInput, + Iterable<_i2.ProjectTaskDboScalarWhereWithAggregatesInput>>? AND; - final Iterable<_i2.TaskDboScalarWhereWithAggregatesInput>? OR; + final Iterable<_i2.ProjectTaskDboScalarWhereWithAggregatesInput>? OR; - final _i1.PrismaUnion<_i2.TaskDboScalarWhereWithAggregatesInput, - Iterable<_i2.TaskDboScalarWhereWithAggregatesInput>>? NOT; + final _i1.PrismaUnion<_i2.ProjectTaskDboScalarWhereWithAggregatesInput, + Iterable<_i2.ProjectTaskDboScalarWhereWithAggregatesInput>>? NOT; final _i1.PrismaUnion<_i2.StringWithAggregatesFilter, String>? id; @@ -10018,9 +10047,9 @@ class TaskDboScalarWhereWithAggregatesInput }; } -class TaskDboCountAggregateOutputTypeSelect +class ProjectTaskDboCountAggregateOutputTypeSelect implements _i1.JsonConvertible> { - const TaskDboCountAggregateOutputTypeSelect({ + const ProjectTaskDboCountAggregateOutputTypeSelect({ this.id, this.name, this.description, @@ -10056,19 +10085,19 @@ class TaskDboCountAggregateOutputTypeSelect }; } -class TaskDboGroupByOutputTypeCountArgs +class ProjectTaskDboGroupByOutputTypeCountArgs implements _i1.JsonConvertible> { - const TaskDboGroupByOutputTypeCountArgs({this.select}); + const ProjectTaskDboGroupByOutputTypeCountArgs({this.select}); - final _i2.TaskDboCountAggregateOutputTypeSelect? select; + final _i2.ProjectTaskDboCountAggregateOutputTypeSelect? select; @override Map toJson() => {'select': select}; } -class TaskDboMinAggregateOutputTypeSelect +class ProjectTaskDboMinAggregateOutputTypeSelect implements _i1.JsonConvertible> { - const TaskDboMinAggregateOutputTypeSelect({ + const ProjectTaskDboMinAggregateOutputTypeSelect({ this.id, this.name, this.description, @@ -10100,19 +10129,19 @@ class TaskDboMinAggregateOutputTypeSelect }; } -class TaskDboGroupByOutputTypeMinArgs +class ProjectTaskDboGroupByOutputTypeMinArgs implements _i1.JsonConvertible> { - const TaskDboGroupByOutputTypeMinArgs({this.select}); + const ProjectTaskDboGroupByOutputTypeMinArgs({this.select}); - final _i2.TaskDboMinAggregateOutputTypeSelect? select; + final _i2.ProjectTaskDboMinAggregateOutputTypeSelect? select; @override Map toJson() => {'select': select}; } -class TaskDboMaxAggregateOutputTypeSelect +class ProjectTaskDboMaxAggregateOutputTypeSelect implements _i1.JsonConvertible> { - const TaskDboMaxAggregateOutputTypeSelect({ + const ProjectTaskDboMaxAggregateOutputTypeSelect({ this.id, this.name, this.description, @@ -10144,19 +10173,19 @@ class TaskDboMaxAggregateOutputTypeSelect }; } -class TaskDboGroupByOutputTypeMaxArgs +class ProjectTaskDboGroupByOutputTypeMaxArgs implements _i1.JsonConvertible> { - const TaskDboGroupByOutputTypeMaxArgs({this.select}); + const ProjectTaskDboGroupByOutputTypeMaxArgs({this.select}); - final _i2.TaskDboMaxAggregateOutputTypeSelect? select; + final _i2.ProjectTaskDboMaxAggregateOutputTypeSelect? select; @override Map toJson() => {'select': select}; } -class TaskDboGroupByOutputTypeSelect +class ProjectTaskDboGroupByOutputTypeSelect implements _i1.JsonConvertible> { - const TaskDboGroupByOutputTypeSelect({ + const ProjectTaskDboGroupByOutputTypeSelect({ this.id, this.name, this.description, @@ -10180,11 +10209,12 @@ class TaskDboGroupByOutputTypeSelect final bool? updatedAt; - final _i1.PrismaUnion? $count; + final _i1.PrismaUnion? + $count; - final _i1.PrismaUnion? $min; + final _i1.PrismaUnion? $min; - final _i1.PrismaUnion? $max; + final _i1.PrismaUnion? $max; @override Map toJson() => { @@ -10200,30 +10230,31 @@ class TaskDboGroupByOutputTypeSelect }; } -class AggregateTaskDbo { - const AggregateTaskDbo({ +class AggregateProjectTaskDbo { + const AggregateProjectTaskDbo({ this.$count, this.$min, this.$max, }); - factory AggregateTaskDbo.fromJson(Map json) => AggregateTaskDbo( + factory AggregateProjectTaskDbo.fromJson(Map json) => AggregateProjectTaskDbo( $count: json['_count'] is Map - ? _i2.TaskDboCountAggregateOutputType.fromJson(json['_count']) + ? _i2.ProjectTaskDboCountAggregateOutputType.fromJson( + json['_count']) : null, $min: json['_min'] is Map - ? _i2.TaskDboMinAggregateOutputType.fromJson(json['_min']) + ? _i2.ProjectTaskDboMinAggregateOutputType.fromJson(json['_min']) : null, $max: json['_max'] is Map - ? _i2.TaskDboMaxAggregateOutputType.fromJson(json['_max']) + ? _i2.ProjectTaskDboMaxAggregateOutputType.fromJson(json['_max']) : null, ); - final _i2.TaskDboCountAggregateOutputType? $count; + final _i2.ProjectTaskDboCountAggregateOutputType? $count; - final _i2.TaskDboMinAggregateOutputType? $min; + final _i2.ProjectTaskDboMinAggregateOutputType? $min; - final _i2.TaskDboMaxAggregateOutputType? $max; + final _i2.ProjectTaskDboMaxAggregateOutputType? $max; Map toJson() => { '_count': $count?.toJson(), @@ -10232,49 +10263,49 @@ class AggregateTaskDbo { }; } -class AggregateTaskDboCountArgs +class AggregateProjectTaskDboCountArgs implements _i1.JsonConvertible> { - const AggregateTaskDboCountArgs({this.select}); + const AggregateProjectTaskDboCountArgs({this.select}); - final _i2.TaskDboCountAggregateOutputTypeSelect? select; + final _i2.ProjectTaskDboCountAggregateOutputTypeSelect? select; @override Map toJson() => {'select': select}; } -class AggregateTaskDboMinArgs +class AggregateProjectTaskDboMinArgs implements _i1.JsonConvertible> { - const AggregateTaskDboMinArgs({this.select}); + const AggregateProjectTaskDboMinArgs({this.select}); - final _i2.TaskDboMinAggregateOutputTypeSelect? select; + final _i2.ProjectTaskDboMinAggregateOutputTypeSelect? select; @override Map toJson() => {'select': select}; } -class AggregateTaskDboMaxArgs +class AggregateProjectTaskDboMaxArgs implements _i1.JsonConvertible> { - const AggregateTaskDboMaxArgs({this.select}); + const AggregateProjectTaskDboMaxArgs({this.select}); - final _i2.TaskDboMaxAggregateOutputTypeSelect? select; + final _i2.ProjectTaskDboMaxAggregateOutputTypeSelect? select; @override Map toJson() => {'select': select}; } -class AggregateTaskDboSelect +class AggregateProjectTaskDboSelect implements _i1.JsonConvertible> { - const AggregateTaskDboSelect({ + const AggregateProjectTaskDboSelect({ this.$count, this.$min, this.$max, }); - final _i1.PrismaUnion? $count; + final _i1.PrismaUnion? $count; - final _i1.PrismaUnion? $min; + final _i1.PrismaUnion? $min; - final _i1.PrismaUnion? $max; + final _i1.PrismaUnion? $max; @override Map toJson() => { diff --git a/backend-dart/lib/infrastructure/persistence/mapper/project_dbo_mapper.dart b/backend-dart/lib/infrastructure/persistence/mapper/project_dbo_mapper.dart index e6691e8..ff1cae1 100644 --- a/backend-dart/lib/infrastructure/persistence/mapper/project_dbo_mapper.dart +++ b/backend-dart/lib/infrastructure/persistence/mapper/project_dbo_mapper.dart @@ -7,18 +7,6 @@ import 'package:fpdart/fpdart.dart'; import 'package:orm/orm.dart'; class ProjectDboMapper { - TaskEither toDbo(Project project) { - return TaskEither.of(ProjectDbo( - id: project.id, - name: project.name, - description: project.description, - clientId: project.clientId, - userId: project.userId, - createdAt: project.createdAt, - updatedAt: project.updatedAt, - )); - } - TaskEither fromDbo(ProjectDbo dbo) { return TaskEither.of(Project( id: dbo.id!, @@ -31,9 +19,14 @@ class ProjectDboMapper { )); } + TaskEither> listFrom(Iterable dbos) { + return TaskEither.traverseList(dbos.toList(), fromDbo); + } + TaskEither fromCreatetoDbo( ProjectCreate project) { return TaskEither.of(ProjectDboCreateInput( + id: project.id, name: project.name, description: project.description.let(PrismaUnion.$1), clientId: project.clientId.let(PrismaUnion.$1), @@ -57,8 +50,4 @@ class ProjectDboMapper { ), )); } - - TaskEither> listFrom(Iterable dbos) { - return TaskEither.traverseList(dbos.toList(), fromDbo); - } } diff --git a/backend-dart/lib/infrastructure/persistence/mapper/project_task_dbo_mapper.dart b/backend-dart/lib/infrastructure/persistence/mapper/project_task_dbo_mapper.dart new file mode 100644 index 0000000..3425def --- /dev/null +++ b/backend-dart/lib/infrastructure/persistence/mapper/project_task_dbo_mapper.dart @@ -0,0 +1,52 @@ +import 'package:backend_dart/common/extensions.dart'; +import 'package:backend_dart/domain/entities/project_task.dart'; +import 'package:backend_dart/domain/interface/error.dart'; +import 'package:backend_dart/infrastructure/persistence/db/model.dart'; +import 'package:backend_dart/infrastructure/persistence/db/prisma.dart'; +import 'package:fpdart/fpdart.dart'; +import 'package:orm/orm.dart'; + +class ProjectTaskDboMapper { + TaskEither from(ProjectTaskDbo target) => + TaskEither.of(ProjectTask( + id: target.id!, + name: target.name!, + description: target.description, + projectId: target.projectId!, + createdAt: target.createdAt!, + updatedAt: target.updatedAt!, + )); + + TaskEither> listFrom( + Iterable targets) { + return TaskEither.traverseList(targets.toList(), from); + } + + TaskEither fromCreateTo( + ProjectTaskCreate origin) => + TaskEither.of(ProjectTaskDboCreateInput( + id: origin.id, + name: origin.name, + description: origin.description.let(PrismaUnion.$1), + project: ProjectDboCreateNestedOneWithoutTasksInput( + connect: ProjectDboWhereUniqueInput( + id: origin.projectId, + ), + ), + )); + + TaskEither fromUpdateTo( + ProjectTaskUpdate origin) => + TaskEither.of(ProjectTaskDboUpdateInput( + id: PrismaUnion.$1(origin.id), + name: origin.name?.let(PrismaUnion.$1), + description: origin.description?.let(PrismaUnion.$1), + project: origin.projectId?.let( + (projectId) => ProjectDboUpdateOneRequiredWithoutTasksNestedInput( + connect: ProjectDboWhereUniqueInput( + id: projectId, + ), + ), + ), + )); +} diff --git a/backend-dart/lib/infrastructure/persistence/mapper/time_entry_dbo_mapper.dart b/backend-dart/lib/infrastructure/persistence/mapper/time_entry_dbo_mapper.dart new file mode 100644 index 0000000..5c4f5fb --- /dev/null +++ b/backend-dart/lib/infrastructure/persistence/mapper/time_entry_dbo_mapper.dart @@ -0,0 +1,69 @@ +import 'package:backend_dart/common/extensions.dart'; +import 'package:backend_dart/domain/entities/time_entry.dart'; +import 'package:backend_dart/domain/interface/error.dart'; +import 'package:backend_dart/infrastructure/persistence/db/model.dart'; +import 'package:backend_dart/infrastructure/persistence/db/prisma.dart'; +import 'package:fpdart/fpdart.dart'; +import 'package:orm/orm.dart'; + +class TimeEntryDboMapper { + TaskEither from(TimeEntryDbo target) => TaskEither.of( + TimeEntry( + id: target.id!, + startTime: target.startTime!, + endTime: target.endTime!, + description: target.description, + userId: target.userId!, + projectId: target.projectId!, + createdAt: target.createdAt!, + updatedAt: target.updatedAt!, + ), + ); + + TaskEither> listFrom(Iterable targets) { + return TaskEither.traverseList(targets.toList(), from); + } + + TaskEither fromCreateTo( + TimeEntryCreate origin) => + TaskEither.of(TimeEntryDboCreateInput( + id: origin.id, + startTime: origin.startTime, + endTime: origin.endTime, + description: origin.description.let(PrismaUnion.$1), + user: UserDboCreateNestedOneWithoutTimeEntriesInput( + connect: UserDboWhereUniqueInput( + id: origin.userId, + ), + ), + project: ProjectDboCreateNestedOneWithoutTimeEntriesInput( + connect: ProjectDboWhereUniqueInput( + id: origin.projectId, + ), + ), + )); + + TaskEither fromUpdateTo( + TimeEntryUpdate origin) => + TaskEither.of(TimeEntryDboUpdateInput( + id: PrismaUnion.$1(origin.id), + startTime: origin.startTime?.let(PrismaUnion.$1), + endTime: origin.endTime?.let(PrismaUnion.$1), + description: origin.description?.let(PrismaUnion.$1), + user: origin.userId?.let( + (userId) => UserDboUpdateOneRequiredWithoutTimeEntriesNestedInput( + connect: UserDboWhereUniqueInput( + id: userId, + ), + ), + ), + project: origin.projectId?.let( + (projectId) => + ProjectDboUpdateOneRequiredWithoutTimeEntriesNestedInput( + connect: ProjectDboWhereUniqueInput( + id: projectId, + ), + ), + ), + )); +} diff --git a/backend-dart/lib/infrastructure/persistence/prisma_database.dart b/backend-dart/lib/infrastructure/persistence/prisma_database.dart index 5626f86..09913ae 100644 --- a/backend-dart/lib/infrastructure/persistence/prisma_database.dart +++ b/backend-dart/lib/infrastructure/persistence/prisma_database.dart @@ -1,18 +1,37 @@ import 'package:backend_dart/domain/data/database.dart'; +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/infrastructure/persistence/db/client.dart'; +import 'package:backend_dart/infrastructure/persistence/prisma_project_data_source.dart'; +import 'package:backend_dart/infrastructure/persistence/prisma_project_task_data_source.dart'; +import 'package:backend_dart/infrastructure/persistence/prisma_time_entry_data_source.dart'; import 'package:backend_dart/infrastructure/persistence/prisma_user_data_source.dart'; class PrismaDatabase implements IDatabase { final prisma = PrismaClient(); late final PrismaUserDataSource _users; + late final TimeEntryDataSource _timeEntries; + late final ProjectTaskDataSource _tasks; + late final ProjectDataSource _projects; + PrismaDatabase() { _users = PrismaUserDataSource(prisma); + _timeEntries = PrismaTimeEntryDataSource(prisma); + _tasks = PrismaProjectTaskDataSource(prisma); + _projects = PrismaProjectDataSource(prisma); print('Database initialized'); } @override get users => _users; @override + get timeEntries => _timeEntries; + @override + get tasks => _tasks; + @override + get projects => _projects; + @override Future close() { return Future.value(); } diff --git a/backend-dart/lib/infrastructure/persistence/prisma_project_data_source.dart b/backend-dart/lib/infrastructure/persistence/prisma_project_data_source.dart index 7130b5d..4028152 100644 --- a/backend-dart/lib/infrastructure/persistence/prisma_project_data_source.dart +++ b/backend-dart/lib/infrastructure/persistence/prisma_project_data_source.dart @@ -9,6 +9,7 @@ import 'package:backend_dart/infrastructure/persistence/db/prisma.dart'; import 'package:backend_dart/infrastructure/persistence/mapper/project_dbo_mapper.dart'; import 'package:fpdart/fpdart.dart'; import 'package:orm/orm.dart'; +import 'package:uuid/uuid.dart'; class PrismaProjectDataSource implements ProjectDataSource { final PrismaClient prisma; @@ -17,7 +18,7 @@ class PrismaProjectDataSource implements ProjectDataSource { PrismaProjectDataSource(this.prisma); @override - TaskEither createProject(ProjectCreate project) { + TaskEither create(ProjectCreate project) { return mapper .fromCreatetoDbo(project) .flatMap((projectDbo) => TaskEither.tryCatch( @@ -34,7 +35,7 @@ class PrismaProjectDataSource implements ProjectDataSource { } @override - TaskEither findProjectById(String id) { + TaskEither findById(String id) { return TaskEither.tryCatch( () async { final project = await prisma.projectDbo @@ -51,7 +52,7 @@ class PrismaProjectDataSource implements ProjectDataSource { } @override - TaskEither> findProjectsByUserId(String userId) { + TaskEither> findByUserId(String userId) { return TaskEither>.tryCatch( () async { final projects = await prisma.projectDbo.findMany( @@ -69,7 +70,7 @@ class PrismaProjectDataSource implements ProjectDataSource { } @override - TaskEither updateProject(ProjectUpdate project) { + TaskEither update(ProjectUpdate project) { return mapper .fromUpdateToDbo(project) .flatMap( @@ -96,7 +97,7 @@ class PrismaProjectDataSource implements ProjectDataSource { } @override - TaskEither deleteProject(String id) { + TaskEither delete(String id) { return TaskEither.tryCatch( () async { return await prisma.projectDbo @@ -117,7 +118,7 @@ class PrismaProjectDataSource implements ProjectDataSource { } @override - TaskEither> findAllProjects() { + TaskEither> findAll() { return TaskEither>.tryCatch( () async => await prisma.projectDbo.findMany(), (error, _) => AppError.databaseError( @@ -125,4 +126,23 @@ class PrismaProjectDataSource implements ProjectDataSource { ), ).flatMap(mapper.listFrom); } + + @override + TaskEither generateId() { + return TaskEither.tryCatch( + () async { + var uuid = Uuid(); + do { + final id = uuid.v4(); + final project = await prisma.projectDbo.findUnique( + where: ProjectDboWhereUniqueInput(id: id), + ); + if (project == null) return id; + } while (true); + }, + (error, _) => AppError.databaseError( + message: 'Failed to generate ID: ${error.toString()}', + ), + ); + } } diff --git a/backend-dart/lib/infrastructure/persistence/prisma_project_task_data_source.dart b/backend-dart/lib/infrastructure/persistence/prisma_project_task_data_source.dart new file mode 100644 index 0000000..d33633c --- /dev/null +++ b/backend-dart/lib/infrastructure/persistence/prisma_project_task_data_source.dart @@ -0,0 +1,139 @@ +import 'package:backend_dart/common/error_on_null.dart'; +import 'package:backend_dart/domain/data/project_task_data_source.dart'; +import 'package:backend_dart/domain/entities/project_task.dart'; +import 'package:backend_dart/domain/errors/app_error.dart'; +import 'package:backend_dart/domain/interface/error.dart'; +import 'package:backend_dart/infrastructure/persistence/db/client.dart'; +import 'package:backend_dart/infrastructure/persistence/db/model.dart'; +import 'package:backend_dart/infrastructure/persistence/db/prisma.dart'; +import 'package:backend_dart/infrastructure/persistence/mapper/project_task_dbo_mapper.dart'; +import 'package:fpdart/fpdart.dart'; +import 'package:orm/orm.dart'; +import 'package:uuid/uuid.dart'; + +class PrismaProjectTaskDataSource implements ProjectTaskDataSource { + final PrismaClient prisma; + final ProjectTaskDboMapper mapper = ProjectTaskDboMapper(); + + PrismaProjectTaskDataSource(this.prisma); + + @override + TaskEither create(ProjectTaskCreate task) => + mapper.fromCreateTo(task).flatMap( + (taskDbo) => TaskEither.tryCatch( + () async { + final createdTask = await prisma.projectTaskDbo.create( + data: PrismaUnion.$1(taskDbo), + ); + return createdTask; + }, + (error, _) => AppError.databaseError( + message: 'Failed to create project task: ${error.toString()}', + ), + ).flatMap(mapper.from), + ); + + @override + TaskEither findById(String id) { + return TaskEither.tryCatch( + () async { + final task = await prisma.projectTaskDbo + .findUnique(where: ProjectTaskDboWhereUniqueInput(id: id)); + return task; + }, + (error, _) => AppError.databaseError( + message: 'Failed to find project task by ID: ${error.toString()}', + ), + ) + .flatMap(errorOnNull(AppError.notFound( + "Project task with id $id not found", + ))) + .flatMap(mapper.from); + } + + @override + TaskEither> findByProjectId(String projectId) { + return TaskEither>.tryCatch( + () async => await prisma.projectTaskDbo.findMany( + where: ProjectTaskDboWhereInput(projectId: PrismaUnion.$2(projectId)), + ), + (error, _) => AppError.databaseError( + message: + 'Failed to fetch tasks for project $projectId: ${error.toString()}', + ), + ).flatMap(mapper.listFrom); + } + + @override + TaskEither update(ProjectTaskUpdate task) => mapper + .fromUpdateTo(task) + .flatMap( + (taskDbo) => TaskEither.tryCatch( + () async { + final updatedTask = await prisma.projectTaskDbo.update( + data: PrismaUnion.$1(taskDbo), + where: ProjectTaskDboWhereUniqueInput(id: task.id), + ); + return updatedTask; + }, + (error, _) => AppError.databaseError( + message: 'Failed to update project task: ${error.toString()}', + ), + ), + ) + .flatMap( + errorOnNull(AppError.notFound("Project task not found")), + ) + .flatMap(mapper.from); + + @override + TaskEither delete(String id) { + return TaskEither.tryCatch( + () async { + return await prisma.projectTaskDbo.delete( + where: ProjectTaskDboWhereUniqueInput(id: id), + ); + }, + (error, _) => AppError.databaseError( + message: 'Failed to delete project task: ${error.toString()}', + ), + ) + .flatMap( + errorOnNull( + AppError.notFound( + 'Project task with ID $id not found', + ), + ), + ) + .flatMap(mapper.from); + } + + @override + TaskEither> findAll() { + return TaskEither>.tryCatch( + () async => await prisma.projectTaskDbo.findMany(), + (error, _) => AppError.databaseError( + message: 'Failed to fetch all project tasks: ${error.toString()}', + ), + ).flatMap(mapper.listFrom); + } + + @override + TaskEither generateId() { + return TaskEither.tryCatch( + () async { + var uuid = Uuid(); + do { + final id = uuid.v4(); + final task = await prisma.projectTaskDbo.findUnique( + where: ProjectTaskDboWhereUniqueInput(id: id), + ); + if (task == null) return id; + } while (true); + }, + (error, _) => AppError.databaseError( + message: 'Failed to generate ID: ${error.toString()}', + ), + ); + } +} diff --git a/backend-dart/lib/infrastructure/persistence/prisma_time_entry_data_source.dart b/backend-dart/lib/infrastructure/persistence/prisma_time_entry_data_source.dart new file mode 100644 index 0000000..cece960 --- /dev/null +++ b/backend-dart/lib/infrastructure/persistence/prisma_time_entry_data_source.dart @@ -0,0 +1,150 @@ +import 'package:backend_dart/common/error_on_null.dart'; +import 'package:backend_dart/domain/data/time_entry_data_source.dart'; +import 'package:backend_dart/domain/entities/time_entry.dart'; +import 'package:backend_dart/domain/errors/app_error.dart'; +import 'package:backend_dart/domain/interface/error.dart'; +import 'package:backend_dart/infrastructure/persistence/db/client.dart'; +import 'package:backend_dart/infrastructure/persistence/db/model.dart'; +import 'package:backend_dart/infrastructure/persistence/db/prisma.dart'; +import 'package:backend_dart/infrastructure/persistence/mapper/time_entry_dbo_mapper.dart'; +import 'package:fpdart/fpdart.dart'; +import 'package:orm/orm.dart'; +import 'package:uuid/uuid.dart'; + +class PrismaTimeEntryDataSource implements TimeEntryDataSource { + final PrismaClient prisma; + final TimeEntryDboMapper mapper = TimeEntryDboMapper(); + + PrismaTimeEntryDataSource(this.prisma); + + @override + TaskEither create(TimeEntryCreate timeEntry) => + mapper.fromCreateTo(timeEntry).flatMap( + (timeEntryDbo) => TaskEither.tryCatch( + () async { + final createdEntry = await prisma.timeEntryDbo.create( + data: PrismaUnion.$1(timeEntryDbo), + ); + return createdEntry; + }, + (error, _) => AppError.databaseError( + message: 'Failed to create time entry: ${error.toString()}', + ), + ).flatMap(mapper.from), + ); + + @override + TaskEither findById(String id) { + return TaskEither.tryCatch( + () async { + final timeEntry = await prisma.timeEntryDbo + .findUnique(where: TimeEntryDboWhereUniqueInput(id: id)); + return timeEntry; + }, + (error, _) => AppError.databaseError( + message: 'Failed to find time entry by ID: ${error.toString()}', + ), + ) + .flatMap(errorOnNull(AppError.notFound( + "Time entry with id $id not found", + ))) + .flatMap(mapper.from); + } + + @override + TaskEither> findByUserId(String userId) { + return TaskEither>.tryCatch( + () async => await prisma.timeEntryDbo.findMany( + where: TimeEntryDboWhereInput(userId: PrismaUnion.$2(userId)), + ), + (error, _) => AppError.databaseError( + message: + 'Failed to fetch time entries for user $userId: ${error.toString()}', + ), + ).flatMap(mapper.listFrom); + } + + @override + TaskEither> findByProjectId(String projectId) { + return TaskEither>.tryCatch( + () async => await prisma.timeEntryDbo.findMany( + where: TimeEntryDboWhereInput(projectId: PrismaUnion.$2(projectId)), + ), + (error, _) => AppError.databaseError( + message: + 'Failed to fetch time entries for project $projectId: ${error.toString()}', + ), + ).flatMap(mapper.listFrom); + } + + @override + TaskEither update(TimeEntryUpdate timeEntry) => mapper + .fromUpdateTo(timeEntry) + .flatMap( + (timeEntryDbo) => TaskEither.tryCatch( + () async { + final updatedEntry = await prisma.timeEntryDbo.update( + data: PrismaUnion.$1(timeEntryDbo), + where: TimeEntryDboWhereUniqueInput(id: timeEntry.id), + ); + return updatedEntry; + }, + (error, _) => AppError.databaseError( + message: 'Failed to update time entry: ${error.toString()}', + ), + ), + ) + .flatMap( + errorOnNull(AppError.notFound("Time entry not found")), + ) + .flatMap(mapper.from); + + @override + TaskEither delete(String id) { + return TaskEither.tryCatch( + () async { + return await prisma.timeEntryDbo.delete( + where: TimeEntryDboWhereUniqueInput(id: id), + ); + }, + (error, _) => AppError.databaseError( + message: 'Failed to delete time entry: ${error.toString()}', + ), + ) + .flatMap( + errorOnNull(AppError.notFound( + "Time entry with id $id not found", + )), + ) + .flatMap(mapper.from); + } + + @override + TaskEither> findAll() { + return TaskEither>.tryCatch( + () async => await prisma.timeEntryDbo.findMany(), + (error, _) => AppError.databaseError( + message: 'Failed to fetch all time entries: ${error.toString()}', + ), + ).flatMap(mapper.listFrom); + } + + @override + TaskEither generateId() { + return TaskEither.tryCatch( + () async { + var uuid = Uuid(); + do { + final id = uuid.v4(); + final entry = await prisma.timeEntryDbo.findUnique( + where: TimeEntryDboWhereUniqueInput(id: id), + ); + if (entry == null) return id; + } while (true); + }, + (error, _) => AppError.databaseError( + message: 'Failed to generate ID: ${error.toString()}', + ), + ); + } +} diff --git a/backend-dart/lib/interfaces/http/router.dart b/backend-dart/lib/interfaces/http/router.dart index 20f4f53..fe68920 100644 --- a/backend-dart/lib/interfaces/http/router.dart +++ b/backend-dart/lib/interfaces/http/router.dart @@ -1,4 +1,4 @@ -import 'package:backend_dart/application/service/user_service_provider.dart'; +import 'package:backend_dart/application/service/service_provider.dart'; import 'package:riverpod/riverpod.dart'; import 'package:shelf/shelf.dart'; import 'package:shelf_router/shelf_router.dart'; @@ -17,9 +17,15 @@ Router getRouter(ProviderContainer container) { // Services final userService = container.read(userServiceProvider); + final projectService = container.read(projectServiceProvider); + final projectTaskService = container.read(projectTaskServiceProvider); + final timeEntryService = container.read(timeEntryServiceProvider); // UserService-Router router.mount('/users/', userService.router.call); + router.mount('/projects/', projectService.router.call); + router.mount('/project-tasks/', projectTaskService.router.call); + router.mount('/time-entries/', timeEntryService.router.call); return router; } diff --git a/backend-dart/prisma/schema.prisma b/backend-dart/prisma/schema.prisma index 3636fdd..6f3b137 100755 --- a/backend-dart/prisma/schema.prisma +++ b/backend-dart/prisma/schema.prisma @@ -26,7 +26,7 @@ model ProjectDbo { name String description String? clientId String? - tasks TaskDbo[] // Beziehung zu Aufgaben + tasks ProjectTaskDbo[] // Beziehung zu Aufgaben timeEntries TimeEntryDbo[] // Beziehung zu Zeiteinträgen user UserDbo @relation(fields: [userId], references: [id]) userId String @@ -49,7 +49,7 @@ model TimeEntryDbo { } // Task Model (optional) -model TaskDbo { +model ProjectTaskDbo { id String @id @default(uuid()) name String description String?