diff --git a/packages/wyatt_architecture/lib/src/package.dart b/packages/wyatt_architecture/lib/src/core/core.dart similarity index 94% rename from packages/wyatt_architecture/lib/src/package.dart rename to packages/wyatt_architecture/lib/src/core/core.dart index 95c31e2f..122e2dfa 100644 --- a/packages/wyatt_architecture/lib/src/package.dart +++ b/packages/wyatt_architecture/lib/src/core/core.dart @@ -14,4 +14,4 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -String wyatt() => "wyatt_architecture"; \ No newline at end of file +export 'exceptions/exceptions.dart'; diff --git a/packages/wyatt_architecture/lib/src/core/exceptions/exceptions.dart b/packages/wyatt_architecture/lib/src/core/exceptions/exceptions.dart new file mode 100644 index 00000000..96a3bf8c --- /dev/null +++ b/packages/wyatt_architecture/lib/src/core/exceptions/exceptions.dart @@ -0,0 +1,40 @@ +// Copyright (C) 2022 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +import 'package:wyatt_type_utils/wyatt_type_utils.dart'; + +abstract class AppException implements Exception { + final String? message; + + AppException([this.message]); + + @override + String toString() { + if (message.isNotNullOrEmpty) { + return '$runtimeType: $message'; + } else { + return '$runtimeType: An exception occured'; + } + } +} + +class ClientException extends AppException { + ClientException([super.message]); +} + +class ServerException extends AppException { + ServerException([super.message]); +} diff --git a/packages/wyatt_architecture/lib/src/domain/data_sources/data_sources.dart b/packages/wyatt_architecture/lib/src/domain/data_sources/data_sources.dart new file mode 100644 index 00000000..c226b67b --- /dev/null +++ b/packages/wyatt_architecture/lib/src/domain/data_sources/data_sources.dart @@ -0,0 +1,19 @@ +// Copyright (C) 2022 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +export 'base_data_source.dart'; +export 'local/local.dart'; +export 'remote/remote.dart'; diff --git a/packages/wyatt_architecture/lib/src/domain/data_sources/local/local.dart b/packages/wyatt_architecture/lib/src/domain/data_sources/local/local.dart new file mode 100644 index 00000000..08fce718 --- /dev/null +++ b/packages/wyatt_architecture/lib/src/domain/data_sources/local/local.dart @@ -0,0 +1,17 @@ +// Copyright (C) 2022 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +export 'base_local_data_source.dart'; diff --git a/packages/wyatt_architecture/lib/src/domain/data_sources/remote/remote.dart b/packages/wyatt_architecture/lib/src/domain/data_sources/remote/remote.dart new file mode 100644 index 00000000..81d8f125 --- /dev/null +++ b/packages/wyatt_architecture/lib/src/domain/data_sources/remote/remote.dart @@ -0,0 +1,17 @@ +// Copyright (C) 2022 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +export 'base_remote_data_source.dart'; diff --git a/packages/wyatt_architecture/lib/src/domain/domain.dart b/packages/wyatt_architecture/lib/src/domain/domain.dart new file mode 100644 index 00000000..35c41307 --- /dev/null +++ b/packages/wyatt_architecture/lib/src/domain/domain.dart @@ -0,0 +1,20 @@ +// Copyright (C) 2022 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +export 'data_sources/data_sources.dart'; +export 'entities/entities.dart'; +export 'repositories/repositories.dart'; +export 'usecases/usecases.dart'; diff --git a/packages/wyatt_architecture/lib/src/domain/entities/entities.dart b/packages/wyatt_architecture/lib/src/domain/entities/entities.dart new file mode 100644 index 00000000..47ef61fa --- /dev/null +++ b/packages/wyatt_architecture/lib/src/domain/entities/entities.dart @@ -0,0 +1,17 @@ +// Copyright (C) 2022 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +export 'entity.dart'; diff --git a/packages/wyatt_architecture/lib/src/domain/entities/entity.dart b/packages/wyatt_architecture/lib/src/domain/entities/entity.dart index cd66df2b..67df1106 100644 --- a/packages/wyatt_architecture/lib/src/domain/entities/entity.dart +++ b/packages/wyatt_architecture/lib/src/domain/entities/entity.dart @@ -14,4 +14,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -abstract class Entity {} +abstract class Entity { + const Entity(); +} diff --git a/packages/wyatt_architecture/lib/src/domain/repositories/base_repository.dart b/packages/wyatt_architecture/lib/src/domain/repositories/base_repository.dart new file mode 100644 index 00000000..f6127411 --- /dev/null +++ b/packages/wyatt_architecture/lib/src/domain/repositories/base_repository.dart @@ -0,0 +1,17 @@ +// Copyright (C) 2022 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +class BaseRepository {} diff --git a/packages/wyatt_architecture/lib/src/domain/repositories/repositories.dart b/packages/wyatt_architecture/lib/src/domain/repositories/repositories.dart new file mode 100644 index 00000000..bc97c14e --- /dev/null +++ b/packages/wyatt_architecture/lib/src/domain/repositories/repositories.dart @@ -0,0 +1,17 @@ +// Copyright (C) 2022 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +export 'base_repository.dart'; diff --git a/packages/wyatt_architecture/lib/src/domain/usecases/no_param.dart b/packages/wyatt_architecture/lib/src/domain/usecases/no_param.dart new file mode 100644 index 00000000..7452af67 --- /dev/null +++ b/packages/wyatt_architecture/lib/src/domain/usecases/no_param.dart @@ -0,0 +1,21 @@ +// Copyright (C) 2022 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +import 'package:wyatt_architecture/src/domain/entities/entity.dart'; + +class NoParam extends Entity { + const NoParam(); +} diff --git a/packages/wyatt_architecture/lib/src/domain/usecases/usecase.dart b/packages/wyatt_architecture/lib/src/domain/usecases/usecase.dart new file mode 100644 index 00000000..417695ca --- /dev/null +++ b/packages/wyatt_architecture/lib/src/domain/usecases/usecase.dart @@ -0,0 +1,25 @@ +// Copyright (C) 2022 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +import 'package:wyatt_architecture/src/core/exceptions/exceptions.dart'; +import 'package:wyatt_type_utils/wyatt_type_utils.dart'; + +typedef FutureResult = Future>; + +// ignore: one_member_abstracts +abstract class UseCase { + FutureResult call(Parameters params); +} diff --git a/packages/wyatt_architecture/lib/src/domain/usecases/usecases.dart b/packages/wyatt_architecture/lib/src/domain/usecases/usecases.dart new file mode 100644 index 00000000..31b702da --- /dev/null +++ b/packages/wyatt_architecture/lib/src/domain/usecases/usecases.dart @@ -0,0 +1,17 @@ +// Copyright (C) 2022 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +export 'usecase.dart'; diff --git a/packages/wyatt_architecture/lib/src/src.dart b/packages/wyatt_architecture/lib/src/src.dart index 72924ab1..50ef204e 100644 --- a/packages/wyatt_architecture/lib/src/src.dart +++ b/packages/wyatt_architecture/lib/src/src.dart @@ -1,17 +1,18 @@ // Copyright (C) 2022 WYATT GROUP // Please see the AUTHORS file for details. -// +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . -export 'package.dart'; \ No newline at end of file +export 'core/core.dart'; +export 'domain/domain.dart';