implemented other repos, services, objects ...

This commit is contained in:
Jean Jacques Avril 2025-01-01 21:36:20 +00:00
parent 6d980a980e
commit 10c72f22c5
No known key found for this signature in database
51 changed files with 5940 additions and 502 deletions

View File

@ -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<IError, Project> create(ProjectCreate project) {
return database.projects
.generateId()
.map((id) => project.copyWith(id: id))
.flatMap(database.projects.create);
}
@override
TaskEither<IError, Project> findById(String id) {
return database.projects.findById(id);
}
@override
TaskEither<IError, Project> update(ProjectUpdate project) {
return database.projects.update(project);
}
@override
TaskEither<IError, void> delete(String id) {
return database.projects.delete(id);
}
@override
TaskEither<IError, List<Project>> findAll() {
return database.projects.findAll();
}
}

View File

@ -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<IError, ProjectTask> create(ProjectTaskCreate task) {
return database.tasks
.generateId()
.map((id) => task.copyWith(id: id))
.flatMap(database.tasks.create);
}
@override
TaskEither<IError, ProjectTask> findById(String id) {
return database.tasks.findById(id);
}
@override
TaskEither<IError, List<ProjectTask>> findByProjectId(String projectId) {
return database.tasks.findByProjectId(projectId);
}
@override
TaskEither<IError, ProjectTask> update(ProjectTaskUpdate task) {
return database.tasks.update(task);
}
@override
TaskEither<IError, void> delete(String id) {
return database.tasks.delete(id);
}
@override
TaskEither<IError, List<ProjectTask>> findAll() {
return database.tasks.findAll();
}
}

View File

@ -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/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/domain/repository/user_repository.dart';
import 'package:backend_dart/infrastructure/persistence/database_provider.dart'; import 'package:backend_dart/infrastructure/persistence/database_provider.dart';
import 'package:riverpod/riverpod.dart'; import 'package:riverpod/riverpod.dart';
@ -7,3 +13,18 @@ final userRepoProvider = Provider<UserRepository>((ref) {
final database = ref.read(databaseProvider); final database = ref.read(databaseProvider);
return UserRepositoryImpl(database); return UserRepositoryImpl(database);
}); });
final projectTaskProvider = Provider<ProjectTaskRepository>((ref) {
final database = ref.read(databaseProvider);
return ProjectTaskRepositoryImpl(database);
});
final projectProvider = Provider<ProjectRepository>((ref) {
final database = ref.read(databaseProvider);
return ProjectRepositoryImpl(database);
});
final timeEntryProvider = Provider<TimeEntryRepository>((ref) {
final database = ref.read(databaseProvider);
return TimeEntryRepositoryImpl(database);
});

View File

@ -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<IError, TimeEntry> create(TimeEntryCreate timeEntry) {
return database.timeEntries
.generateId()
.map((id) => timeEntry.copyWith(id: id))
.flatMap(database.timeEntries.create);
}
@override
TaskEither<IError, TimeEntry> findById(String id) {
return database.timeEntries.findById(id);
}
@override
TaskEither<IError, List<TimeEntry>> findByUserId(String userId) {
return database.timeEntries.findByUserId(userId);
}
@override
TaskEither<IError, List<TimeEntry>> findByProjectId(String projectId) {
return database.timeEntries.findByProjectId(projectId);
}
@override
TaskEither<IError, TimeEntry> update(TimeEntryUpdate timeEntry) {
return database.timeEntries.update(timeEntry);
}
@override
TaskEither<IError, void> delete(String id) {
return database.timeEntries.delete(id);
}
@override
TaskEither<IError, List<TimeEntry>> findAll() {
return database.timeEntries.findAll();
}
}

View File

@ -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<String, dynamic> 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<String, dynamic> 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<String, dynamic> json) =>
_$ProjectUpdateDtoFromJson(json);
}

View File

@ -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>(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<String, dynamic> 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<String, dynamic> 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<ProjectDto> 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<String, dynamic> 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<String, dynamic> 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<String, dynamic> 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<String, dynamic> 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<String, dynamic> 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<ProjectCreateDto> 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<String, dynamic> 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<String, dynamic> 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<String, dynamic> 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<String, dynamic> 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<String, dynamic> 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<ProjectUpdateDto> 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<String, dynamic> 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<String, dynamic> 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<String, dynamic> 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;
}

View File

@ -0,0 +1,67 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'project_dto.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$ProjectDtoImpl _$$ProjectDtoImplFromJson(Map<String, dynamic> 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<String, dynamic> _$$ProjectDtoImplToJson(_$ProjectDtoImpl instance) =>
<String, dynamic>{
'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<String, dynamic> json) =>
_$ProjectCreateDtoImpl(
name: json['name'] as String,
description: json['description'] as String?,
clientId: json['clientId'] as String?,
userId: json['userId'] as String,
);
Map<String, dynamic> _$$ProjectCreateDtoImplToJson(
_$ProjectCreateDtoImpl instance) =>
<String, dynamic>{
'name': instance.name,
'description': instance.description,
'clientId': instance.clientId,
'userId': instance.userId,
};
_$ProjectUpdateDtoImpl _$$ProjectUpdateDtoImplFromJson(
Map<String, dynamic> 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<String, dynamic> _$$ProjectUpdateDtoImplToJson(
_$ProjectUpdateDtoImpl instance) =>
<String, dynamic>{
'id': instance.id,
'name': instance.name,
'description': instance.description,
'clientId': instance.clientId,
'userId': instance.userId,
};

View File

@ -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<String, dynamic> 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<String, dynamic> json) =>
_$ProjectTaskCreateDtoFromJson(json);
}
@freezed
class ProjectTaskUpdateDto with _$ProjectTaskUpdateDto {
const factory ProjectTaskUpdateDto({
String? name,
String? description,
String? projectId,
}) = _ProjectTaskUpdateDto;
/// JSON-Serialisierung
factory ProjectTaskUpdateDto.fromJson(Map<String, dynamic> json) =>
_$ProjectTaskUpdateDtoFromJson(json);
}

View File

@ -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>(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<String, dynamic> 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<String, dynamic> 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<ProjectTaskDto> 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<String, dynamic> 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<String, dynamic> 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<String, dynamic> 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<String, dynamic> 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<String, dynamic> 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<ProjectTaskCreateDto> 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<String, dynamic> 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<String, dynamic> 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<String, dynamic> 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<String, dynamic> 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<String, dynamic> 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<ProjectTaskUpdateDto> 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<String, dynamic> 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<String, dynamic> 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<String, dynamic> 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;
}

View File

@ -0,0 +1,60 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'project_task_dto.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$ProjectTaskDtoImpl _$$ProjectTaskDtoImplFromJson(Map<String, dynamic> 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<String, dynamic> _$$ProjectTaskDtoImplToJson(
_$ProjectTaskDtoImpl instance) =>
<String, dynamic>{
'id': instance.id,
'name': instance.name,
'description': instance.description,
'projectId': instance.projectId,
'createdAt': instance.createdAt.toIso8601String(),
'updatedAt': instance.updatedAt.toIso8601String(),
};
_$ProjectTaskCreateDtoImpl _$$ProjectTaskCreateDtoImplFromJson(
Map<String, dynamic> json) =>
_$ProjectTaskCreateDtoImpl(
name: json['name'] as String,
description: json['description'] as String?,
projectId: json['projectId'] as String,
);
Map<String, dynamic> _$$ProjectTaskCreateDtoImplToJson(
_$ProjectTaskCreateDtoImpl instance) =>
<String, dynamic>{
'name': instance.name,
'description': instance.description,
'projectId': instance.projectId,
};
_$ProjectTaskUpdateDtoImpl _$$ProjectTaskUpdateDtoImplFromJson(
Map<String, dynamic> json) =>
_$ProjectTaskUpdateDtoImpl(
name: json['name'] as String?,
description: json['description'] as String?,
projectId: json['projectId'] as String?,
);
Map<String, dynamic> _$$ProjectTaskUpdateDtoImplToJson(
_$ProjectTaskUpdateDtoImpl instance) =>
<String, dynamic>{
'name': instance.name,
'description': instance.description,
'projectId': instance.projectId,
};

View File

@ -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<String, dynamic> 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<String, dynamic> 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<String, dynamic> json) =>
_$TimeEntryUpdateDtoFromJson(json);
}

View File

@ -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>(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<String, dynamic> 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<String, dynamic> 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<TimeEntryDto> 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<String, dynamic> 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<String, dynamic> 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<String, dynamic> 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<String, dynamic> 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<String, dynamic> 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<TimeEntryCreateDto> 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<String, dynamic> 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<String, dynamic> 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<String, dynamic> 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<String, dynamic> 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<String, dynamic> 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<TimeEntryUpdateDto> 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<String, dynamic> 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<String, dynamic> 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<String, dynamic> 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;
}

View File

@ -0,0 +1,75 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'time_entry_dto.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$TimeEntryDtoImpl _$$TimeEntryDtoImplFromJson(Map<String, dynamic> 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<String, dynamic> _$$TimeEntryDtoImplToJson(_$TimeEntryDtoImpl instance) =>
<String, dynamic>{
'id': instance.id,
'startTime': instance.startTime.toIso8601String(),
'endTime': instance.endTime.toIso8601String(),
'description': instance.description,
'userId': instance.userId,
'projectId': instance.projectId,
'createdAt': instance.createdAt.toIso8601String(),
'updatedAt': instance.updatedAt.toIso8601String(),
};
_$TimeEntryCreateDtoImpl _$$TimeEntryCreateDtoImplFromJson(
Map<String, dynamic> 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<String, dynamic> _$$TimeEntryCreateDtoImplToJson(
_$TimeEntryCreateDtoImpl instance) =>
<String, dynamic>{
'startTime': instance.startTime.toIso8601String(),
'endTime': instance.endTime.toIso8601String(),
'description': instance.description,
'userId': instance.userId,
'projectId': instance.projectId,
};
_$TimeEntryUpdateDtoImpl _$$TimeEntryUpdateDtoImplFromJson(
Map<String, dynamic> 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<String, dynamic> _$$TimeEntryUpdateDtoImplToJson(
_$TimeEntryUpdateDtoImpl instance) =>
<String, dynamic>{
'startTime': instance.startTime?.toIso8601String(),
'endTime': instance.endTime?.toIso8601String(),
'description': instance.description,
'userId': instance.userId,
'projectId': instance.projectId,
};

View File

@ -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<IError, ProjectDto> 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<IError, List<ProjectDto>> listTo(Iterable<Project> origins) {
return TaskEither.traverseList(origins.toList(), to);
}
TaskEither<IError, ProjectCreate> fromCreateTo(ProjectCreateDto origin) =>
TaskEither.of(ProjectCreate(
name: origin.name,
description: origin.description,
clientId: origin.clientId,
userId: origin.userId,
));
TaskEither<IError, ProjectUpdate> fromUpdateTo(
ProjectUpdateDto origin, String id) =>
TaskEither.of(ProjectUpdate(
id: id,
name: origin.name,
description: origin.description,
clientId: origin.clientId,
userId: origin.userId,
));
}

View File

@ -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<IError, ProjectTaskDto> 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<IError, List<ProjectTaskDto>> listTo(
Iterable<ProjectTask> origins) {
return TaskEither.traverseList(origins.toList(), to);
}
TaskEither<IError, ProjectTaskCreate> fromCreateTo(
ProjectTaskCreateDto origin) =>
TaskEither.of(ProjectTaskCreate(
name: origin.name,
description: origin.description,
projectId: origin.projectId,
));
TaskEither<IError, ProjectTaskUpdate> fromUpdateTo(
ProjectTaskUpdateDto origin, String id) =>
TaskEither.of(ProjectTaskUpdate(
id: id,
name: origin.name,
description: origin.description,
projectId: origin.projectId,
));
}

View File

@ -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<IError, TimeEntryDto> 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<IError, List<TimeEntryDto>> listTo(Iterable<TimeEntry> origins) {
return TaskEither.traverseList(origins.toList(), to);
}
TaskEither<IError, TimeEntryCreate> fromCreateTo(TimeEntryCreateDto origin) =>
TaskEither.of(TimeEntryCreate(
startTime: origin.startTime,
endTime: origin.endTime,
description: origin.description,
userId: origin.userId,
projectId: origin.projectId,
));
TaskEither<IError, TimeEntryUpdate> 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,
));
}

View File

