implemented other repos, services, objects ...

This commit is contained in:
2025-01-01 21:36:20 +00:00
parent 6d980a980e
commit 10c72f22c5
51 changed files with 5940 additions and 502 deletions
@@ -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();
}
}
@@ -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();
}
}
@@ -1,4 +1,10 @@
import 'package:backend_dart/application/repository/project_repository_impl.dart';
import 'package:backend_dart/application/repository/project_task_repository_impl.dart';
import 'package:backend_dart/application/repository/time_entry_repository_impl.dart';
import 'package:backend_dart/application/repository/user_repository_impl.dart';
import 'package:backend_dart/domain/repository/project_repository.dart';
import 'package:backend_dart/domain/repository/project_task_repository.dart';
import 'package:backend_dart/domain/repository/time_entry_repository.dart';
import 'package:backend_dart/domain/repository/user_repository.dart';
import 'package:backend_dart/infrastructure/persistence/database_provider.dart';
import 'package:riverpod/riverpod.dart';
@@ -7,3 +13,18 @@ final userRepoProvider = Provider<UserRepository>((ref) {
final database = ref.read(databaseProvider);
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);
});
@@ -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();
}
}
@@ -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);
}
@@ -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;
}
@@ -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,
};
@@ -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);
}
@@ -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;
}
@@ -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,
};
@@ -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);
}
@@ -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;
}
@@ -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,
};
@@ -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,
));
}
@@ -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,
));
}
@@ -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,
));
}
@@ -1,11 +1,9 @@
import 'package:backend_dart/application/service/dto/user_dto.dart';
import 'package:backend_dart/domain/entities/user.dart';
import 'package:backend_dart/domain/interface/error.dart';
import 'package:backend_dart/domain/interface/mapper.dart';
import 'package:fpdart/fpdart.dart';
class UserDtoMapper implements IMapper<User, UserDto> {
@override
class UserDtoMapper {
TaskEither<IError, UserDto> to(User entity) => TaskEither.of(UserDto(
id: entity.id,
name: entity.name,
@@ -13,21 +11,7 @@ class UserDtoMapper implements IMapper<User, UserDto> {
createdAt: entity.createdAt,
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) {
return TaskEither.traverseList(origins.toList(), to);
}
@@ -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);
}
@@ -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;
}
@@ -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);
}
@@ -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;
}
@@ -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);
});
@@ -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);
}
@@ -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;
}
@@ -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);
});