wip, immutable types
This commit is contained in:
parent
97fe0e69d0
commit
0ded723bb9
@ -14,11 +14,11 @@
|
||||
},
|
||||
"extensions": [
|
||||
"ms-azuretools.vscode-docker",
|
||||
|
||||
"ms-vscode.vscode-typescript-next",
|
||||
"dart-code.dart-code",
|
||||
"golang.go",
|
||||
"denoland.vscode-deno"
|
||||
"denoland.vscode-deno",
|
||||
"Prisma.prisma"
|
||||
],
|
||||
"features": {
|
||||
//"docker-in-docker": "latest",
|
||||
|
@ -112,6 +112,9 @@ After deployment, data can be accessed via a webui:
|
||||
bunx prisma studio
|
||||
```
|
||||
|
||||
### Codegen
|
||||
Inside the corresponding backend run: ```bunx prisma generate```
|
||||
|
||||
# Known Issues
|
||||
|
||||
## Hydration issue caused by browser extensions
|
||||
|
29
backend-dart/lib/application/dto/user_dto.dart
Normal file
29
backend-dart/lib/application/dto/user_dto.dart
Normal file
@ -0,0 +1,29 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'user_dto.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class UserDto {
|
||||
final String id;
|
||||
final String name;
|
||||
final String email;
|
||||
|
||||
// Optional: Füge zusätzliche Felder wie Timestamps hinzu
|
||||
final DateTime? createdAt;
|
||||
final DateTime? updatedAt;
|
||||
|
||||
UserDto({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.email,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
});
|
||||
|
||||
/// Factory-Methode zur Deserialisierung von JSON
|
||||
factory UserDto.fromJson(Map<String, dynamic> json) =>
|
||||
_$UserDtoFromJson(json);
|
||||
|
||||
/// Methode zur Serialisierung nach JSON
|
||||
Map<String, dynamic> toJson() => _$UserDtoToJson(this);
|
||||
}
|
27
backend-dart/lib/application/dto/user_dto.g.dart
Normal file
27
backend-dart/lib/application/dto/user_dto.g.dart
Normal file
@ -0,0 +1,27 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'user_dto.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
UserDto _$UserDtoFromJson(Map<String, dynamic> json) => UserDto(
|
||||
id: json['id'] as String,
|
||||
name: json['name'] as String,
|
||||
email: json['email'] as String,
|
||||
createdAt: json['createdAt'] == null
|
||||
? null
|
||||
: DateTime.parse(json['createdAt'] as String),
|
||||
updatedAt: json['updatedAt'] == null
|
||||
? null
|
||||
: DateTime.parse(json['updatedAt'] as String),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$UserDtoToJson(UserDto instance) => <String, dynamic>{
|
||||
'id': instance.id,
|
||||
'name': instance.name,
|
||||
'email': instance.email,
|
||||
'createdAt': instance.createdAt?.toIso8601String(),
|
||||
'updatedAt': instance.updatedAt?.toIso8601String(),
|
||||
};
|
@ -1,13 +1,16 @@
|
||||
class User {
|
||||
final String id;
|
||||
final String name;
|
||||
final String email;
|
||||
final String? password;
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
User({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.email,
|
||||
required this.password,
|
||||
});
|
||||
part 'user.freezed.dart';
|
||||
part 'user.g.dart';
|
||||
|
||||
@freezed
|
||||
class User with _$User {
|
||||
const factory User({
|
||||
required String id,
|
||||
required String name,
|
||||
required String email,
|
||||
String? password,
|
||||
DateTime? createdAt,
|
||||
DateTime? updatedAt,
|
||||
}) = _User;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2,8 +2,8 @@
|
||||
import 'model.dart' as _i1;
|
||||
import 'prisma.dart' as _i2;
|
||||
|
||||
class Task {
|
||||
const Task({
|
||||
class TaskDbo {
|
||||
const TaskDbo({
|
||||
this.id,
|
||||
this.name,
|
||||
this.description,
|
||||
@ -13,7 +13,7 @@ class Task {
|
||||
this.project,
|
||||
});
|
||||
|
||||
factory Task.fromJson(Map json) => Task(
|
||||
factory TaskDbo.fromJson(Map json) => TaskDbo(
|
||||
id: json['id'],
|
||||
name: json['name'],
|
||||
description: json['description'],
|
||||
@ -29,7 +29,7 @@ class Task {
|
||||
_ => json['updatedAt']
|
||||
},
|
||||
project: json['project'] is Map
|
||||
? _i1.Project.fromJson(json['project'])
|
||||
? _i1.ProjectDbo.fromJson(json['project'])
|
||||
: null,
|
||||
);
|
||||
|
||||
@ -45,7 +45,7 @@ class Task {
|
||||
|
||||
final DateTime? updatedAt;
|
||||
|
||||
final _i1.Project? project;
|
||||
final _i1.ProjectDbo? project;
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
@ -58,8 +58,8 @@ class Task {
|
||||
};
|
||||
}
|
||||
|
||||
class TimeEntry {
|
||||
const TimeEntry({
|
||||
class TimeEntryDbo {
|
||||
const TimeEntryDbo({
|
||||
this.id,
|
||||
this.startTime,
|
||||
this.endTime,
|
||||
@ -72,7 +72,7 @@ class TimeEntry {
|
||||
this.project,
|
||||
});
|
||||
|
||||
factory TimeEntry.fromJson(Map json) => TimeEntry(
|
||||
factory TimeEntryDbo.fromJson(Map json) => TimeEntryDbo(
|
||||
id: json['id'],
|
||||
startTime: switch (json['startTime']) {
|
||||
DateTime value => value,
|
||||
@ -97,9 +97,9 @@ class TimeEntry {
|
||||
String value => DateTime.parse(value),
|
||||
_ => json['updatedAt']
|
||||
},
|
||||
user: json['user'] is Map ? _i1.User.fromJson(json['user']) : null,
|
||||
user: json['user'] is Map ? _i1.UserDbo.fromJson(json['user']) : null,
|
||||
project: json['project'] is Map
|
||||
? _i1.Project.fromJson(json['project'])
|
||||
? _i1.ProjectDbo.fromJson(json['project'])
|
||||
: null,
|
||||
);
|
||||
|
||||
@ -119,9 +119,9 @@ class TimeEntry {
|
||||
|
||||
final DateTime? updatedAt;
|
||||
|
||||
final _i1.User? user;
|
||||
final _i1.UserDbo? user;
|
||||
|
||||
final _i1.Project? project;
|
||||
final _i1.ProjectDbo? project;
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
@ -137,8 +137,8 @@ class TimeEntry {
|
||||
};
|
||||
}
|
||||
|
||||
class Project {
|
||||
const Project({
|
||||
class ProjectDbo {
|
||||
const ProjectDbo({
|
||||
this.id,
|
||||
this.name,
|
||||
this.description,
|
||||
@ -152,7 +152,7 @@ class Project {
|
||||
this.$count,
|
||||
});
|
||||
|
||||
factory Project.fromJson(Map json) => Project(
|
||||
factory ProjectDbo.fromJson(Map json) => ProjectDbo(
|
||||
id: json['id'],
|
||||
name: json['name'],
|
||||
description: json['description'],
|
||||
@ -169,12 +169,12 @@ class Project {
|
||||
_ => json['updatedAt']
|
||||
},
|
||||
tasks: (json['tasks'] as Iterable?)
|
||||
?.map((json) => _i1.Task.fromJson(json)),
|
||||
?.map((json) => _i1.TaskDbo.fromJson(json)),
|
||||
timeEntries: (json['timeEntries'] as Iterable?)
|
||||
?.map((json) => _i1.TimeEntry.fromJson(json)),
|
||||
user: json['user'] is Map ? _i1.User.fromJson(json['user']) : null,
|
||||
?.map((json) => _i1.TimeEntryDbo.fromJson(json)),
|
||||
user: json['user'] is Map ? _i1.UserDbo.fromJson(json['user']) : null,
|
||||
$count: json['_count'] is Map
|
||||
? _i2.ProjectCountOutputType.fromJson(json['_count'])
|
||||
? _i2.ProjectDboCountOutputType.fromJson(json['_count'])
|
||||
: null,
|
||||
);
|
||||
|
||||
@ -192,13 +192,13 @@ class Project {
|
||||
|
||||
final DateTime? updatedAt;
|
||||
|
||||
final Iterable<_i1.Task>? tasks;
|
||||
final Iterable<_i1.TaskDbo>? tasks;
|
||||
|
||||
final Iterable<_i1.TimeEntry>? timeEntries;
|
||||
final Iterable<_i1.TimeEntryDbo>? timeEntries;
|
||||
|
||||
final _i1.User? user;
|
||||
final _i1.UserDbo? user;
|
||||
|
||||
final _i2.ProjectCountOutputType? $count;
|
||||
final _i2.ProjectDboCountOutputType? $count;
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
@ -215,8 +215,8 @@ class Project {
|
||||
};
|
||||
}
|
||||
|
||||
class User {
|
||||
const User({
|
||||
class UserDbo {
|
||||
const UserDbo({
|
||||
this.id,
|
||||
this.name,
|
||||
this.email,
|
||||
@ -228,7 +228,7 @@ class User {
|
||||
this.$count,
|
||||
});
|
||||
|
||||
factory User.fromJson(Map json) => User(
|
||||
factory UserDbo.fromJson(Map json) => UserDbo(
|
||||
id: json['id'],
|
||||
name: json['name'],
|
||||
email: json['email'],
|
||||
@ -244,11 +244,11 @@ class User {
|
||||
_ => json['updatedAt']
|
||||
},
|
||||
projects: (json['projects'] as Iterable?)
|
||||
?.map((json) => _i1.Project.fromJson(json)),
|
||||
?.map((json) => _i1.ProjectDbo.fromJson(json)),
|
||||
timeEntries: (json['timeEntries'] as Iterable?)
|
||||
?.map((json) => _i1.TimeEntry.fromJson(json)),
|
||||
?.map((json) => _i1.TimeEntryDbo.fromJson(json)),
|
||||
$count: json['_count'] is Map
|
||||
? _i2.UserCountOutputType.fromJson(json['_count'])
|
||||
? _i2.UserDboCountOutputType.fromJson(json['_count'])
|
||||
: null,
|
||||
);
|
||||
|
||||
@ -264,11 +264,11 @@ class User {
|
||||
|
||||
final DateTime? updatedAt;
|
||||
|
||||
final Iterable<_i1.Project>? projects;
|
||||
final Iterable<_i1.ProjectDbo>? projects;
|
||||
|
||||
final Iterable<_i1.TimeEntry>? timeEntries;
|
||||
final Iterable<_i1.TimeEntryDbo>? timeEntries;
|
||||
|
||||
final _i2.UserCountOutputType? $count;
|
||||
final _i2.UserDboCountOutputType? $count;
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
@ -283,8 +283,8 @@ class User {
|
||||
};
|
||||
}
|
||||
|
||||
class CreateManyUserAndReturnOutputType {
|
||||
const CreateManyUserAndReturnOutputType({
|
||||
class CreateManyUserDboAndReturnOutputType {
|
||||
const CreateManyUserDboAndReturnOutputType({
|
||||
this.id,
|
||||
this.name,
|
||||
this.email,
|
||||
@ -293,8 +293,8 @@ class CreateManyUserAndReturnOutputType {
|
||||
this.updatedAt,
|
||||
});
|
||||
|
||||
factory CreateManyUserAndReturnOutputType.fromJson(Map json) =>
|
||||
CreateManyUserAndReturnOutputType(
|
||||
factory CreateManyUserDboAndReturnOutputType.fromJson(Map json) =>
|
||||
CreateManyUserDboAndReturnOutputType(
|
||||
id: json['id'],
|
||||
name: json['name'],
|
||||
email: json['email'],
|
||||
@ -333,8 +333,8 @@ class CreateManyUserAndReturnOutputType {
|
||||
};
|
||||
}
|
||||
|
||||
class CreateManyProjectAndReturnOutputType {
|
||||
const CreateManyProjectAndReturnOutputType({
|
||||
class CreateManyProjectDboAndReturnOutputType {
|
||||
const CreateManyProjectDboAndReturnOutputType({
|
||||
this.id,
|
||||
this.name,
|
||||
this.description,
|
||||
@ -345,8 +345,8 @@ class CreateManyProjectAndReturnOutputType {
|
||||
this.user,
|
||||
});
|
||||
|
||||
factory CreateManyProjectAndReturnOutputType.fromJson(Map json) =>
|
||||
CreateManyProjectAndReturnOutputType(
|
||||
factory CreateManyProjectDboAndReturnOutputType.fromJson(Map json) =>
|
||||
CreateManyProjectDboAndReturnOutputType(
|
||||
id: json['id'],
|
||||
name: json['name'],
|
||||
description: json['description'],
|
||||
@ -362,7 +362,7 @@ class CreateManyProjectAndReturnOutputType {
|
||||
String value => DateTime.parse(value),
|
||||
_ => json['updatedAt']
|
||||
},
|
||||
user: json['user'] is Map ? _i1.User.fromJson(json['user']) : null,
|
||||
user: json['user'] is Map ? _i1.UserDbo.fromJson(json['user']) : null,
|
||||
);
|
||||
|
||||
final String? id;
|
||||
@ -379,7 +379,7 @@ class CreateManyProjectAndReturnOutputType {
|
||||
|
||||
final DateTime? updatedAt;
|
||||
|
||||
final _i1.User? user;
|
||||
final _i1.UserDbo? user;
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
@ -393,8 +393,8 @@ class CreateManyProjectAndReturnOutputType {
|
||||
};
|
||||
}
|
||||
|
||||
class CreateManyTimeEntryAndReturnOutputType {
|
||||
const CreateManyTimeEntryAndReturnOutputType({
|
||||
class CreateManyTimeEntryDboAndReturnOutputType {
|
||||
const CreateManyTimeEntryDboAndReturnOutputType({
|
||||
this.id,
|
||||
this.startTime,
|
||||
this.endTime,
|
||||
@ -407,8 +407,8 @@ class CreateManyTimeEntryAndReturnOutputType {
|
||||
this.project,
|
||||
});
|
||||
|
||||
factory CreateManyTimeEntryAndReturnOutputType.fromJson(Map json) =>
|
||||
CreateManyTimeEntryAndReturnOutputType(
|
||||
factory CreateManyTimeEntryDboAndReturnOutputType.fromJson(Map json) =>
|
||||
CreateManyTimeEntryDboAndReturnOutputType(
|
||||
id: json['id'],
|
||||
startTime: switch (json['startTime']) {
|
||||
DateTime value => value,
|
||||
@ -433,9 +433,9 @@ class CreateManyTimeEntryAndReturnOutputType {
|
||||
String value => DateTime.parse(value),
|
||||
_ => json['updatedAt']
|
||||
},
|
||||
user: json['user'] is Map ? _i1.User.fromJson(json['user']) : null,
|
||||
user: json['user'] is Map ? _i1.UserDbo.fromJson(json['user']) : null,
|
||||
project: json['project'] is Map
|
||||
? _i1.Project.fromJson(json['project'])
|
||||
? _i1.ProjectDbo.fromJson(json['project'])
|
||||
: null,
|
||||
);
|
||||
|
||||
@ -455,9 +455,9 @@ class CreateManyTimeEntryAndReturnOutputType {
|
||||
|
||||
final DateTime? updatedAt;
|
||||
|
||||
final _i1.User? user;
|
||||
final _i1.UserDbo? user;
|
||||
|
||||
final _i1.Project? project;
|
||||
final _i1.ProjectDbo? project;
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
@ -473,8 +473,8 @@ class CreateManyTimeEntryAndReturnOutputType {
|
||||
};
|
||||
}
|
||||
|
||||
class CreateManyTaskAndReturnOutputType {
|
||||
const CreateManyTaskAndReturnOutputType({
|
||||
class CreateManyTaskDboAndReturnOutputType {
|
||||
const CreateManyTaskDboAndReturnOutputType({
|
||||
this.id,
|
||||
this.name,
|
||||
this.description,
|
||||
@ -484,8 +484,8 @@ class CreateManyTaskAndReturnOutputType {
|
||||
this.project,
|
||||
});
|
||||
|
||||
factory CreateManyTaskAndReturnOutputType.fromJson(Map json) =>
|
||||
CreateManyTaskAndReturnOutputType(
|
||||
factory CreateManyTaskDboAndReturnOutputType.fromJson(Map json) =>
|
||||
CreateManyTaskDboAndReturnOutputType(
|
||||
id: json['id'],
|
||||
name: json['name'],
|
||||
description: json['description'],
|
||||
@ -501,7 +501,7 @@ class CreateManyTaskAndReturnOutputType {
|
||||
_ => json['updatedAt']
|
||||
},
|
||||
project: json['project'] is Map
|
||||
? _i1.Project.fromJson(json['project'])
|
||||
? _i1.ProjectDbo.fromJson(json['project'])
|
||||
: null,
|
||||
);
|
||||
|
||||
@ -517,7 +517,7 @@ class CreateManyTaskAndReturnOutputType {
|
||||
|
||||
final DateTime? updatedAt;
|
||||
|
||||
final _i1.Project? project;
|
||||
final _i1.ProjectDbo? project;
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -14,8 +14,8 @@ class PrismaUserRepository implements UserRepository {
|
||||
if (user.password == null) {
|
||||
throw Exception('Password is required');
|
||||
}
|
||||
prisma.user.create(
|
||||
data: PrismaUnion.$1(UserCreateInput(
|
||||
prisma.userDbo.create(
|
||||
data: PrismaUnion.$1(UserDboCreateInput(
|
||||
id: user.id,
|
||||
name: user.name,
|
||||
email: user.email,
|
||||
@ -25,8 +25,8 @@ class PrismaUserRepository implements UserRepository {
|
||||
|
||||
@override
|
||||
Future<User?> findByEmail(String email) async {
|
||||
final user =
|
||||
await prisma.user.findUnique(where: UserWhereUniqueInput(email: email));
|
||||
final user = await prisma.userDbo
|
||||
.findUnique(where: UserDboWhereUniqueInput(email: email));
|
||||
if (user == null) {
|
||||
return null;
|
||||
}
|
||||
@ -42,7 +42,7 @@ class PrismaUserRepository implements UserRepository {
|
||||
@override
|
||||
Future<User?> findById(String id) async {
|
||||
final user =
|
||||
await prisma.user.findUnique(where: UserWhereUniqueInput(id: id));
|
||||
await prisma.userDbo.findUnique(where: UserDboWhereUniqueInput(id: id));
|
||||
if (user == null) {
|
||||
return null;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,531 +0,0 @@
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'model.dart' as _i1;
|
||||
import 'prisma.dart' as _i2;
|
||||
|
||||
class Task {
|
||||
const Task({
|
||||
this.id,
|
||||
this.name,
|
||||
this.description,
|
||||
this.projectId,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
this.project,
|
||||
});
|
||||
|
||||
factory Task.fromJson(Map json) => Task(
|
||||
id: json['id'],
|
||||
name: json['name'],
|
||||
description: json['description'],
|
||||
projectId: json['projectId'],
|
||||
createdAt: switch (json['createdAt']) {
|
||||
DateTime value => value,
|
||||
String value => DateTime.parse(value),
|
||||
_ => json['createdAt']
|
||||
},
|
||||
updatedAt: switch (json['updatedAt']) {
|
||||
DateTime value => value,
|
||||
String value => DateTime.parse(value),
|
||||
_ => json['updatedAt']
|
||||
},
|
||||
project: json['project'] is Map
|
||||
? _i1.Project.fromJson(json['project'])
|
||||
: null,
|
||||
);
|
||||
|
||||
final String? id;
|
||||
|
||||
final String? name;
|
||||
|
||||
final String? description;
|
||||
|
||||
final String? projectId;
|
||||
|
||||
final DateTime? createdAt;
|
||||
|
||||
final DateTime? updatedAt;
|
||||
|
||||
final _i1.Project? project;
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'name': name,
|
||||
'description': description,
|
||||
'projectId': projectId,
|
||||
'createdAt': createdAt?.toIso8601String(),
|
||||
'updatedAt': updatedAt?.toIso8601String(),
|
||||
'project': project?.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
class TimeEntry {
|
||||
const TimeEntry({
|
||||
this.id,
|
||||
this.startTime,
|
||||
this.endTime,
|
||||
this.description,
|
||||
this.userId,
|
||||
this.projectId,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
this.user,
|
||||
this.project,
|
||||
});
|
||||
|
||||
factory TimeEntry.fromJson(Map json) => TimeEntry(
|
||||
id: json['id'],
|
||||
startTime: switch (json['startTime']) {
|
||||
DateTime value => value,
|
||||
String value => DateTime.parse(value),
|
||||
_ => json['startTime']
|
||||
},
|
||||
endTime: switch (json['endTime']) {
|
||||
DateTime value => value,
|
||||
String value => DateTime.parse(value),
|
||||
_ => json['endTime']
|
||||
},
|
||||
description: json['description'],
|
||||
userId: json['userId'],
|
||||
projectId: json['projectId'],
|
||||
createdAt: switch (json['createdAt']) {
|
||||
DateTime value => value,
|
||||
String value => DateTime.parse(value),
|
||||
_ => json['createdAt']
|
||||
},
|
||||
updatedAt: switch (json['updatedAt']) {
|
||||
DateTime value => value,
|
||||
String value => DateTime.parse(value),
|
||||
_ => json['updatedAt']
|
||||
},
|
||||
user: json['user'] is Map ? _i1.User.fromJson(json['user']) : null,
|
||||
project: json['project'] is Map
|
||||
? _i1.Project.fromJson(json['project'])
|
||||
: null,
|
||||
);
|
||||
|
||||
final String? id;
|
||||
|
||||
final DateTime? startTime;
|
||||
|
||||
final DateTime? endTime;
|
||||
|
||||
final String? description;
|
||||
|
||||
final String? userId;
|
||||
|
||||
final String? projectId;
|
||||
|
||||
final DateTime? createdAt;
|
||||
|
||||
final DateTime? updatedAt;
|
||||
|
||||
final _i1.User? user;
|
||||
|
||||
final _i1.Project? project;
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'startTime': startTime?.toIso8601String(),
|
||||
'endTime': endTime?.toIso8601String(),
|
||||
'description': description,
|
||||
'userId': userId,
|
||||
'projectId': projectId,
|
||||
'createdAt': createdAt?.toIso8601String(),
|
||||
'updatedAt': updatedAt?.toIso8601String(),
|
||||
'user': user?.toJson(),
|
||||
'project': project?.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
class Project {
|
||||
const Project({
|
||||
this.id,
|
||||
this.name,
|
||||
this.description,
|
||||
this.clientId,
|
||||
this.userId,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
this.tasks,
|
||||
this.timeEntries,
|
||||
this.user,
|
||||
this.$count,
|
||||
});
|
||||
|
||||
factory Project.fromJson(Map json) => Project(
|
||||
id: json['id'],
|
||||
name: json['name'],
|
||||
description: json['description'],
|
||||
clientId: json['clientId'],
|
||||
userId: json['userId'],
|
||||
createdAt: switch (json['createdAt']) {
|
||||
DateTime value => value,
|
||||
String value => DateTime.parse(value),
|
||||
_ => json['createdAt']
|
||||
},
|
||||
updatedAt: switch (json['updatedAt']) {
|
||||
DateTime value => value,
|
||||
String value => DateTime.parse(value),
|
||||
_ => json['updatedAt']
|
||||
},
|
||||
tasks: (json['tasks'] as Iterable?)
|
||||
?.map((json) => _i1.Task.fromJson(json)),
|
||||
timeEntries: (json['timeEntries'] as Iterable?)
|
||||
?.map((json) => _i1.TimeEntry.fromJson(json)),
|
||||
user: json['user'] is Map ? _i1.User.fromJson(json['user']) : null,
|
||||
$count: json['_count'] is Map
|
||||
? _i2.ProjectCountOutputType.fromJson(json['_count'])
|
||||
: null,
|
||||
);
|
||||
|
||||
final String? id;
|
||||
|
||||
final String? name;
|
||||
|
||||
final String? description;
|
||||
|
||||
final String? clientId;
|
||||
|
||||
final String? userId;
|
||||
|
||||
final DateTime? createdAt;
|
||||
|
||||
final DateTime? updatedAt;
|
||||
|
||||
final Iterable<_i1.Task>? tasks;
|
||||
|
||||
final Iterable<_i1.TimeEntry>? timeEntries;
|
||||
|
||||
final _i1.User? user;
|
||||
|
||||
final _i2.ProjectCountOutputType? $count;
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'name': name,
|
||||
'description': description,
|
||||
'clientId': clientId,
|
||||
'userId': userId,
|
||||
'createdAt': createdAt?.toIso8601String(),
|
||||
'updatedAt': updatedAt?.toIso8601String(),
|
||||
'tasks': tasks?.map((e) => e.toJson()),
|
||||
'timeEntries': timeEntries?.map((e) => e.toJson()),
|
||||
'user': user?.toJson(),
|
||||
'_count': $count?.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
class User {
|
||||
const User({
|
||||
this.id,
|
||||
this.name,
|
||||
this.email,
|
||||
this.password,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
this.projects,
|
||||
this.timeEntries,
|
||||
this.$count,
|
||||
});
|
||||
|
||||
factory User.fromJson(Map json) => User(
|
||||
id: json['id'],
|
||||
name: json['name'],
|
||||
email: json['email'],
|
||||
password: json['password'],
|
||||
createdAt: switch (json['createdAt']) {
|
||||
DateTime value => value,
|
||||
String value => DateTime.parse(value),
|
||||
_ => json['createdAt']
|
||||
},
|
||||
updatedAt: switch (json['updatedAt']) {
|
||||
DateTime value => value,
|
||||
String value => DateTime.parse(value),
|
||||
_ => json['updatedAt']
|
||||
},
|
||||
projects: (json['projects'] as Iterable?)
|
||||
?.map((json) => _i1.Project.fromJson(json)),
|
||||
timeEntries: (json['timeEntries'] as Iterable?)
|
||||
?.map((json) => _i1.TimeEntry.fromJson(json)),
|
||||
$count: json['_count'] is Map
|
||||
? _i2.UserCountOutputType.fromJson(json['_count'])
|
||||
: null,
|
||||
);
|
||||
|
||||
final String? id;
|
||||
|
||||
final String? name;
|
||||
|
||||
final String? email;
|
||||
|
||||
final String? password;
|
||||
|
||||
final DateTime? createdAt;
|
||||
|
||||
final DateTime? updatedAt;
|
||||
|
||||
final Iterable<_i1.Project>? projects;
|
||||
|
||||
final Iterable<_i1.TimeEntry>? timeEntries;
|
||||
|
||||
final _i2.UserCountOutputType? $count;
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'name': name,
|
||||
'email': email,
|
||||
'password': password,
|
||||
'createdAt': createdAt?.toIso8601String(),
|
||||
'updatedAt': updatedAt?.toIso8601String(),
|
||||
'projects': projects?.map((e) => e.toJson()),
|
||||
'timeEntries': timeEntries?.map((e) => e.toJson()),
|
||||
'_count': $count?.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
class CreateManyUserAndReturnOutputType {
|
||||
const CreateManyUserAndReturnOutputType({
|
||||
this.id,
|
||||
this.name,
|
||||
this.email,
|
||||
this.password,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
});
|
||||
|
||||
factory CreateManyUserAndReturnOutputType.fromJson(Map json) =>
|
||||
CreateManyUserAndReturnOutputType(
|
||||
id: json['id'],
|
||||
name: json['name'],
|
||||
email: json['email'],
|
||||
password: json['password'],
|
||||
createdAt: switch (json['createdAt']) {
|
||||
DateTime value => value,
|
||||
String value => DateTime.parse(value),
|
||||
_ => json['createdAt']
|
||||
},
|
||||
updatedAt: switch (json['updatedAt']) {
|
||||
DateTime value => value,
|
||||
String value => DateTime.parse(value),
|
||||
_ => json['updatedAt']
|
||||
},
|
||||
);
|
||||
|
||||
final String? id;
|
||||
|
||||
final String? name;
|
||||
|
||||
final String? email;
|
||||
|
||||
final String? password;
|
||||
|
||||
final DateTime? createdAt;
|
||||
|
||||
final DateTime? updatedAt;
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'name': name,
|
||||
'email': email,
|
||||
'password': password,
|
||||
'createdAt': createdAt?.toIso8601String(),
|
||||
'updatedAt': updatedAt?.toIso8601String(),
|
||||
};
|
||||
}
|
||||
|
||||
class CreateManyProjectAndReturnOutputType {
|
||||
const CreateManyProjectAndReturnOutputType({
|
||||
this.id,
|
||||
this.name,
|
||||
this.description,
|
||||
this.clientId,
|
||||
this.userId,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
this.user,
|
||||
});
|
||||
|
||||
factory CreateManyProjectAndReturnOutputType.fromJson(Map json) =>
|
||||
CreateManyProjectAndReturnOutputType(
|
||||
id: json['id'],
|
||||
name: json['name'],
|
||||
description: json['description'],
|
||||
clientId: json['clientId'],
|
||||
userId: json['userId'],
|
||||
createdAt: switch (json['createdAt']) {
|
||||
DateTime value => value,
|
||||
String value => DateTime.parse(value),
|
||||
_ => json['createdAt']
|
||||
},
|
||||
updatedAt: switch (json['updatedAt']) {
|
||||
DateTime value => value,
|
||||
String value => DateTime.parse(value),
|
||||
_ => json['updatedAt']
|
||||
},
|
||||
user: json['user'] is Map ? _i1.User.fromJson(json['user']) : null,
|
||||
);
|
||||
|
||||
final String? id;
|
||||
|
||||
final String? name;
|
||||
|
||||
final String? description;
|
||||
|
||||
final String? clientId;
|
||||
|
||||
final String? userId;
|
||||
|
||||
final DateTime? createdAt;
|
||||
|
||||
final DateTime? updatedAt;
|
||||
|
||||
final _i1.User? user;
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'name': name,
|
||||
'description': description,
|
||||
'clientId': clientId,
|
||||
'userId': userId,
|
||||
'createdAt': createdAt?.toIso8601String(),
|
||||
'updatedAt': updatedAt?.toIso8601String(),
|
||||
'user': user?.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
class CreateManyTimeEntryAndReturnOutputType {
|
||||
const CreateManyTimeEntryAndReturnOutputType({
|
||||
this.id,
|
||||
this.startTime,
|
||||
this.endTime,
|
||||
this.description,
|
||||
this.userId,
|
||||
this.projectId,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
this.user,
|
||||
this.project,
|
||||
});
|
||||
|
||||
factory CreateManyTimeEntryAndReturnOutputType.fromJson(Map json) =>
|
||||
CreateManyTimeEntryAndReturnOutputType(
|
||||
id: json['id'],
|
||||
startTime: switch (json['startTime']) {
|
||||
DateTime value => value,
|
||||
String value => DateTime.parse(value),
|
||||
_ => json['startTime']
|
||||
},
|
||||
endTime: switch (json['endTime']) {
|
||||
DateTime value => value,
|
||||
String value => DateTime.parse(value),
|
||||
_ => json['endTime']
|
||||
},
|
||||
description: json['description'],
|
||||
userId: json['userId'],
|
||||
projectId: json['projectId'],
|
||||
createdAt: switch (json['createdAt']) {
|
||||
DateTime value => value,
|
||||
String value => DateTime.parse(value),
|
||||
_ => json['createdAt']
|
||||
},
|
||||
updatedAt: switch (json['updatedAt']) {
|
||||
DateTime value => value,
|
||||
String value => DateTime.parse(value),
|
||||
_ => json['updatedAt']
|
||||
},
|
||||
user: json['user'] is Map ? _i1.User.fromJson(json['user']) : null,
|
||||
project: json['project'] is Map
|
||||
? _i1.Project.fromJson(json['project'])
|
||||
: null,
|
||||
);
|
||||
|
||||
final String? id;
|
||||
|
||||
final DateTime? startTime;
|
||||
|
||||
final DateTime? endTime;
|
||||
|
||||
final String? description;
|
||||
|
||||
final String? userId;
|
||||
|
||||
final String? projectId;
|
||||
|
||||
final DateTime? createdAt;
|
||||
|
||||
final DateTime? updatedAt;
|
||||
|
||||
final _i1.User? user;
|
||||
|
||||
final _i1.Project? project;
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'startTime': startTime?.toIso8601String(),
|
||||
'endTime': endTime?.toIso8601String(),
|
||||
'description': description,
|
||||
'userId': userId,
|
||||
'projectId': projectId,
|
||||
'createdAt': createdAt?.toIso8601String(),
|
||||
'updatedAt': updatedAt?.toIso8601String(),
|
||||
'user': user?.toJson(),
|
||||
'project': project?.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
class CreateManyTaskAndReturnOutputType {
|
||||
const CreateManyTaskAndReturnOutputType({
|
||||
this.id,
|
||||
this.name,
|
||||
this.description,
|
||||
this.projectId,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
this.project,
|
||||
});
|
||||
|
||||
factory CreateManyTaskAndReturnOutputType.fromJson(Map json) =>
|
||||
CreateManyTaskAndReturnOutputType(
|
||||
id: json['id'],
|
||||
name: json['name'],
|
||||
description: json['description'],
|
||||
projectId: json['projectId'],
|
||||
createdAt: switch (json['createdAt']) {
|
||||
DateTime value => value,
|
||||
String value => DateTime.parse(value),
|
||||
_ => json['createdAt']
|
||||
},
|
||||
updatedAt: switch (json['updatedAt']) {
|
||||
DateTime value => value,
|
||||
String value => DateTime.parse(value),
|
||||
_ => json['updatedAt']
|
||||
},
|
||||
project: json['project'] is Map
|
||||
? _i1.Project.fromJson(json['project'])
|
||||
: null,
|
||||
);
|
||||
|
||||
final String? id;
|
||||
|
||||
final String? name;
|
||||
|
||||
final String? description;
|
||||
|
||||
final String? projectId;
|
||||
|
||||
final DateTime? createdAt;
|
||||
|
||||
final DateTime? updatedAt;
|
||||
|
||||
final _i1.Project? project;
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'name': name,
|
||||
'description': description,
|
||||
'projectId': projectId,
|
||||
'createdAt': createdAt?.toIso8601String(),
|
||||
'updatedAt': updatedAt?.toIso8601String(),
|
||||
'project': project?.toJson(),
|
||||
};
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
generator dartClient {
|
||||
provider = "dart run orm"
|
||||
output = "lib/infrastructure/persistence/db"
|
||||
output = "../lib/infrastructure/persistence/db"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
@ -9,51 +9,51 @@ datasource db {
|
||||
}
|
||||
|
||||
// User Model
|
||||
model User {
|
||||
model UserDbo {
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
email String @unique
|
||||
password String
|
||||
projects Project[] // Beziehung zu Projekten
|
||||
timeEntries TimeEntry[] // Beziehung zu Zeiteinträgen
|
||||
projects ProjectDbo[] // Beziehung zu Projekten
|
||||
timeEntries TimeEntryDbo[] // Beziehung zu Zeiteinträgen
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
// Project Model
|
||||
model Project {
|
||||
model ProjectDbo {
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
description String?
|
||||
clientId String?
|
||||
tasks Task[] // Beziehung zu Aufgaben
|
||||
timeEntries TimeEntry[] // Beziehung zu Zeiteinträgen
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
tasks TaskDbo[] // Beziehung zu Aufgaben
|
||||
timeEntries TimeEntryDbo[] // Beziehung zu Zeiteinträgen
|
||||
user UserDbo @relation(fields: [userId], references: [id])
|
||||
userId String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
// TimeEntry Model
|
||||
model TimeEntry {
|
||||
model TimeEntryDbo {
|
||||
id String @id @default(uuid())
|
||||
startTime DateTime
|
||||
endTime DateTime
|
||||
description String?
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
user UserDbo @relation(fields: [userId], references: [id])
|
||||
userId String
|
||||
project Project @relation(fields: [projectId], references: [id])
|
||||
project ProjectDbo @relation(fields: [projectId], references: [id])
|
||||
projectId String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
// Task Model (optional)
|
||||
model Task {
|
||||
model TaskDbo {
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
description String?
|
||||
project Project @relation(fields: [projectId], references: [id])
|
||||
project ProjectDbo @relation(fields: [projectId], references: [id])
|
||||
projectId String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
@ -278,8 +278,16 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
freezed:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: freezed
|
||||
sha256: "44c19278dd9d89292cf46e97dc0c1e52ce03275f40a97c5a348e802a924bf40e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.5.7"
|
||||
freezed_annotation:
|
||||
dependency: transitive
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: freezed_annotation
|
||||
sha256: c2e2d632dd9b8a2b7751117abcfc2b4888ecfe181bd9fca7170d9ef02e595fe2
|
||||
@ -367,7 +375,7 @@ packages:
|
||||
source: hosted
|
||||
version: "0.7.1"
|
||||
json_annotation:
|
||||
dependency: transitive
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: json_annotation
|
||||
sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1"
|
||||
@ -382,6 +390,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.3"
|
||||
json_serializable:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: json_serializable
|
||||
sha256: c2fcb3920cf2b6ae6845954186420fca40bc0a8abcc84903b7801f17d7050d7c
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.9.0"
|
||||
lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
@ -646,6 +662,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.5.0"
|
||||
source_helper:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: source_helper
|
||||
sha256: "86d247119aedce8e63f4751bd9626fc9613255935558447569ad42f9f5b48b3c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.5"
|
||||
source_map_stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -18,6 +18,9 @@ dependencies:
|
||||
yaml: ^3.1.0
|
||||
riverpod: ^2.6.1
|
||||
riverpod_annotation: ^2.6.1
|
||||
json_annotation: ^4.9.0
|
||||
freezed_annotation: ^2.4.4
|
||||
|
||||
dev_dependencies:
|
||||
lints: ^3.0.0
|
||||
test: ^1.24.0
|
||||
@ -25,4 +28,6 @@ dev_dependencies:
|
||||
build_runner: ^2.4.14
|
||||
riverpod_generator: ^2.6.3
|
||||
riverpod_lint: ^2.6.3
|
||||
json_serializable: ^6.9.0
|
||||
freezed: ^2.5.7
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user