@ -1,11 +1,9 @@
import 'package:backend_dart/application/service/dto/user_dto.dart'; import 'package:backend_dart/application/service/dto/user_dto.dart';
import 'package:backend_dart/domain/entities/user.dart'; import 'package:backend_dart/domain/entities/user.dart';
import 'package:backend_dart/domain/interface/error.dart'; import 'package:backend_dart/domain/interface/error.dart';
import 'package:backend_dart/domain/interface/mapper.dart';
import 'package:fpdart/fpdart.dart'; import 'package:fpdart/fpdart.dart';
class UserDtoMapper implements IMapper<User, UserDto> { class UserDtoMapper {
@override
TaskEither<IError, UserDto> to(User entity) => TaskEither.of(UserDto( TaskEither<IError, UserDto> to(User entity) => TaskEither.of(UserDto(
id: entity.id, id: entity.id,
name: entity.name, name: entity.name,
@ -13,21 +11,7 @@ class UserDtoMapper implements IMapper<User, UserDto> {
createdAt: entity.createdAt, createdAt: entity.createdAt,
updatedAt: entity.updatedAt, updatedAt: entity.updatedAt,
)); ));
@override
TaskEither<IError, User> from(UserDto dto) => TaskEither.of(User(
id: dto.id,
name: dto.name,
email: dto.email,
createdAt: dto.createdAt,
updatedAt: dto.updatedAt,
));
@override
TaskEither<IError, List<User>> listFrom(Iterable<UserDto> targets) {
return TaskEither.traverseList(targets.toList(), from);
}
@override
TaskEither<IError, List<UserDto>> listTo(Iterable<User> origins) { TaskEither<IError, List<UserDto>> listTo(Iterable<User> origins) {
return TaskEither.traverseList(origins.toList(), to); return TaskEither.traverseList(origins.toList(), to);
} }

View File

@ -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<Response> 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('/<projectId>')
Future<Response> 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<Response> 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('/<projectId>')
Future<Response> 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('/<projectId>')
Future<Response> 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);
}

View File

@ -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'/<projectId>',
service.fetchProject,
);
router.add(
'POST',
r'/',
service.createProject,
);
router.add(
'PUT',
r'/<projectId>',
service.updateProject,
);
router.add(
'DELETE',
r'/<projectId>',
service.deleteProject,
);
return router;
}

View File

@ -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<Response> 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('/<taskId>')
Future<Response> 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<Response> 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('/<taskId>')
Future<Response> 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('/<taskId>')
Future<Response> 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);
}

View File

@ -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'/<taskId>',
service.fetchTask,
);
router.add(
'POST',
r'/',
service.createTask,
);
router.add(
'PUT',
r'/<taskId>',
service.updateTask,
);
router.add(
'DELETE',
r'/<taskId>',
service.deleteTask,
);
return router;
}

View File

@ -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<UserService>((ref) {
final database = ref.read(userRepoProvider);
return UserService(database);
});
final projectServiceProvider = Provider<ProjectService>((ref) {
final database = ref.read(projectProvider);
return ProjectService(database);
});
final projectTaskServiceProvider = Provider<ProjectTaskService>((ref) {
final database = ref.read(projectTaskProvider);
return ProjectTaskService(database);
});
final timeEntryServiceProvider = Provider<TimeEntryService>((ref) {
final database = ref.read(timeEntryProvider);
return TimeEntryService(database);
});

View File

@ -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<Response> 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('/<entryId>')
Future<Response> 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<Response> 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('/<entryId>')
Future<Response> 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('/<entryId>')
Future<Response> 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);
}

View File

@ -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'/<entryId>',
service.fetchEntry,
);
router.add(
'POST',
r'/',
service.createEntry,
);
router.add(
'PUT',
r'/<entryId>',
service.updateEntry,
);
router.add(
'DELETE',
r'/<entryId>',
service.deleteEntry,
);
return router;
}

View File

@ -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<UserService>((ref) {
final database = ref.read(userRepoProvider);
return UserService(database);
});

View File

@ -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'; import 'package:backend_dart/domain/data/user_data_source.dart';
abstract class IDatabase { abstract class IDatabase {
UserDataSource get users; UserDataSource get users;
TimeEntryDataSource get timeEntries;
ProjectTaskDataSource get tasks;
ProjectDataSource get projects;
Future<void> close(); Future<void> close();
} }

View File

@ -7,30 +7,33 @@ abstract class ProjectDataSource {
/// Creates a new project in the data source. /// Creates a new project in the data source.
/// ///
/// Throws an error if the creation fails. /// Throws an error if the creation fails.
TaskEither<IError, Project> createProject(ProjectCreate project); TaskEither<IError, Project> create(ProjectCreate project);
/// Retrieves a project by its unique ID. /// Retrieves a project by its unique ID.
/// ///
/// Returns `null` if no project is found. /// Returns `null` if no project is found.
TaskEither<IError, Project> findProjectById(String id); TaskEither<IError, Project> findById(String id);
/// Retrieves all projects associated with a specific user. /// Retrieves all projects associated with a specific user.
/// ///
/// Returns an empty list if no projects are found. /// Returns an empty list if no projects are found.
TaskEither<IError,List<Project>> findProjectsByUserId(String userId); TaskEither<IError, List<Project>> findByUserId(String userId);
/// Updates an existing project in the data source. /// Updates an existing project in the data source.
/// ///
/// Throws an error if the update fails. /// Throws an error if the update fails.
TaskEither<IError, Project> updateProject(ProjectUpdate project); TaskEither<IError, Project> update(ProjectUpdate project);
/// Deletes a project by its unique ID. /// Deletes a project by its unique ID.
/// ///
/// Throws an error if the deletion fails. /// Throws an error if the deletion fails.
TaskEither<IError, Project> deleteProject(String id); TaskEither<IError, Project> delete(String id);
/// Retrieves all projects in the data source. /// Retrieves all projects in the data source.
/// ///
/// Returns an empty list if no projects exist. /// Returns an empty list if no projects exist.
TaskEither<IError, List<Project>> findAllProjects(); TaskEither<IError, List<Project>> findAll();
/// Generates a new unique ID for a task.
TaskEither<IError, String> generateId();
} }

View File

@ -0,0 +1,39 @@
import 'package:backend_dart/domain/entities/project_task.dart';
import 'package:backend_dart/domain/interface/error.dart';
import 'package:fpdart/fpdart.dart';
/// Interface for managing task data interactions.
abstract class ProjectTaskDataSource {
/// Creates a new task in the data source.
///
/// Throws an error if the creation fails.
TaskEither<IError, ProjectTask> create(ProjectTaskCreate task);
/// Retrieves a task by its unique ID.
///
/// Returns `null` if no task is found.
TaskEither<IError, ProjectTask> findById(String id);
/// Retrieves all tasks for a specific project.
///
/// Returns an empty list if no tasks are found.
TaskEither<IError, List<ProjectTask>> findByProjectId(String projectId);
/// Updates an existing task in the data source.
///
/// Throws an error if the update fails.
TaskEither<IError, ProjectTask> update(ProjectTaskUpdate task);
/// Deletes a task by its unique ID.
///
/// Throws an error if the deletion fails.
TaskEither<IError, ProjectTask> delete(String id);
/// Retrieves all tasks in the data source.
///
/// Returns an empty list if no tasks exist.
TaskEither<IError, List<ProjectTask>> findAll();
/// Generates a new unique ID for a task.
TaskEither<IError, String> generateId();
}

View File

@ -0,0 +1,44 @@
import 'package:backend_dart/domain/entities/time_entry.dart';
import 'package:backend_dart/domain/interface/error.dart';
import 'package:fpdart/fpdart.dart';
/// Interface for managing time entry data interactions.
abstract class TimeEntryDataSource {
/// Creates a new time entry in the data source.
///
/// Throws an error if the creation fails.
TaskEither<IError, TimeEntry> create(TimeEntryCreate timeEntry);
/// Retrieves a time entry by its unique ID.
///
/// Returns `null` if no time entry is found.
TaskEither<IError, TimeEntry> findById(String id);
/// Retrieves all time entries for a specific user.
///
/// Returns an empty list if no time entries are found.
TaskEither<IError, List<TimeEntry>> findByUserId(String userId);
/// Retrieves all time entries for a specific project.
///
/// Returns an empty list if no time entries are found.
TaskEither<IError, List<TimeEntry>> findByProjectId(String projectId);
/// Updates an existing time entry in the data source.
///
/// Throws an error if the update fails.
TaskEither<IError, TimeEntry> update(TimeEntryUpdate timeEntry);
/// Deletes a time entry by its unique ID.
///
/// Throws an error if the deletion fails.
TaskEither<IError, TimeEntry> delete(String id);
/// Retrieves all time entries in the data source.
///
/// Returns an empty list if no time entries exist.
TaskEither<IError, List<TimeEntry>> findAll();
/// Generates a new unique ID for a time entry.
TaskEither<IError, String> generateId();
}

View File

@ -5,6 +5,7 @@ part 'project.freezed.dart';
@freezed @freezed
class ProjectCreate with _$ProjectCreate { class ProjectCreate with _$ProjectCreate {
const factory ProjectCreate({ const factory ProjectCreate({
String? id,
required String name, required String name,
String? description, String? description,
String? clientId, String? clientId,

View File

@ -16,6 +16,7 @@ final _privateConstructorUsedError = UnsupportedError(
/// @nodoc /// @nodoc
mixin _$ProjectCreate { mixin _$ProjectCreate {
String? get id => throw _privateConstructorUsedError;
String get name => throw _privateConstructorUsedError; String get name => throw _privateConstructorUsedError;
String? get description => throw _privateConstructorUsedError; String? get description => throw _privateConstructorUsedError;
String? get clientId => throw _privateConstructorUsedError; String? get clientId => throw _privateConstructorUsedError;
@ -35,7 +36,11 @@ abstract class $ProjectCreateCopyWith<$Res> {
_$ProjectCreateCopyWithImpl<$Res, ProjectCreate>; _$ProjectCreateCopyWithImpl<$Res, ProjectCreate>;
@useResult @useResult
$Res call( $Res call(
{String name, String? description, String? clientId, String userId}); {String? id,
String name,
String? description,
String? clientId,
String userId});
} }
/// @nodoc /// @nodoc
@ -53,12 +58,17 @@ class _$ProjectCreateCopyWithImpl<$Res, $Val extends ProjectCreate>
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
@override @override
$Res call({ $Res call({
Object? id = freezed,
Object? name = null, Object? name = null,
Object? description = freezed, Object? description = freezed,
Object? clientId = freezed, Object? clientId = freezed,
Object? userId = null, Object? userId = null,
}) { }) {
return _then(_value.copyWith( return _then(_value.copyWith(
id: freezed == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String?,
name: null == name name: null == name
? _value.name ? _value.name
: name // ignore: cast_nullable_to_non_nullable : name // ignore: cast_nullable_to_non_nullable
@ -88,7 +98,11 @@ abstract class _$$ProjectCreateImplCopyWith<$Res>
@override @override
@useResult @useResult
$Res call( $Res call(
{String name, String? description, String? clientId, String userId}); {String? id,
String name,
String? description,
String? clientId,
String userId});
} }
/// @nodoc /// @nodoc
@ -104,12 +118,17 @@ class __$$ProjectCreateImplCopyWithImpl<$Res>
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
@override @override
$Res call({ $Res call({
Object? id = freezed,
Object? name = null, Object? name = null,
Object? description = freezed, Object? description = freezed,
Object? clientId = freezed, Object? clientId = freezed,
Object? userId = null, Object? userId = null,
}) { }) {
return _then(_$ProjectCreateImpl( return _then(_$ProjectCreateImpl(
id: freezed == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String?,
name: null == name name: null == name
? _value.name ? _value.name
: name // ignore: cast_nullable_to_non_nullable : name // ignore: cast_nullable_to_non_nullable
@ -134,11 +153,14 @@ class __$$ProjectCreateImplCopyWithImpl<$Res>
class _$ProjectCreateImpl implements _ProjectCreate { class _$ProjectCreateImpl implements _ProjectCreate {
const _$ProjectCreateImpl( const _$ProjectCreateImpl(
{required this.name, {this.id,
required this.name,
this.description, this.description,
this.clientId, this.clientId,
required this.userId}); required this.userId});
@override
final String? id;
@override @override
final String name; final String name;
@override @override
@ -150,7 +172,7 @@ class _$ProjectCreateImpl implements _ProjectCreate {
@override @override
String toString() { 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 @override
@ -158,6 +180,7 @@ class _$ProjectCreateImpl implements _ProjectCreate {
return identical(this, other) || return identical(this, other) ||
(other.runtimeType == runtimeType && (other.runtimeType == runtimeType &&
other is _$ProjectCreateImpl && other is _$ProjectCreateImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.name, name) || other.name == name) && (identical(other.name, name) || other.name == name) &&
(identical(other.description, description) || (identical(other.description, description) ||
other.description == description) && other.description == description) &&
@ -168,7 +191,7 @@ class _$ProjectCreateImpl implements _ProjectCreate {
@override @override
int get hashCode => int get hashCode =>
Object.hash(runtimeType, name, description, clientId, userId); Object.hash(runtimeType, id, name, description, clientId, userId);
/// Create a copy of ProjectCreate /// Create a copy of ProjectCreate
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@ -181,11 +204,14 @@ class _$ProjectCreateImpl implements _ProjectCreate {
abstract class _ProjectCreate implements ProjectCreate { abstract class _ProjectCreate implements ProjectCreate {
const factory _ProjectCreate( const factory _ProjectCreate(
{required final String name, {final String? id,
required final String name,
final String? description, final String? description,
final String? clientId, final String? clientId,
required final String userId}) = _$ProjectCreateImpl; required final String userId}) = _$ProjectCreateImpl;
@override
String? get id;
@override @override
String get name; String get name;
@override @override

View File

@ -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;
}

View File

@ -0,0 +1,622 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'project_task.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$ProjectTask {
String get id => throw _privateConstructorUsedError;
String get name => throw _privateConstructorUsedError;
String? get description => throw _privateConstructorUsedError;
String get projectId => throw _privateConstructorUsedError;
DateTime get createdAt => throw _privateConstructorUsedError;
DateTime get updatedAt => throw _privateConstructorUsedError;
/// Create a copy of ProjectTask
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ProjectTaskCopyWith<ProjectTask> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ProjectTaskCopyWith<$Res> {
factory $ProjectTaskCopyWith(
ProjectTask value, $Res Function(ProjectTask) then) =
_$ProjectTaskCopyWithImpl<$Res, ProjectTask>;
@useResult
$Res call(
{String id,
String name,
String? description,
String projectId,
DateTime createdAt,
DateTime updatedAt});
}
/// @nodoc
class _$ProjectTaskCopyWithImpl<$Res, $Val extends ProjectTask>
implements $ProjectTaskCopyWith<$Res> {
_$ProjectTaskCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ProjectTask
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? name = null,
Object? description = freezed,
Object? projectId = null,
Object? createdAt = null,
Object? updatedAt = null,
}) {
return _then(_value.copyWith(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
projectId: null == projectId
? _value.projectId
: projectId // ignore: cast_nullable_to_non_nullable
as String,
createdAt: null == createdAt
? _value.createdAt
: createdAt // ignore: cast_nullable_to_non_nullable
as DateTime,
updatedAt: null == updatedAt
? _value.updatedAt
: updatedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
) as $Val);
}
}
/// @nodoc
abstract class _$$ProjectTaskImplCopyWith<$Res>
implements $ProjectTaskCopyWith<$Res> {
factory _$$ProjectTaskImplCopyWith(
_$ProjectTaskImpl value, $Res Function(_$ProjectTaskImpl) then) =
__$$ProjectTaskImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{String id,
String name,
String? description,
String projectId,
DateTime createdAt,
DateTime updatedAt});
}
/// @nodoc
class __$$ProjectTaskImplCopyWithImpl<$Res>
extends _$ProjectTaskCopyWithImpl<$Res, _$ProjectTaskImpl>
implements _$$ProjectTaskImplCopyWith<$Res> {
__$$ProjectTaskImplCopyWithImpl(
_$ProjectTaskImpl _value, $Res Function(_$ProjectTaskImpl) _then)
: super(_value, _then);
/// Create a copy of ProjectTask
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? name = null,
Object? description = freezed,
Object? projectId = null,
Object? createdAt = null,
Object? updatedAt = null,
}) {
return _then(_$ProjectTaskImpl(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
projectId: null == projectId
? _value.projectId
: projectId // ignore: cast_nullable_to_non_nullable
as String,
createdAt: null == createdAt
? _value.createdAt
: createdAt // ignore: cast_nullable_to_non_nullable
as DateTime,
updatedAt: null == updatedAt
? _value.updatedAt
: updatedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
));
}
}
/// @nodoc
class _$ProjectTaskImpl implements _ProjectTask {
const _$ProjectTaskImpl(
{required this.id,
required this.name,
this.description,
required this.projectId,
required this.createdAt,
required this.updatedAt});
@override
final String id;
@override
final String name;
@override
final String? description;
@override
final String projectId;
@override
final DateTime createdAt;
@override
final DateTime updatedAt;
@override
String toString() {
return 'ProjectTask(id: $id, name: $name, description: $description, projectId: $projectId, createdAt: $createdAt, updatedAt: $updatedAt)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ProjectTaskImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.description, description) ||
other.description == description) &&
(identical(other.projectId, projectId) ||
other.projectId == projectId) &&
(identical(other.createdAt, createdAt) ||
other.createdAt == createdAt) &&
(identical(other.updatedAt, updatedAt) ||
other.updatedAt == updatedAt));
}
@override
int get hashCode => Object.hash(
runtimeType, id, name, description, projectId, createdAt, updatedAt);
/// Create a copy of ProjectTask
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ProjectTaskImplCopyWith<_$ProjectTaskImpl> get copyWith =>
__$$ProjectTaskImplCopyWithImpl<_$ProjectTaskImpl>(this, _$identity);
}
abstract class _ProjectTask implements ProjectTask {
const factory _ProjectTask(
{required final String id,
required final String name,
final String? description,
required final String projectId,
required final DateTime createdAt,
required final DateTime updatedAt}) = _$ProjectTaskImpl;
@override
String get id;
@override
String get name;
@override
String? get description;
@override
String get projectId;
@override
DateTime get createdAt;
@override
DateTime get updatedAt;
/// Create a copy of ProjectTask
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ProjectTaskImplCopyWith<_$ProjectTaskImpl> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
mixin _$ProjectTaskCreate {
String? get id => throw _privateConstructorUsedError;
String get name => throw _privateConstructorUsedError;
String? get description => throw _privateConstructorUsedError;
String get projectId => throw _privateConstructorUsedError;
/// Create a copy of ProjectTaskCreate
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ProjectTaskCreateCopyWith<ProjectTaskCreate> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ProjectTaskCreateCopyWith<$Res> {
factory $ProjectTaskCreateCopyWith(
ProjectTaskCreate value, $Res Function(ProjectTaskCreate) then) =
_$ProjectTaskCreateCopyWithImpl<$Res, ProjectTaskCreate>;
@useResult
$Res call({String? id, String name, String? description, String projectId});
}
/// @nodoc
class _$ProjectTaskCreateCopyWithImpl<$Res, $Val extends ProjectTaskCreate>
implements $ProjectTaskCreateCopyWith<$Res> {
_$ProjectTaskCreateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ProjectTaskCreate
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = freezed,
Object? name = null,
Object? description = freezed,
Object? projectId = null,
}) {
return _then(_value.copyWith(
id: freezed == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String?,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
projectId: null == projectId
? _value.projectId
: projectId // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
}
}
/// @nodoc
abstract class _$$ProjectTaskCreateImplCopyWith<$Res>
implements $ProjectTaskCreateCopyWith<$Res> {
factory _$$ProjectTaskCreateImplCopyWith(_$ProjectTaskCreateImpl value,
$Res Function(_$ProjectTaskCreateImpl) then) =
__$$ProjectTaskCreateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String? id, String name, String? description, String projectId});
}
/// @nodoc
class __$$ProjectTaskCreateImplCopyWithImpl<$Res>
extends _$ProjectTaskCreateCopyWithImpl<$Res, _$ProjectTaskCreateImpl>
implements _$$ProjectTaskCreateImplCopyWith<$Res> {
__$$ProjectTaskCreateImplCopyWithImpl(_$ProjectTaskCreateImpl _value,
$Res Function(_$ProjectTaskCreateImpl) _then)
: super(_value, _then);
/// Create a copy of ProjectTaskCreate
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = freezed,
Object? name = null,
Object? description = freezed,
Object? projectId = null,
}) {
return _then(_$ProjectTaskCreateImpl(
id: freezed == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String?,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
projectId: null == projectId
? _value.projectId
: projectId // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
class _$ProjectTaskCreateImpl implements _ProjectTaskCreate {
const _$ProjectTaskCreateImpl(
{this.id, required this.name, this.description, required this.projectId});
@override
final String? id;
@override
final String name;
@override
final String? description;
@override
final String projectId;
@override
String toString() {
return 'ProjectTaskCreate(id: $id, name: $name, description: $description, projectId: $projectId)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ProjectTaskCreateImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.description, description) ||
other.description == description) &&
(identical(other.projectId, projectId) ||
other.projectId == projectId));
}
@override
int get hashCode =>
Object.hash(runtimeType, id, name, description, projectId);
/// Create a copy of ProjectTaskCreate
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ProjectTaskCreateImplCopyWith<_$ProjectTaskCreateImpl> get copyWith =>
__$$ProjectTaskCreateImplCopyWithImpl<_$ProjectTaskCreateImpl>(
this, _$identity);
}
abstract class _ProjectTaskCreate implements ProjectTaskCreate {
const factory _ProjectTaskCreate(
{final String? id,
required final String name,
final String? description,
required final String projectId}) = _$ProjectTaskCreateImpl;
@override
String? get id;
@override
String get name;
@override
String? get description;
@override
String get projectId;
/// Create a copy of ProjectTaskCreate
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ProjectTaskCreateImplCopyWith<_$ProjectTaskCreateImpl> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
mixin _$ProjectTaskUpdate {
String get id => throw _privateConstructorUsedError;
String? get name => throw _privateConstructorUsedError;
String? get description => throw _privateConstructorUsedError;
String? get projectId => throw _privateConstructorUsedError;
/// Create a copy of ProjectTaskUpdate
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ProjectTaskUpdateCopyWith<ProjectTaskUpdate> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ProjectTaskUpdateCopyWith<$Res> {
factory $ProjectTaskUpdateCopyWith(
ProjectTaskUpdate value, $Res Function(ProjectTaskUpdate) then) =
_$ProjectTaskUpdateCopyWithImpl<$Res, ProjectTaskUpdate>;
@useResult
$Res call({String id, String? name, String? description, String? projectId});
}
/// @nodoc
class _$ProjectTaskUpdateCopyWithImpl<$Res, $Val extends ProjectTaskUpdate>
implements $ProjectTaskUpdateCopyWith<$Res> {
_$ProjectTaskUpdateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ProjectTaskUpdate
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? name = freezed,
Object? description = freezed,
Object? projectId = freezed,
}) {
return _then(_value.copyWith(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
name: freezed == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String?,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
projectId: freezed == projectId
? _value.projectId
: projectId // ignore: cast_nullable_to_non_nullable
as String?,
) as $Val);
}
}
/// @nodoc
abstract class _$$ProjectTaskUpdateImplCopyWith<$Res>
implements $ProjectTaskUpdateCopyWith<$Res> {
factory _$$ProjectTaskUpdateImplCopyWith(_$ProjectTaskUpdateImpl value,
$Res Function(_$ProjectTaskUpdateImpl) then) =
__$$ProjectTaskUpdateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String id, String? name, String? description, String? projectId});
}
/// @nodoc
class __$$ProjectTaskUpdateImplCopyWithImpl<$Res>
extends _$ProjectTaskUpdateCopyWithImpl<$Res, _$ProjectTaskUpdateImpl>
implements _$$ProjectTaskUpdateImplCopyWith<$Res> {
__$$ProjectTaskUpdateImplCopyWithImpl(_$ProjectTaskUpdateImpl _value,
$Res Function(_$ProjectTaskUpdateImpl) _then)
: super(_value, _then);
/// Create a copy of ProjectTaskUpdate
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? name = freezed,
Object? description = freezed,
Object? projectId = freezed,
}) {
return _then(_$ProjectTaskUpdateImpl(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
name: freezed == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String?,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
projectId: freezed == projectId
? _value.projectId
: projectId // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// @nodoc
class _$ProjectTaskUpdateImpl implements _ProjectTaskUpdate {
const _$ProjectTaskUpdateImpl(
{required this.id, this.name, this.description, this.projectId});
@override
final String id;
@override
final String? name;
@override
final String? description;
@override
final String? projectId;
@override
String toString() {
return 'ProjectTaskUpdate(id: $id, name: $name, description: $description, projectId: $projectId)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ProjectTaskUpdateImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.description, description) ||
other.description == description) &&
(identical(other.projectId, projectId) ||
other.projectId == projectId));
}
@override
int get hashCode =>
Object.hash(runtimeType, id, name, description, projectId);
/// Create a copy of ProjectTaskUpdate
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ProjectTaskUpdateImplCopyWith<_$ProjectTaskUpdateImpl> get copyWith =>
__$$ProjectTaskUpdateImplCopyWithImpl<_$ProjectTaskUpdateImpl>(
this, _$identity);
}
abstract class _ProjectTaskUpdate implements ProjectTaskUpdate {
const factory _ProjectTaskUpdate(
{required final String id,
final String? name,
final String? description,
final String? projectId}) = _$ProjectTaskUpdateImpl;
@override
String get id;
@override
String? get name;
@override
String? get description;
@override
String? get projectId;
/// Create a copy of ProjectTaskUpdate
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ProjectTaskUpdateImplCopyWith<_$ProjectTaskUpdateImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@ -0,0 +1,51 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'time_entry.freezed.dart';
part 'time_entry.g.dart';
@freezed
class TimeEntry with _$TimeEntry {
const factory TimeEntry({
required String id,
required DateTime startTime,
required DateTime endTime,
String? description,
required String userId,
required String projectId,
required DateTime createdAt,
required DateTime updatedAt,
}) = _TimeEntry;
factory TimeEntry.fromJson(Map<String, dynamic> json) =>
_$TimeEntryFromJson(json);
}
@freezed
class TimeEntryCreate with _$TimeEntryCreate {
const factory TimeEntryCreate({
String? id,
required DateTime startTime,
required DateTime endTime,
String? description,
required String userId,
required String projectId,
}) = _TimeEntryCreate;
factory TimeEntryCreate.fromJson(Map<String, dynamic> json) =>
_$TimeEntryCreateFromJson(json);
}
@freezed
class TimeEntryUpdate with _$TimeEntryUpdate {
const factory TimeEntryUpdate({
required String id,
DateTime? startTime,
DateTime? endTime,
String? description,
String? userId,
String? projectId,
}) = _TimeEntryUpdate;
factory TimeEntryUpdate.fromJson(Map<String, dynamic> json) =>
_$TimeEntryUpdateFromJson(json);
}

View File

@ -0,0 +1,829 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'time_entry.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
TimeEntry _$TimeEntryFromJson(Map<String, dynamic> json) {
return _TimeEntry.fromJson(json);
}
/// @nodoc
mixin _$TimeEntry {
String get id => throw _privateConstructorUsedError;
DateTime get startTime => throw _privateConstructorUsedError;
DateTime get endTime => throw _privateConstructorUsedError;
String? get description => throw _privateConstructorUsedError;
String get userId => throw _privateConstructorUsedError;
String get projectId => throw _privateConstructorUsedError;
DateTime get createdAt => throw _privateConstructorUsedError;
DateTime get updatedAt => throw _privateConstructorUsedError;
/// Serializes this TimeEntry to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of TimeEntry
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$TimeEntryCopyWith<TimeEntry> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $TimeEntryCopyWith<$Res> {
factory $TimeEntryCopyWith(TimeEntry value, $Res Function(TimeEntry) then) =
_$TimeEntryCopyWithImpl<$Res, TimeEntry>;
@useResult
$Res call(
{String id,
DateTime startTime,
DateTime endTime,
String? description,
String userId,
String projectId,
DateTime createdAt,
DateTime updatedAt});
}
/// @nodoc
class _$TimeEntryCopyWithImpl<$Res, $Val extends TimeEntry>
implements $TimeEntryCopyWith<$Res> {
_$TimeEntryCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of TimeEntry
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? startTime = null,
Object? endTime = null,
Object? description = freezed,
Object? userId = null,
Object? projectId = null,
Object? createdAt = null,
Object? updatedAt = null,
}) {
return _then(_value.copyWith(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
startTime: null == startTime
? _value.startTime
: startTime // ignore: cast_nullable_to_non_nullable
as DateTime,
endTime: null == endTime
? _value.endTime
: endTime // ignore: cast_nullable_to_non_nullable
as DateTime,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
userId: null == userId
? _value.userId
: userId // ignore: cast_nullable_to_non_nullable
as String,
projectId: null == projectId
? _value.projectId
: projectId // ignore: cast_nullable_to_non_nullable
as String,
createdAt: null == createdAt
? _value.createdAt
: createdAt // ignore: cast_nullable_to_non_nullable
as DateTime,
updatedAt: null == updatedAt
? _value.updatedAt
: updatedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
) as $Val);
}
}
/// @nodoc
abstract class _$$TimeEntryImplCopyWith<$Res>
implements $TimeEntryCopyWith<$Res> {
factory _$$TimeEntryImplCopyWith(
_$TimeEntryImpl value, $Res Function(_$TimeEntryImpl) then) =
__$$TimeEntryImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{String id,
DateTime startTime,
DateTime endTime,
String? description,
String userId,
String projectId,
DateTime createdAt,
DateTime updatedAt});
}
/// @nodoc
class __$$TimeEntryImplCopyWithImpl<$Res>
extends _$TimeEntryCopyWithImpl<$Res, _$TimeEntryImpl>
implements _$$TimeEntryImplCopyWith<$Res> {
__$$TimeEntryImplCopyWithImpl(
_$TimeEntryImpl _value, $Res Function(_$TimeEntryImpl) _then)
: super(_value, _then);
/// Create a copy of TimeEntry
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? startTime = null,
Object? endTime = null,
Object? description = freezed,
Object? userId = null,
Object? projectId = null,
Object? createdAt = null,
Object? updatedAt = null,
}) {
return _then(_$TimeEntryImpl(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
startTime: null == startTime
? _value.startTime
: startTime // ignore: cast_nullable_to_non_nullable
as DateTime,
endTime: null == endTime
? _value.endTime
: endTime // ignore: cast_nullable_to_non_nullable
as DateTime,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
userId: null == userId
? _value.userId
: userId // ignore: cast_nullable_to_non_nullable
as String,
projectId: null == projectId
? _value.projectId
: projectId // ignore: cast_nullable_to_non_nullable
as String,
createdAt: null == createdAt
? _value.createdAt
: createdAt // ignore: cast_nullable_to_non_nullable
as DateTime,
updatedAt: null == updatedAt
? _value.updatedAt
: updatedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
));
}
}
/// @nodoc
@JsonSerializable()
class _$TimeEntryImpl implements _TimeEntry {
const _$TimeEntryImpl(
{required this.id,
required this.startTime,
required this.endTime,
this.description,
required this.userId,
required this.projectId,
required this.createdAt,
required this.updatedAt});
factory _$TimeEntryImpl.fromJson(Map<String, dynamic> json) =>
_$$TimeEntryImplFromJson(json);
@override
final String id;
@override
final DateTime startTime;
@override
final DateTime endTime;
@override
final String? description;
@override
final String userId;
@override
final String projectId;
@override
final DateTime createdAt;
@override
final DateTime updatedAt;
@override
String toString() {
return 'TimeEntry(id: $id, startTime: $startTime, endTime: $endTime, description: $description, userId: $userId, projectId: $projectId, createdAt: $createdAt, updatedAt: $updatedAt)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$TimeEntryImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.startTime, startTime) ||
other.startTime == startTime) &&
(identical(other.endTime, endTime) || other.endTime == endTime) &&
(identical(other.description, description) ||
other.description == description) &&
(identical(other.userId, userId) || other.userId == userId) &&
(identical(other.projectId, projectId) ||
other.projectId == projectId) &&
(identical(other.createdAt, createdAt) ||
other.createdAt == createdAt) &&
(identical(other.updatedAt, updatedAt) ||
other.updatedAt == updatedAt));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, id, startTime, endTime,
description, userId, projectId, createdAt, updatedAt);
/// Create a copy of TimeEntry
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$TimeEntryImplCopyWith<_$TimeEntryImpl> get copyWith =>
__$$TimeEntryImplCopyWithImpl<_$TimeEntryImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$TimeEntryImplToJson(
this,
);
}
}
abstract class _TimeEntry implements TimeEntry {
const factory _TimeEntry(
{required final String id,
required final DateTime startTime,
required final DateTime endTime,
final String? description,
required final String userId,
required final String projectId,
required final DateTime createdAt,
required final DateTime updatedAt}) = _$TimeEntryImpl;
factory _TimeEntry.fromJson(Map<String, dynamic> json) =
_$TimeEntryImpl.fromJson;
@override
String get id;
@override
DateTime get startTime;
@override
DateTime get endTime;
@override
String? get description;
@override
String get userId;
@override
String get projectId;
@override
DateTime get createdAt;
@override
DateTime get updatedAt;
/// Create a copy of TimeEntry
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$TimeEntryImplCopyWith<_$TimeEntryImpl> get copyWith =>
throw _privateConstructorUsedError;
}
TimeEntryCreate _$TimeEntryCreateFromJson(Map<String, dynamic> json) {
return _TimeEntryCreate.fromJson(json);
}
/// @nodoc
mixin _$TimeEntryCreate {
String? get id => throw _privateConstructorUsedError;
DateTime get startTime => throw _privateConstructorUsedError;
DateTime get endTime => throw _privateConstructorUsedError;
String? get description => throw _privateConstructorUsedError;
String get userId => throw _privateConstructorUsedError;
String get projectId => throw _privateConstructorUsedError;
/// Serializes this TimeEntryCreate to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of TimeEntryCreate
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$TimeEntryCreateCopyWith<TimeEntryCreate> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $TimeEntryCreateCopyWith<$Res> {
factory $TimeEntryCreateCopyWith(
TimeEntryCreate value, $Res Function(TimeEntryCreate) then) =
_$TimeEntryCreateCopyWithImpl<$Res, TimeEntryCreate>;
@useResult
$Res call(
{String? id,
DateTime startTime,
DateTime endTime,
String? description,
String userId,
String projectId});
}
/// @nodoc
class _$TimeEntryCreateCopyWithImpl<$Res, $Val extends TimeEntryCreate>
implements $TimeEntryCreateCopyWith<$Res> {
_$TimeEntryCreateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of TimeEntryCreate
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = freezed,
Object? startTime = null,
Object? endTime = null,
Object? description = freezed,
Object? userId = null,
Object? projectId = null,
}) {
return _then(_value.copyWith(
id: freezed == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String?,
startTime: null == startTime
? _value.startTime
: startTime // ignore: cast_nullable_to_non_nullable
as DateTime,
endTime: null == endTime
? _value.endTime
: endTime // ignore: cast_nullable_to_non_nullable
as DateTime,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
userId: null == userId
? _value.userId
: userId // ignore: cast_nullable_to_non_nullable
as String,
projectId: null == projectId
? _value.projectId
: projectId // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
}
}
/// @nodoc
abstract class _$$TimeEntryCreateImplCopyWith<$Res>
implements $TimeEntryCreateCopyWith<$Res> {
factory _$$TimeEntryCreateImplCopyWith(_$TimeEntryCreateImpl value,
$Res Function(_$TimeEntryCreateImpl) then) =
__$$TimeEntryCreateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{String? id,
DateTime startTime,
DateTime endTime,
String? description,
String userId,
String projectId});
}
/// @nodoc
class __$$TimeEntryCreateImplCopyWithImpl<$Res>
extends _$TimeEntryCreateCopyWithImpl<$Res, _$TimeEntryCreateImpl>
implements _$$TimeEntryCreateImplCopyWith<$Res> {
__$$TimeEntryCreateImplCopyWithImpl(
_$TimeEntryCreateImpl _value, $Res Function(_$TimeEntryCreateImpl) _then)
: super(_value, _then);
/// Create a copy of TimeEntryCreate
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = freezed,
Object? startTime = null,
Object? endTime = null,
Object? description = freezed,
Object? userId = null,
Object? projectId = null,
}) {
return _then(_$TimeEntryCreateImpl(
id: freezed == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String?,
startTime: null == startTime
? _value.startTime
: startTime // ignore: cast_nullable_to_non_nullable
as DateTime,
endTime: null == endTime
? _value.endTime
: endTime // ignore: cast_nullable_to_non_nullable
as DateTime,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
userId: null == userId
? _value.userId
: userId // ignore: cast_nullable_to_non_nullable
as String,
projectId: null == projectId
? _value.projectId
: projectId // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
@JsonSerializable()
class _$TimeEntryCreateImpl implements _TimeEntryCreate {
const _$TimeEntryCreateImpl(
{this.id,
required this.startTime,
required this.endTime,
this.description,
required this.userId,
required this.projectId});
factory _$TimeEntryCreateImpl.fromJson(Map<String, dynamic> json) =>
_$$TimeEntryCreateImplFromJson(json);
@override
final String? id;
@override
final DateTime startTime;
@override
final DateTime endTime;
@override
final String? description;
@override
final String userId;
@override
final String projectId;
@override
String toString() {
return 'TimeEntryCreate(id: $id, startTime: $startTime, endTime: $endTime, description: $description, userId: $userId, projectId: $projectId)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$TimeEntryCreateImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.startTime, startTime) ||
other.startTime == startTime) &&
(identical(other.endTime, endTime) || other.endTime == endTime) &&
(identical(other.description, description) ||
other.description == description) &&
(identical(other.userId, userId) || other.userId == userId) &&
(identical(other.projectId, projectId) ||
other.projectId == projectId));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType, id, startTime, endTime, description, userId, projectId);
/// Create a copy of TimeEntryCreate
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$TimeEntryCreateImplCopyWith<_$TimeEntryCreateImpl> get copyWith =>
__$$TimeEntryCreateImplCopyWithImpl<_$TimeEntryCreateImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$TimeEntryCreateImplToJson(
this,
);
}
}
abstract class _TimeEntryCreate implements TimeEntryCreate {
const factory _TimeEntryCreate(
{final String? id,
required final DateTime startTime,
required final DateTime endTime,
final String? description,
required final String userId,
required final String projectId}) = _$TimeEntryCreateImpl;
factory _TimeEntryCreate.fromJson(Map<String, dynamic> json) =
_$TimeEntryCreateImpl.fromJson;
@override
String? get id;
@override
DateTime get startTime;
@override
DateTime get endTime;
@override
String? get description;
@override
String get userId;
@override
String get projectId;
/// Create a copy of TimeEntryCreate
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$TimeEntryCreateImplCopyWith<_$TimeEntryCreateImpl> get copyWith =>
throw _privateConstructorUsedError;
}
TimeEntryUpdate _$TimeEntryUpdateFromJson(Map<String, dynamic> json) {
return _TimeEntryUpdate.fromJson(json);
}
/// @nodoc
mixin _$TimeEntryUpdate {
String get id => throw _privateConstructorUsedError;
DateTime? get startTime => throw _privateConstructorUsedError;
DateTime? get endTime => throw _privateConstructorUsedError;
String? get description => throw _privateConstructorUsedError;
String? get userId => throw _privateConstructorUsedError;
String? get projectId => throw _privateConstructorUsedError;
/// Serializes this TimeEntryUpdate to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of TimeEntryUpdate
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$TimeEntryUpdateCopyWith<TimeEntryUpdate> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $TimeEntryUpdateCopyWith<$Res> {
factory $TimeEntryUpdateCopyWith(
TimeEntryUpdate value, $Res Function(TimeEntryUpdate) then) =
_$TimeEntryUpdateCopyWithImpl<$Res, TimeEntryUpdate>;
@useResult
$Res call(
{String id,
DateTime? startTime,
DateTime? endTime,
String? description,
String? userId,
String? projectId});
}
/// @nodoc
class _$TimeEntryUpdateCopyWithImpl<$Res, $Val extends TimeEntryUpdate>
implements $TimeEntryUpdateCopyWith<$Res> {
_$TimeEntryUpdateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of TimeEntryUpdate
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? startTime = freezed,
Object? endTime = freezed,
Object? description = freezed,
Object? userId = freezed,
Object? projectId = freezed,
}) {
return _then(_value.copyWith(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
startTime: freezed == startTime
? _value.startTime
: startTime // ignore: cast_nullable_to_non_nullable
as DateTime?,
endTime: freezed == endTime
? _value.endTime
: endTime // ignore: cast_nullable_to_non_nullable
as DateTime?,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
userId: freezed == userId
? _value.userId
: userId // ignore: cast_nullable_to_non_nullable
as String?,
projectId: freezed == projectId
? _value.projectId
: projectId // ignore: cast_nullable_to_non_nullable
as String?,
) as $Val);
}
}
/// @nodoc
abstract class _$$TimeEntryUpdateImplCopyWith<$Res>
implements $TimeEntryUpdateCopyWith<$Res> {
factory _$$TimeEntryUpdateImplCopyWith(_$TimeEntryUpdateImpl value,
$Res Function(_$TimeEntryUpdateImpl) then) =
__$$TimeEntryUpdateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{String id,
DateTime? startTime,
DateTime? endTime,
String? description,
String? userId,
String? projectId});
}
/// @nodoc
class __$$TimeEntryUpdateImplCopyWithImpl<$Res>
extends _$TimeEntryUpdateCopyWithImpl<$Res, _$TimeEntryUpdateImpl>
implements _$$TimeEntryUpdateImplCopyWith<$Res> {
__$$TimeEntryUpdateImplCopyWithImpl(
_$TimeEntryUpdateImpl _value, $Res Function(_$TimeEntryUpdateImpl) _then)
: super(_value, _then);
/// Create a copy of TimeEntryUpdate
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? startTime = freezed,
Object? endTime = freezed,
Object? description = freezed,
Object? userId = freezed,
Object? projectId = freezed,
}) {
return _then(_$TimeEntryUpdateImpl(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
startTime: freezed == startTime
? _value.startTime
: startTime // ignore: cast_nullable_to_non_nullable
as DateTime?,
endTime: freezed == endTime
? _value.endTime
: endTime // ignore: cast_nullable_to_non_nullable
as DateTime?,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
userId: freezed == userId
? _value.userId
: userId // ignore: cast_nullable_to_non_nullable
as String?,
projectId: freezed == projectId
? _value.projectId
: projectId // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// @nodoc
@JsonSerializable()
class _$TimeEntryUpdateImpl implements _TimeEntryUpdate {
const _$TimeEntryUpdateImpl(
{required this.id,
this.startTime,
this.endTime,
this.description,
this.userId,
this.projectId});
factory _$TimeEntryUpdateImpl.fromJson(Map<String, dynamic> json) =>
_$$TimeEntryUpdateImplFromJson(json);
@override
final String id;
@override
final DateTime? startTime;
@override
final DateTime? endTime;
@override
final String? description;
@override
final String? userId;
@override
final String? projectId;
@override
String toString() {
return 'TimeEntryUpdate(id: $id, startTime: $startTime, endTime: $endTime, description: $description, userId: $userId, projectId: $projectId)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$TimeEntryUpdateImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.startTime, startTime) ||
other.startTime == startTime) &&
(identical(other.endTime, endTime) || other.endTime == endTime) &&
(identical(other.description, description) ||
other.description == description) &&
(identical(other.userId, userId) || other.userId == userId) &&
(identical(other.projectId, projectId) ||
other.projectId == projectId));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType, id, startTime, endTime, description, userId, projectId);
/// Create a copy of TimeEntryUpdate
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$TimeEntryUpdateImplCopyWith<_$TimeEntryUpdateImpl> get copyWith =>
__$$TimeEntryUpdateImplCopyWithImpl<_$TimeEntryUpdateImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$TimeEntryUpdateImplToJson(
this,
);
}
}
abstract class _TimeEntryUpdate implements TimeEntryUpdate {
const factory _TimeEntryUpdate(
{required final String id,
final DateTime? startTime,
final DateTime? endTime,
final String? description,
final String? userId,
final String? projectId}) = _$TimeEntryUpdateImpl;
factory _TimeEntryUpdate.fromJson(Map<String, dynamic> json) =
_$TimeEntryUpdateImpl.fromJson;
@override
String get id;
@override
DateTime? get startTime;
@override
DateTime? get endTime;
@override
String? get description;
@override
String? get userId;
@override
String? get projectId;
/// Create a copy of TimeEntryUpdate
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$TimeEntryUpdateImplCopyWith<_$TimeEntryUpdateImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@ -0,0 +1,79 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'time_entry.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$TimeEntryImpl _$$TimeEntryImplFromJson(Map<String, dynamic> json) =>
_$TimeEntryImpl(
id: json['id'] as String,
startTime: DateTime.parse(json['startTime'] as String),
endTime: DateTime.parse(json['endTime'] as String),
description: json['description'] as String?,
userId: json['userId'] as String,
projectId: json['projectId'] as String,
createdAt: DateTime.parse(json['createdAt'] as String),
updatedAt: DateTime.parse(json['updatedAt'] as String),
);
Map<String, dynamic> _$$TimeEntryImplToJson(_$TimeEntryImpl instance) =>
<String, dynamic>{
'id': instance.id,
'startTime': instance.startTime.toIso8601String(),
'endTime': instance.endTime.toIso8601String(),
'description': instance.description,
'userId': instance.userId,
'projectId': instance.projectId,
'createdAt': instance.createdAt.toIso8601String(),
'updatedAt': instance.updatedAt.toIso8601String(),
};
_$TimeEntryCreateImpl _$$TimeEntryCreateImplFromJson(
Map<String, dynamic> json) =>
_$TimeEntryCreateImpl(
id: json['id'] as String?,
startTime: DateTime.parse(json['startTime'] as String),
endTime: DateTime.parse(json['endTime'] as String),
description: json['description'] as String?,
userId: json['userId'] as String,
projectId: json['projectId'] as String,
);
Map<String, dynamic> _$$TimeEntryCreateImplToJson(
_$TimeEntryCreateImpl instance) =>
<String, dynamic>{
'id': instance.id,
'startTime': instance.startTime.toIso8601String(),
'endTime': instance.endTime.toIso8601String(),
'description': instance.description,
'userId': instance.userId,
'projectId': instance.projectId,
};
_$TimeEntryUpdateImpl _$$TimeEntryUpdateImplFromJson(
Map<String, dynamic> json) =>
_$TimeEntryUpdateImpl(
id: json['id'] as String,
startTime: json['startTime'] == null
? null
: DateTime.parse(json['startTime'] as String),
endTime: json['endTime'] == null
? null
: DateTime.parse(json['endTime'] as String),
description: json['description'] as String?,
userId: json['userId'] as String?,
projectId: json['projectId'] as String?,
);
Map<String, dynamic> _$$TimeEntryUpdateImplToJson(
_$TimeEntryUpdateImpl instance) =>
<String, dynamic>{
'id': instance.id,
'startTime': instance.startTime?.toIso8601String(),
'endTime': instance.endTime?.toIso8601String(),
'description': instance.description,
'userId': instance.userId,
'projectId': instance.projectId,
};

View File

@ -0,0 +1,20 @@
import 'package:fpdart/fpdart.dart';
import 'package:backend_dart/domain/entities/project.dart';
import 'package:backend_dart/domain/interface/error.dart';
abstract class ProjectRepository {
/// Creates a new project.
TaskEither<IError, Project> create(ProjectCreate project);
/// Finds a project by its unique ID.
TaskEither<IError, Project> findById(String id);
/// Updates an existing project.
TaskEither<IError, Project> update(ProjectUpdate project);
/// Deletes a project by its unique ID.
TaskEither<IError, void> delete(String id);
/// Finds all projects.
TaskEither<IError, List<Project>> findAll();
}

View File

@ -0,0 +1,23 @@
import 'package:fpdart/fpdart.dart';
import 'package:backend_dart/domain/entities/project_task.dart';
import 'package:backend_dart/domain/interface/error.dart';
abstract class ProjectTaskRepository {
/// Creates a new project task.
TaskEither<IError, ProjectTask> create(ProjectTaskCreate task);
/// Finds a project task by its unique ID.
TaskEither<IError, ProjectTask> findById(String id);
/// Finds all tasks for a specific project.
TaskEither<IError, List<ProjectTask>> findByProjectId(String projectId);
/// Updates an existing project task.
TaskEither<IError, ProjectTask> update(ProjectTaskUpdate task);
/// Deletes a project task by its unique ID.
TaskEither<IError, void> delete(String id);
/// Finds all project tasks.
TaskEither<IError, List<ProjectTask>> findAll();
}

View File

@ -0,0 +1,26 @@
import 'package:fpdart/fpdart.dart';
import 'package:backend_dart/domain/entities/time_entry.dart';
import 'package:backend_dart/domain/interface/error.dart';
abstract class TimeEntryRepository {
/// Creates a new time entry.
TaskEither<IError, TimeEntry> create(TimeEntryCreate timeEntry);
/// Finds a time entry by its unique ID.
TaskEither<IError, TimeEntry> findById(String id);
/// Finds all time entries for a specific user.
TaskEither<IError, List<TimeEntry>> findByUserId(String userId);
/// Finds all time entries for a specific project.
TaskEither<IError, List<TimeEntry>> findByProjectId(String projectId);
/// Updates an existing time entry.
TaskEither<IError, TimeEntry> update(TimeEntryUpdate timeEntry);
/// Deletes a time entry by its unique ID.
TaskEither<IError, void> delete(String id);
/// Finds all time entries.
TaskEither<IError, List<TimeEntry>> findAll();
}

View File

@ -1501,15 +1501,15 @@ class TimeEntryDboDelegate {
} }
} }
class TaskDboDelegate { class ProjectTaskDboDelegate {
const TaskDboDelegate._(this._client); const ProjectTaskDboDelegate._(this._client);
final PrismaClient _client; final PrismaClient _client;
_i1.ActionClient<_i2.TaskDbo?> findUnique({ _i1.ActionClient<_i2.ProjectTaskDbo?> findUnique({
required _i3.TaskDboWhereUniqueInput where, required _i3.ProjectTaskDboWhereUniqueInput where,
_i3.TaskDboSelect? select, _i3.ProjectTaskDboSelect? select,
_i3.TaskDboInclude? include, _i3.ProjectTaskDboInclude? include,
}) { }) {
final args = { final args = {
'where': where, 'where': where,
@ -1518,7 +1518,7 @@ class TaskDboDelegate {
}; };
final query = _i1.serializeJsonQuery( final query = _i1.serializeJsonQuery(
args: args, args: args,
modelName: 'TaskDbo', modelName: 'ProjectTaskDbo',
action: _i1.JsonQueryAction.findUnique, action: _i1.JsonQueryAction.findUnique,
datamodel: PrismaClient.datamodel, datamodel: PrismaClient.datamodel,
); );
@ -1527,17 +1527,17 @@ class TaskDboDelegate {
headers: _client.$transaction.headers, headers: _client.$transaction.headers,
transaction: _client.$transaction.transaction, transaction: _client.$transaction.transaction,
); );
return _i1.ActionClient<_i2.TaskDbo?>( return _i1.ActionClient<_i2.ProjectTaskDbo?>(
action: 'findUniqueTaskDbo', action: 'findUniqueProjectTaskDbo',
result: result, 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({ _i1.ActionClient<_i2.ProjectTaskDbo> findUniqueOrThrow({
required _i3.TaskDboWhereUniqueInput where, required _i3.ProjectTaskDboWhereUniqueInput where,
_i3.TaskDboSelect? select, _i3.ProjectTaskDboSelect? select,
_i3.TaskDboInclude? include, _i3.ProjectTaskDboInclude? include,
}) { }) {
final args = { final args = {
'where': where, 'where': where,
@ -1546,7 +1546,7 @@ class TaskDboDelegate {
}; };
final query = _i1.serializeJsonQuery( final query = _i1.serializeJsonQuery(
args: args, args: args,
modelName: 'TaskDbo', modelName: 'ProjectTaskDbo',
action: _i1.JsonQueryAction.findUniqueOrThrow, action: _i1.JsonQueryAction.findUniqueOrThrow,
datamodel: PrismaClient.datamodel, datamodel: PrismaClient.datamodel,
); );
@ -1555,24 +1555,26 @@ class TaskDboDelegate {
headers: _client.$transaction.headers, headers: _client.$transaction.headers,
transaction: _client.$transaction.transaction, transaction: _client.$transaction.transaction,
); );
return _i1.ActionClient<_i2.TaskDbo>( return _i1.ActionClient<_i2.ProjectTaskDbo>(
action: 'findUniqueTaskDboOrThrow', action: 'findUniqueProjectTaskDboOrThrow',
result: result, result: result,
factory: (e) => _i2.TaskDbo.fromJson(e), factory: (e) => _i2.ProjectTaskDbo.fromJson(e),
); );
} }
_i1.ActionClient<_i2.TaskDbo?> findFirst({ _i1.ActionClient<_i2.ProjectTaskDbo?> findFirst({
_i3.TaskDboWhereInput? where, _i3.ProjectTaskDboWhereInput? where,
_i1.PrismaUnion<Iterable<_i3.TaskDboOrderByWithRelationInput>, _i1.PrismaUnion<Iterable<_i3.ProjectTaskDboOrderByWithRelationInput>,
_i3.TaskDboOrderByWithRelationInput>? _i3.ProjectTaskDboOrderByWithRelationInput>?
orderBy, orderBy,
_i3.TaskDboWhereUniqueInput? cursor, _i3.ProjectTaskDboWhereUniqueInput? cursor,
int? take, int? take,
int? skip, int? skip,
_i1.PrismaUnion<_i3.TaskDboScalar, Iterable<_i3.TaskDboScalar>>? distinct, _i1.PrismaUnion<_i3.ProjectTaskDboScalar,
_i3.TaskDboSelect? select, Iterable<_i3.ProjectTaskDboScalar>>?
_i3.TaskDboInclude? include, distinct,
_i3.ProjectTaskDboSelect? select,
_i3.ProjectTaskDboInclude? include,
}) { }) {
final args = { final args = {
'where': where, 'where': where,
@ -1586,7 +1588,7 @@ class TaskDboDelegate {
}; };
final query = _i1.serializeJsonQuery( final query = _i1.serializeJsonQuery(
args: args, args: args,
modelName: 'TaskDbo', modelName: 'ProjectTaskDbo',
action: _i1.JsonQueryAction.findFirst, action: _i1.JsonQueryAction.findFirst,
datamodel: PrismaClient.datamodel, datamodel: PrismaClient.datamodel,
); );
@ -1595,24 +1597,26 @@ class TaskDboDelegate {
headers: _client.$transaction.headers, headers: _client.$transaction.headers,
transaction: _client.$transaction.transaction, transaction: _client.$transaction.transaction,
); );
return _i1.ActionClient<_i2.TaskDbo?>( return _i1.ActionClient<_i2.ProjectTaskDbo?>(
action: 'findFirstTaskDbo', action: 'findFirstProjectTaskDbo',
result: result, 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({ _i1.ActionClient<_i2.ProjectTaskDbo> findFirstOrThrow({
_i3.TaskDboWhereInput? where, _i3.ProjectTaskDboWhereInput? where,
_i1.PrismaUnion<Iterable<_i3.TaskDboOrderByWithRelationInput>, _i1.PrismaUnion<Iterable<_i3.ProjectTaskDboOrderByWithRelationInput>,
_i3.TaskDboOrderByWithRelationInput>? _i3.ProjectTaskDboOrderByWithRelationInput>?
orderBy, orderBy,
_i3.TaskDboWhereUniqueInput? cursor, _i3.ProjectTaskDboWhereUniqueInput? cursor,
int? take, int? take,
int? skip, int? skip,
_i1.PrismaUnion<_i3.TaskDboScalar, Iterable<_i3.TaskDboScalar>>? distinct, _i1.PrismaUnion<_i3.ProjectTaskDboScalar,
_i3.TaskDboSelect? select, Iterable<_i3.ProjectTaskDboScalar>>?
_i3.TaskDboInclude? include, distinct,
_i3.ProjectTaskDboSelect? select,
_i3.ProjectTaskDboInclude? include,
}) { }) {
final args = { final args = {
'where': where, 'where': where,
@ -1626,7 +1630,7 @@ class TaskDboDelegate {
}; };
final query = _i1.serializeJsonQuery( final query = _i1.serializeJsonQuery(
args: args, args: args,
modelName: 'TaskDbo', modelName: 'ProjectTaskDbo',
action: _i1.JsonQueryAction.findFirstOrThrow, action: _i1.JsonQueryAction.findFirstOrThrow,
datamodel: PrismaClient.datamodel, datamodel: PrismaClient.datamodel,
); );
@ -1635,24 +1639,26 @@ class TaskDboDelegate {
headers: _client.$transaction.headers, headers: _client.$transaction.headers,
transaction: _client.$transaction.transaction, transaction: _client.$transaction.transaction,
); );
return _i1.ActionClient<_i2.TaskDbo>( return _i1.ActionClient<_i2.ProjectTaskDbo>(
action: 'findFirstTaskDboOrThrow', action: 'findFirstProjectTaskDboOrThrow',
result: result, result: result,
factory: (e) => _i2.TaskDbo.fromJson(e), factory: (e) => _i2.ProjectTaskDbo.fromJson(e),
); );
} }
_i1.ActionClient<Iterable<_i2.TaskDbo>> findMany({ _i1.ActionClient<Iterable<_i2.ProjectTaskDbo>> findMany({
_i3.TaskDboWhereInput? where, _i3.ProjectTaskDboWhereInput? where,
_i1.PrismaUnion<Iterable<_i3.TaskDboOrderByWithRelationInput>, _i1.PrismaUnion<Iterable<_i3.ProjectTaskDboOrderByWithRelationInput>,
_i3.TaskDboOrderByWithRelationInput>? _i3.ProjectTaskDboOrderByWithRelationInput>?
orderBy, orderBy,
_i3.TaskDboWhereUniqueInput? cursor, _i3.ProjectTaskDboWhereUniqueInput? cursor,
int? take, int? take,
int? skip, int? skip,
_i1.PrismaUnion<_i3.TaskDboScalar, Iterable<_i3.TaskDboScalar>>? distinct, _i1.PrismaUnion<_i3.ProjectTaskDboScalar,
_i3.TaskDboSelect? select, Iterable<_i3.ProjectTaskDboScalar>>?
_i3.TaskDboInclude? include, distinct,
_i3.ProjectTaskDboSelect? select,
_i3.ProjectTaskDboInclude? include,
}) { }) {
final args = { final args = {
'where': where, 'where': where,
@ -1666,7 +1672,7 @@ class TaskDboDelegate {
}; };
final query = _i1.serializeJsonQuery( final query = _i1.serializeJsonQuery(
args: args, args: args,
modelName: 'TaskDbo', modelName: 'ProjectTaskDbo',
action: _i1.JsonQueryAction.findMany, action: _i1.JsonQueryAction.findMany,
datamodel: PrismaClient.datamodel, datamodel: PrismaClient.datamodel,
); );
@ -1675,20 +1681,20 @@ class TaskDboDelegate {
headers: _client.$transaction.headers, headers: _client.$transaction.headers,
transaction: _client.$transaction.transaction, transaction: _client.$transaction.transaction,
); );
return _i1.ActionClient<Iterable<_i2.TaskDbo>>( return _i1.ActionClient<Iterable<_i2.ProjectTaskDbo>>(
action: 'findManyTaskDbo', action: 'findManyProjectTaskDbo',
result: result, result: result,
factory: (values) => 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({ _i1.ActionClient<_i2.ProjectTaskDbo> create({
required _i1 required _i1.PrismaUnion<_i3.ProjectTaskDboCreateInput,
.PrismaUnion<_i3.TaskDboCreateInput, _i3.TaskDboUncheckedCreateInput> _i3.ProjectTaskDboUncheckedCreateInput>
data, data,
_i3.TaskDboSelect? select, _i3.ProjectTaskDboSelect? select,
_i3.TaskDboInclude? include, _i3.ProjectTaskDboInclude? include,
}) { }) {
final args = { final args = {
'data': data, 'data': data,
@ -1697,7 +1703,7 @@ class TaskDboDelegate {
}; };
final query = _i1.serializeJsonQuery( final query = _i1.serializeJsonQuery(
args: args, args: args,
modelName: 'TaskDbo', modelName: 'ProjectTaskDbo',
action: _i1.JsonQueryAction.createOne, action: _i1.JsonQueryAction.createOne,
datamodel: PrismaClient.datamodel, datamodel: PrismaClient.datamodel,
); );
@ -1706,16 +1712,16 @@ class TaskDboDelegate {
headers: _client.$transaction.headers, headers: _client.$transaction.headers,
transaction: _client.$transaction.transaction, transaction: _client.$transaction.transaction,
); );
return _i1.ActionClient<_i2.TaskDbo>( return _i1.ActionClient<_i2.ProjectTaskDbo>(
action: 'createOneTaskDbo', action: 'createOneProjectTaskDbo',
result: result, result: result,
factory: (e) => _i2.TaskDbo.fromJson(e), factory: (e) => _i2.ProjectTaskDbo.fromJson(e),
); );
} }
_i1.ActionClient<_i3.AffectedRowsOutput> createMany({ _i1.ActionClient<_i3.AffectedRowsOutput> createMany({
required _i1.PrismaUnion<_i3.TaskDboCreateManyInput, required _i1.PrismaUnion<_i3.ProjectTaskDboCreateManyInput,
Iterable<_i3.TaskDboCreateManyInput>> Iterable<_i3.ProjectTaskDboCreateManyInput>>
data, data,
bool? skipDuplicates, bool? skipDuplicates,
}) { }) {
@ -1725,7 +1731,7 @@ class TaskDboDelegate {
}; };
final query = _i1.serializeJsonQuery( final query = _i1.serializeJsonQuery(
args: args, args: args,
modelName: 'TaskDbo', modelName: 'ProjectTaskDbo',
action: _i1.JsonQueryAction.createMany, action: _i1.JsonQueryAction.createMany,
datamodel: PrismaClient.datamodel, datamodel: PrismaClient.datamodel,
); );
@ -1735,20 +1741,20 @@ class TaskDboDelegate {
transaction: _client.$transaction.transaction, transaction: _client.$transaction.transaction,
); );
return _i1.ActionClient<_i3.AffectedRowsOutput>( return _i1.ActionClient<_i3.AffectedRowsOutput>(
action: 'createManyTaskDbo', action: 'createManyProjectTaskDbo',
result: result, result: result,
factory: (e) => _i3.AffectedRowsOutput.fromJson(e), factory: (e) => _i3.AffectedRowsOutput.fromJson(e),
); );
} }
_i1.ActionClient<Iterable<_i2.CreateManyTaskDboAndReturnOutputType>> _i1.ActionClient<Iterable<_i2.CreateManyProjectTaskDboAndReturnOutputType>>
createManyAndReturn({ createManyAndReturn({
required _i1.PrismaUnion<_i3.TaskDboCreateManyInput, required _i1.PrismaUnion<_i3.ProjectTaskDboCreateManyInput,
Iterable<_i3.TaskDboCreateManyInput>> Iterable<_i3.ProjectTaskDboCreateManyInput>>
data, data,
bool? skipDuplicates, bool? skipDuplicates,
_i3.CreateManyTaskDboAndReturnOutputTypeSelect? select, _i3.CreateManyProjectTaskDboAndReturnOutputTypeSelect? select,
_i3.CreateManyTaskDboAndReturnOutputTypeInclude? include, _i3.CreateManyProjectTaskDboAndReturnOutputTypeInclude? include,
}) { }) {
final args = { final args = {
'data': data, 'data': data,
@ -1758,7 +1764,7 @@ class TaskDboDelegate {
}; };
final query = _i1.serializeJsonQuery( final query = _i1.serializeJsonQuery(
args: args, args: args,
modelName: 'TaskDbo', modelName: 'ProjectTaskDbo',
action: _i1.JsonQueryAction.createManyAndReturn, action: _i1.JsonQueryAction.createManyAndReturn,
datamodel: PrismaClient.datamodel, datamodel: PrismaClient.datamodel,
); );
@ -1767,21 +1773,22 @@ class TaskDboDelegate {
headers: _client.$transaction.headers, headers: _client.$transaction.headers,
transaction: _client.$transaction.transaction, transaction: _client.$transaction.transaction,
); );
return _i1.ActionClient<Iterable<_i2.CreateManyTaskDboAndReturnOutputType>>( return _i1.ActionClient<
action: 'createManyTaskDboAndReturn', Iterable<_i2.CreateManyProjectTaskDboAndReturnOutputType>>(
action: 'createManyProjectTaskDboAndReturn',
result: result, result: result,
factory: (values) => (values as Iterable) factory: (values) => (values as Iterable).map(
.map((e) => _i2.CreateManyTaskDboAndReturnOutputType.fromJson(e)), (e) => _i2.CreateManyProjectTaskDboAndReturnOutputType.fromJson(e)),
); );
} }
_i1.ActionClient<_i2.TaskDbo?> update({ _i1.ActionClient<_i2.ProjectTaskDbo?> update({
required _i1 required _i1.PrismaUnion<_i3.ProjectTaskDboUpdateInput,
.PrismaUnion<_i3.TaskDboUpdateInput, _i3.TaskDboUncheckedUpdateInput> _i3.ProjectTaskDboUncheckedUpdateInput>
data, data,
required _i3.TaskDboWhereUniqueInput where, required _i3.ProjectTaskDboWhereUniqueInput where,
_i3.TaskDboSelect? select, _i3.ProjectTaskDboSelect? select,
_i3.TaskDboInclude? include, _i3.ProjectTaskDboInclude? include,
}) { }) {
final args = { final args = {
'data': data, 'data': data,
@ -1791,7 +1798,7 @@ class TaskDboDelegate {
}; };
final query = _i1.serializeJsonQuery( final query = _i1.serializeJsonQuery(
args: args, args: args,
modelName: 'TaskDbo', modelName: 'ProjectTaskDbo',
action: _i1.JsonQueryAction.updateOne, action: _i1.JsonQueryAction.updateOne,
datamodel: PrismaClient.datamodel, datamodel: PrismaClient.datamodel,
); );
@ -1800,18 +1807,18 @@ class TaskDboDelegate {
headers: _client.$transaction.headers, headers: _client.$transaction.headers,
transaction: _client.$transaction.transaction, transaction: _client.$transaction.transaction,
); );
return _i1.ActionClient<_i2.TaskDbo?>( return _i1.ActionClient<_i2.ProjectTaskDbo?>(
action: 'updateOneTaskDbo', action: 'updateOneProjectTaskDbo',
result: result, 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({ _i1.ActionClient<_i3.AffectedRowsOutput> updateMany({
required _i1.PrismaUnion<_i3.TaskDboUpdateManyMutationInput, required _i1.PrismaUnion<_i3.ProjectTaskDboUpdateManyMutationInput,
_i3.TaskDboUncheckedUpdateManyInput> _i3.ProjectTaskDboUncheckedUpdateManyInput>
data, data,
_i3.TaskDboWhereInput? where, _i3.ProjectTaskDboWhereInput? where,
}) { }) {
final args = { final args = {
'data': data, 'data': data,
@ -1819,7 +1826,7 @@ class TaskDboDelegate {
}; };
final query = _i1.serializeJsonQuery( final query = _i1.serializeJsonQuery(
args: args, args: args,
modelName: 'TaskDbo', modelName: 'ProjectTaskDbo',
action: _i1.JsonQueryAction.updateMany, action: _i1.JsonQueryAction.updateMany,
datamodel: PrismaClient.datamodel, datamodel: PrismaClient.datamodel,
); );
@ -1829,22 +1836,22 @@ class TaskDboDelegate {
transaction: _client.$transaction.transaction, transaction: _client.$transaction.transaction,
); );
return _i1.ActionClient<_i3.AffectedRowsOutput>( return _i1.ActionClient<_i3.AffectedRowsOutput>(
action: 'updateManyTaskDbo', action: 'updateManyProjectTaskDbo',
result: result, result: result,
factory: (e) => _i3.AffectedRowsOutput.fromJson(e), factory: (e) => _i3.AffectedRowsOutput.fromJson(e),
); );
} }
_i1.ActionClient<_i2.TaskDbo> upsert({ _i1.ActionClient<_i2.ProjectTaskDbo> upsert({
required _i3.TaskDboWhereUniqueInput where, required _i3.ProjectTaskDboWhereUniqueInput where,
required _i1 required _i1.PrismaUnion<_i3.ProjectTaskDboCreateInput,
.PrismaUnion<_i3.TaskDboCreateInput, _i3.TaskDboUncheckedCreateInput> _i3.ProjectTaskDboUncheckedCreateInput>
create, create,
required _i1 required _i1.PrismaUnion<_i3.ProjectTaskDboUpdateInput,
.PrismaUnion<_i3.TaskDboUpdateInput, _i3.TaskDboUncheckedUpdateInput> _i3.ProjectTaskDboUncheckedUpdateInput>
update, update,
_i3.TaskDboSelect? select, _i3.ProjectTaskDboSelect? select,
_i3.TaskDboInclude? include, _i3.ProjectTaskDboInclude? include,
}) { }) {
final args = { final args = {
'where': where, 'where': where,
@ -1855,7 +1862,7 @@ class TaskDboDelegate {
}; };
final query = _i1.serializeJsonQuery( final query = _i1.serializeJsonQuery(
args: args, args: args,
modelName: 'TaskDbo', modelName: 'ProjectTaskDbo',
action: _i1.JsonQueryAction.upsertOne, action: _i1.JsonQueryAction.upsertOne,
datamodel: PrismaClient.datamodel, datamodel: PrismaClient.datamodel,
); );
@ -1864,17 +1871,17 @@ class TaskDboDelegate {
headers: _client.$transaction.headers, headers: _client.$transaction.headers,
transaction: _client.$transaction.transaction, transaction: _client.$transaction.transaction,
); );
return _i1.ActionClient<_i2.TaskDbo>( return _i1.ActionClient<_i2.ProjectTaskDbo>(
action: 'upsertOneTaskDbo', action: 'upsertOneProjectTaskDbo',
result: result, result: result,
factory: (e) => _i2.TaskDbo.fromJson(e), factory: (e) => _i2.ProjectTaskDbo.fromJson(e),
); );
} }
_i1.ActionClient<_i2.TaskDbo?> delete({ _i1.ActionClient<_i2.ProjectTaskDbo?> delete({
required _i3.TaskDboWhereUniqueInput where, required _i3.ProjectTaskDboWhereUniqueInput where,
_i3.TaskDboSelect? select, _i3.ProjectTaskDboSelect? select,
_i3.TaskDboInclude? include, _i3.ProjectTaskDboInclude? include,
}) { }) {
final args = { final args = {
'where': where, 'where': where,
@ -1883,7 +1890,7 @@ class TaskDboDelegate {
}; };
final query = _i1.serializeJsonQuery( final query = _i1.serializeJsonQuery(
args: args, args: args,
modelName: 'TaskDbo', modelName: 'ProjectTaskDbo',
action: _i1.JsonQueryAction.deleteOne, action: _i1.JsonQueryAction.deleteOne,
datamodel: PrismaClient.datamodel, datamodel: PrismaClient.datamodel,
); );
@ -1892,19 +1899,19 @@ class TaskDboDelegate {
headers: _client.$transaction.headers, headers: _client.$transaction.headers,
transaction: _client.$transaction.transaction, transaction: _client.$transaction.transaction,
); );
return _i1.ActionClient<_i2.TaskDbo?>( return _i1.ActionClient<_i2.ProjectTaskDbo?>(
action: 'deleteOneTaskDbo', action: 'deleteOneProjectTaskDbo',
result: result, 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( _i1.ActionClient<_i3.AffectedRowsOutput> deleteMany(
{_i3.TaskDboWhereInput? where}) { {_i3.ProjectTaskDboWhereInput? where}) {
final args = {'where': where}; final args = {'where': where};
final query = _i1.serializeJsonQuery( final query = _i1.serializeJsonQuery(
args: args, args: args,
modelName: 'TaskDbo', modelName: 'ProjectTaskDbo',
action: _i1.JsonQueryAction.deleteMany, action: _i1.JsonQueryAction.deleteMany,
datamodel: PrismaClient.datamodel, datamodel: PrismaClient.datamodel,
); );
@ -1914,22 +1921,24 @@ class TaskDboDelegate {
transaction: _client.$transaction.transaction, transaction: _client.$transaction.transaction,
); );
return _i1.ActionClient<_i3.AffectedRowsOutput>( return _i1.ActionClient<_i3.AffectedRowsOutput>(
action: 'deleteManyTaskDbo', action: 'deleteManyProjectTaskDbo',
result: result, result: result,
factory: (e) => _i3.AffectedRowsOutput.fromJson(e), factory: (e) => _i3.AffectedRowsOutput.fromJson(e),
); );
} }
_i1.ActionClient<Iterable<_i3.TaskDboGroupByOutputType>> groupBy({ _i1.ActionClient<Iterable<_i3.ProjectTaskDboGroupByOutputType>> groupBy({
_i3.TaskDboWhereInput? where, _i3.ProjectTaskDboWhereInput? where,
_i1.PrismaUnion<Iterable<_i3.TaskDboOrderByWithAggregationInput>, _i1.PrismaUnion<Iterable<_i3.ProjectTaskDboOrderByWithAggregationInput>,
_i3.TaskDboOrderByWithAggregationInput>? _i3.ProjectTaskDboOrderByWithAggregationInput>?
orderBy, orderBy,
required _i1.PrismaUnion<Iterable<_i3.TaskDboScalar>, _i3.TaskDboScalar> by, required _i1.PrismaUnion<Iterable<_i3.ProjectTaskDboScalar>,
_i3.TaskDboScalarWhereWithAggregatesInput? having, _i3.ProjectTaskDboScalar>
by,
_i3.ProjectTaskDboScalarWhereWithAggregatesInput? having,
int? take, int? take,
int? skip, int? skip,
_i3.TaskDboGroupByOutputTypeSelect? select, _i3.ProjectTaskDboGroupByOutputTypeSelect? select,
}) { }) {
final args = { final args = {
'where': where, 'where': where,
@ -1942,7 +1951,7 @@ class TaskDboDelegate {
}; };
final query = _i1.serializeJsonQuery( final query = _i1.serializeJsonQuery(
args: args, args: args,
modelName: 'TaskDbo', modelName: 'ProjectTaskDbo',
action: _i1.JsonQueryAction.groupBy, action: _i1.JsonQueryAction.groupBy,
datamodel: PrismaClient.datamodel, datamodel: PrismaClient.datamodel,
); );
@ -1951,23 +1960,23 @@ class TaskDboDelegate {
headers: _client.$transaction.headers, headers: _client.$transaction.headers,
transaction: _client.$transaction.transaction, transaction: _client.$transaction.transaction,
); );
return _i1.ActionClient<Iterable<_i3.TaskDboGroupByOutputType>>( return _i1.ActionClient<Iterable<_i3.ProjectTaskDboGroupByOutputType>>(
action: 'groupByTaskDbo', action: 'groupByProjectTaskDbo',
result: result, result: result,
factory: (values) => (values as Iterable) factory: (values) => (values as Iterable)
.map((e) => _i3.TaskDboGroupByOutputType.fromJson(e)), .map((e) => _i3.ProjectTaskDboGroupByOutputType.fromJson(e)),
); );
} }
_i1.ActionClient<_i3.AggregateTaskDbo> aggregate({ _i1.ActionClient<_i3.AggregateProjectTaskDbo> aggregate({
_i3.TaskDboWhereInput? where, _i3.ProjectTaskDboWhereInput? where,
_i1.PrismaUnion<Iterable<_i3.TaskDboOrderByWithRelationInput>, _i1.PrismaUnion<Iterable<_i3.ProjectTaskDboOrderByWithRelationInput>,
_i3.TaskDboOrderByWithRelationInput>? _i3.ProjectTaskDboOrderByWithRelationInput>?
orderBy, orderBy,
_i3.TaskDboWhereUniqueInput? cursor, _i3.ProjectTaskDboWhereUniqueInput? cursor,
int? take, int? take,
int? skip, int? skip,
_i3.AggregateTaskDboSelect? select, _i3.AggregateProjectTaskDboSelect? select,
}) { }) {
final args = { final args = {
'where': where, 'where': where,
@ -1979,7 +1988,7 @@ class TaskDboDelegate {
}; };
final query = _i1.serializeJsonQuery( final query = _i1.serializeJsonQuery(
args: args, args: args,
modelName: 'TaskDbo', modelName: 'ProjectTaskDbo',
action: _i1.JsonQueryAction.aggregate, action: _i1.JsonQueryAction.aggregate,
datamodel: PrismaClient.datamodel, datamodel: PrismaClient.datamodel,
); );
@ -1988,10 +1997,10 @@ class TaskDboDelegate {
headers: _client.$transaction.headers, headers: _client.$transaction.headers,
transaction: _client.$transaction.transaction, transaction: _client.$transaction.transaction,
); );
return _i1.ActionClient<_i3.AggregateTaskDbo>( return _i1.ActionClient<_i3.AggregateProjectTaskDbo>(
action: 'aggregateTaskDbo', action: 'aggregateProjectTaskDbo',
result: result, result: result,
factory: (e) => _i3.AggregateTaskDbo.fromJson(e), factory: (e) => _i3.AggregateProjectTaskDbo.fromJson(e),
); );
} }
} }
@ -2219,9 +2228,9 @@ class PrismaClient extends _i1.BasePrismaClient<PrismaClient> {
'isId': false, 'isId': false,
'isReadOnly': false, 'isReadOnly': false,
'hasDefaultValue': false, 'hasDefaultValue': false,
'type': 'TaskDbo', 'type': 'ProjectTaskDbo',
'nativeType': null, 'nativeType': null,
'relationName': 'ProjectDboToTaskDbo', 'relationName': 'ProjectDboToProjectTaskDbo',
'relationFromFields': [], 'relationFromFields': [],
'relationToFields': [], 'relationToFields': [],
'isGenerated': false, 'isGenerated': false,
@ -2479,7 +2488,7 @@ class PrismaClient extends _i1.BasePrismaClient<PrismaClient> {
'isGenerated': false, 'isGenerated': false,
}, },
{ {
'name': 'TaskDbo', 'name': 'ProjectTaskDbo',
'dbName': null, 'dbName': null,
'schema': null, 'schema': null,
'fields': [ 'fields': [
@ -2540,7 +2549,7 @@ class PrismaClient extends _i1.BasePrismaClient<PrismaClient> {
'hasDefaultValue': false, 'hasDefaultValue': false,
'type': 'ProjectDbo', 'type': 'ProjectDbo',
'nativeType': null, 'nativeType': null,
'relationName': 'ProjectDboToTaskDbo', 'relationName': 'ProjectDboToProjectTaskDbo',
'relationFromFields': ['projectId'], 'relationFromFields': ['projectId'],
'relationToFields': ['id'], 'relationToFields': ['id'],
'isGenerated': false, 'isGenerated': false,
@ -2634,7 +2643,7 @@ class PrismaClient extends _i1.BasePrismaClient<PrismaClient> {
], ],
}, },
{ {
'model': 'TaskDbo', 'model': 'ProjectTaskDbo',
'type': 'id', 'type': 'id',
'isDefinedOnField': true, 'isDefinedOnField': true,
'fields': [ 'fields': [
@ -2671,7 +2680,7 @@ class PrismaClient extends _i1.BasePrismaClient<PrismaClient> {
@override @override
get $engine => _engine ??= _i5.BinaryEngine( get $engine => _engine ??= _i5.BinaryEngine(
schema: 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 { datasources: const {
'db': _i1.Datasource( 'db': _i1.Datasource(
_i1.DatasourceType.environment, _i1.DatasourceType.environment,
@ -2690,5 +2699,5 @@ class PrismaClient extends _i1.BasePrismaClient<PrismaClient> {
TimeEntryDboDelegate get timeEntryDbo => TimeEntryDboDelegate._(this); TimeEntryDboDelegate get timeEntryDbo => TimeEntryDboDelegate._(this);
TaskDboDelegate get taskDbo => TaskDboDelegate._(this); ProjectTaskDboDelegate get projectTaskDbo => ProjectTaskDboDelegate._(this);
} }

View File

@ -2,8 +2,8 @@
import 'model.dart' as _i1; import 'model.dart' as _i1;
import 'prisma.dart' as _i2; import 'prisma.dart' as _i2;
class TaskDbo { class ProjectTaskDbo {
const TaskDbo({ const ProjectTaskDbo({
this.id, this.id,
this.name, this.name,
this.description, this.description,
@ -13,7 +13,7 @@ class TaskDbo {
this.project, this.project,
}); });
factory TaskDbo.fromJson(Map json) => TaskDbo( factory ProjectTaskDbo.fromJson(Map json) => ProjectTaskDbo(
id: json['id'], id: json['id'],
name: json['name'], name: json['name'],
description: json['description'], description: json['description'],
@ -169,7 +169,7 @@ class ProjectDbo {
_ => json['updatedAt'] _ => json['updatedAt']
}, },
tasks: (json['tasks'] as Iterable?) tasks: (json['tasks'] as Iterable?)
?.map((json) => _i1.TaskDbo.fromJson(json)), ?.map((json) => _i1.ProjectTaskDbo.fromJson(json)),
timeEntries: (json['timeEntries'] as Iterable?) timeEntries: (json['timeEntries'] as Iterable?)
?.map((json) => _i1.TimeEntryDbo.fromJson(json)), ?.map((json) => _i1.TimeEntryDbo.fromJson(json)),
user: json['user'] is Map ? _i1.UserDbo.fromJson(json['user']) : null, user: json['user'] is Map ? _i1.UserDbo.fromJson(json['user']) : null,
@ -192,7 +192,7 @@ class ProjectDbo {
final DateTime? updatedAt; final DateTime? updatedAt;
final Iterable<_i1.TaskDbo>? tasks; final Iterable<_i1.ProjectTaskDbo>? tasks;
final Iterable<_i1.TimeEntryDbo>? timeEntries; final Iterable<_i1.TimeEntryDbo>? timeEntries;
@ -473,8 +473,8 @@ class CreateManyTimeEntryDboAndReturnOutputType {
}; };
} }
class CreateManyTaskDboAndReturnOutputType { class CreateManyProjectTaskDboAndReturnOutputType {
const CreateManyTaskDboAndReturnOutputType({ const CreateManyProjectTaskDboAndReturnOutputType({
this.id, this.id,
this.name, this.name,
this.description, this.description,
@ -484,8 +484,8 @@ class CreateManyTaskDboAndReturnOutputType {
this.project, this.project,
}); });
factory CreateManyTaskDboAndReturnOutputType.fromJson(Map json) => factory CreateManyProjectTaskDboAndReturnOutputType.fromJson(Map json) =>
CreateManyTaskDboAndReturnOutputType( CreateManyProjectTaskDboAndReturnOutputType(
id: json['id'], id: json['id'],
name: json['name'], name: json['name'],
description: json['description'], description: json['description'],

File diff suppressed because it is too large Load Diff

View File

@ -7,18 +7,6 @@ import 'package:fpdart/fpdart.dart';
import 'package:orm/orm.dart'; import 'package:orm/orm.dart';
class ProjectDboMapper { class ProjectDboMapper {
TaskEither<IError, ProjectDbo> 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<IError, Project> fromDbo(ProjectDbo dbo) { TaskEither<IError, Project> fromDbo(ProjectDbo dbo) {
return TaskEither.of(Project( return TaskEither.of(Project(
id: dbo.id!, id: dbo.id!,
@ -31,9 +19,14 @@ class ProjectDboMapper {
)); ));
} }
TaskEither<IError, List<Project>> listFrom(Iterable<ProjectDbo> dbos) {
return TaskEither.traverseList(dbos.toList(), fromDbo);
}
TaskEither<IError, ProjectDboCreateInput> fromCreatetoDbo( TaskEither<IError, ProjectDboCreateInput> fromCreatetoDbo(
ProjectCreate project) { ProjectCreate project) {
return TaskEither.of(ProjectDboCreateInput( return TaskEither.of(ProjectDboCreateInput(
id: project.id,
name: project.name, name: project.name,
description: project.description.let(PrismaUnion.$1), description: project.description.let(PrismaUnion.$1),
clientId: project.clientId.let(PrismaUnion.$1), clientId: project.clientId.let(PrismaUnion.$1),
@ -57,8 +50,4 @@ class ProjectDboMapper {
), ),
)); ));
} }
TaskEither<IError, List<Project>> listFrom(Iterable<ProjectDbo> dbos) {
return TaskEither.traverseList(dbos.toList(), fromDbo);
}
} }

View File

@ -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<IError, ProjectTask> 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<IError, List<ProjectTask>> listFrom(
Iterable<ProjectTaskDbo> targets) {
return TaskEither.traverseList(targets.toList(), from);
}
TaskEither<IError, ProjectTaskDboCreateInput> 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<IError, ProjectTaskDboUpdateInput> 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,
),
),
),
));
}

View File

@ -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<IError, TimeEntry> 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<IError, List<TimeEntry>> listFrom(Iterable<TimeEntryDbo> targets) {
return TaskEither.traverseList(targets.toList(), from);
}
TaskEither<IError, TimeEntryDboCreateInput> 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<IError, TimeEntryDboUpdateInput> 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,
),
),
),
));
}

View File

@ -1,18 +1,37 @@
import 'package:backend_dart/domain/data/database.dart'; 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/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'; import 'package:backend_dart/infrastructure/persistence/prisma_user_data_source.dart';
class PrismaDatabase implements IDatabase { class PrismaDatabase implements IDatabase {
final prisma = PrismaClient(); final prisma = PrismaClient();
late final PrismaUserDataSource _users; late final PrismaUserDataSource _users;
late final TimeEntryDataSource _timeEntries;
late final ProjectTaskDataSource _tasks;
late final ProjectDataSource _projects;
PrismaDatabase() { PrismaDatabase() {
_users = PrismaUserDataSource(prisma); _users = PrismaUserDataSource(prisma);
_timeEntries = PrismaTimeEntryDataSource(prisma);
_tasks = PrismaProjectTaskDataSource(prisma);
_projects = PrismaProjectDataSource(prisma);
print('Database initialized'); print('Database initialized');
} }
@override @override
get users => _users; get users => _users;
@override @override
get timeEntries => _timeEntries;
@override
get tasks => _tasks;
@override
get projects => _projects;
@override
Future<void> close() { Future<void> close() {
return Future.value(); return Future.value();
} }

View File

@ -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:backend_dart/infrastructure/persistence/mapper/project_dbo_mapper.dart';
import 'package:fpdart/fpdart.dart'; import 'package:fpdart/fpdart.dart';
import 'package:orm/orm.dart'; import 'package:orm/orm.dart';
import 'package:uuid/uuid.dart';
class PrismaProjectDataSource implements ProjectDataSource { class PrismaProjectDataSource implements ProjectDataSource {
final PrismaClient prisma; final PrismaClient prisma;
@ -17,7 +18,7 @@ class PrismaProjectDataSource implements ProjectDataSource {
PrismaProjectDataSource(this.prisma); PrismaProjectDataSource(this.prisma);
@override @override
TaskEither<IError, Project> createProject(ProjectCreate project) { TaskEither<IError, Project> create(ProjectCreate project) {
return mapper return mapper
.fromCreatetoDbo(project) .fromCreatetoDbo(project)
.flatMap((projectDbo) => TaskEither.tryCatch( .flatMap((projectDbo) => TaskEither.tryCatch(
@ -34,7 +35,7 @@ class PrismaProjectDataSource implements ProjectDataSource {
} }
@override @override
TaskEither<IError, Project> findProjectById(String id) { TaskEither<IError, Project> findById(String id) {
return TaskEither<IError, ProjectDbo?>.tryCatch( return TaskEither<IError, ProjectDbo?>.tryCatch(
() async { () async {
final project = await prisma.projectDbo final project = await prisma.projectDbo
@ -51,7 +52,7 @@ class PrismaProjectDataSource implements ProjectDataSource {
} }
@override @override
TaskEither<IError, List<Project>> findProjectsByUserId(String userId) { TaskEither<IError, List<Project>> findByUserId(String userId) {
return TaskEither<IError, Iterable<ProjectDbo>>.tryCatch( return TaskEither<IError, Iterable<ProjectDbo>>.tryCatch(
() async { () async {
final projects = await prisma.projectDbo.findMany( final projects = await prisma.projectDbo.findMany(
@ -69,7 +70,7 @@ class PrismaProjectDataSource implements ProjectDataSource {
} }
@override @override
TaskEither<IError, Project> updateProject(ProjectUpdate project) { TaskEither<IError, Project> update(ProjectUpdate project) {
return mapper return mapper
.fromUpdateToDbo(project) .fromUpdateToDbo(project)
.flatMap( .flatMap(
@ -96,7 +97,7 @@ class PrismaProjectDataSource implements ProjectDataSource {
} }
@override @override
TaskEither<IError, Project> deleteProject(String id) { TaskEither<IError, Project> delete(String id) {
return TaskEither<IError, ProjectDbo?>.tryCatch( return TaskEither<IError, ProjectDbo?>.tryCatch(
() async { () async {
return await prisma.projectDbo return await prisma.projectDbo
@ -117,7 +118,7 @@ class PrismaProjectDataSource implements ProjectDataSource {
} }
@override @override
TaskEither<IError, List<Project>> findAllProjects() { TaskEither<IError, List<Project>> findAll() {
return TaskEither<IError, Iterable<ProjectDbo>>.tryCatch( return TaskEither<IError, Iterable<ProjectDbo>>.tryCatch(
() async => await prisma.projectDbo.findMany(), () async => await prisma.projectDbo.findMany(),
(error, _) => AppError.databaseError( (error, _) => AppError.databaseError(
@ -125,4 +126,23 @@ class PrismaProjectDataSource implements ProjectDataSource {
), ),
).flatMap(mapper.listFrom); ).flatMap(mapper.listFrom);
} }
@override
TaskEither<IError, String> 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()}',
),
);
}
} }

View File

@ -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<IError, ProjectTask> create(ProjectTaskCreate task) =>
mapper.fromCreateTo(task).flatMap(
(taskDbo) => TaskEither<IError, ProjectTaskDbo>.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<IError, ProjectTask> findById(String id) {
return TaskEither<IError, ProjectTaskDbo?>.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<IError, List<ProjectTask>> findByProjectId(String projectId) {
return TaskEither<IError, Iterable<ProjectTaskDbo>>.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<IError, ProjectTask> 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<IError, ProjectTask> delete(String id) {
return TaskEither<IError, ProjectTaskDbo?>.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<IError, List<ProjectTask>> findAll() {
return TaskEither<IError, Iterable<ProjectTaskDbo>>.tryCatch(
() async => await prisma.projectTaskDbo.findMany(),
(error, _) => AppError.databaseError(
message: 'Failed to fetch all project tasks: ${error.toString()}',
),
).flatMap(mapper.listFrom);
}
@override
TaskEither<IError, String> 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()}',
),
);
}
}

View File

@ -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<IError, TimeEntry> create(TimeEntryCreate timeEntry) =>
mapper.fromCreateTo(timeEntry).flatMap(
(timeEntryDbo) => TaskEither<IError, TimeEntryDbo>.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<IError, TimeEntry> findById(String id) {
return TaskEither<IError, TimeEntryDbo?>.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<IError, List<TimeEntry>> findByUserId(String userId) {
return TaskEither<IError, Iterable<TimeEntryDbo>>.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<IError, List<TimeEntry>> findByProjectId(String projectId) {
return TaskEither<IError, Iterable<TimeEntryDbo>>.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<IError, TimeEntry> 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<IError, TimeEntry> delete(String id) {
return TaskEither<IError, TimeEntryDbo?>.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<IError, List<TimeEntry>> findAll() {
return TaskEither<IError, Iterable<TimeEntryDbo>>.tryCatch(
() async => await prisma.timeEntryDbo.findMany(),
(error, _) => AppError.databaseError(
message: 'Failed to fetch all time entries: ${error.toString()}',
),
).flatMap(mapper.listFrom);
}
@override
TaskEither<IError, String> 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()}',
),
);
}
}

View File

@ -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:riverpod/riverpod.dart';
import 'package:shelf/shelf.dart'; import 'package:shelf/shelf.dart';
import 'package:shelf_router/shelf_router.dart'; import 'package:shelf_router/shelf_router.dart';
@ -17,9 +17,15 @@ Router getRouter(ProviderContainer container) {
// Services // Services
final userService = container.read(userServiceProvider); final userService = container.read(userServiceProvider);
final projectService = container.read(projectServiceProvider);
final projectTaskService = container.read(projectTaskServiceProvider);
final timeEntryService = container.read(timeEntryServiceProvider);
// UserService-Router // UserService-Router
router.mount('/users/', userService.router.call); 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; return router;
} }

View File

@ -26,7 +26,7 @@ model ProjectDbo {
name String name String
description String? description String?
clientId String? clientId String?
tasks TaskDbo[] // Beziehung zu Aufgaben tasks ProjectTaskDbo[] // Beziehung zu Aufgaben
timeEntries TimeEntryDbo[] // Beziehung zu Zeiteinträgen timeEntries TimeEntryDbo[] // Beziehung zu Zeiteinträgen
user UserDbo @relation(fields: [userId], references: [id]) user UserDbo @relation(fields: [userId], references: [id])
userId String userId String
@ -49,7 +49,7 @@ model TimeEntryDbo {
} }
// Task Model (optional) // Task Model (optional)
model TaskDbo { model ProjectTaskDbo {
id String @id @default(uuid()) id String @id @default(uuid())
name String name String
description String? description String?