-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ditched the modular approach in favour of single clean arch sln
- Loading branch information
Showing
39 changed files
with
239 additions
and
480 deletions.
There are no files selected for viewing
6 changes: 1 addition & 5 deletions
6
....Service.API/SmartHome.Service.API.csproj → SmartHome.Service/Api/Api.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,9 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
var builder = WebApplication.CreateBuilder(args); | ||
var app = builder.Build(); | ||
|
||
app.MapGet("/", () => "Hello World!"); | ||
|
||
app.Run(); | ||
|
||
|
||
// TODO: give minimal APIs a go, ditch and go for controllers if it's too much effort |
20 changes: 13 additions & 7 deletions
20
...ervice.API/Properties/launchSettings.json → ...ervice/Api/Properties/launchSettings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning" | ||
} | ||
}, | ||
"AllowedHosts": "*" | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
namespace Application; | ||
public class Class1 | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
namespace Domain.Common; | ||
|
||
public interface IAggregateRoot { } |
6 changes: 6 additions & 0 deletions
6
SmartHome.Service/Domain/Common/Interfaces/IDeviceFunction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace Domain.Common; | ||
|
||
public interface IDeviceFunction | ||
{ | ||
public Guid DeviceId { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace Domain.Common; | ||
|
||
public interface IRepository<T> where T : IAggregateRoot | ||
{ | ||
// TODO: unit of work? | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
namespace Domain.Devices; | ||
|
||
public class Device // todo: entity | ||
{ | ||
public Guid Id { get; protected set; } | ||
public string NodeId { get; protected set; } //? value object? | ||
public bool On { get; protected set; } | ||
public DeviceState State { get; protected set; } | ||
|
||
protected Device(Guid id, string nodeId, bool on, DeviceState state) | ||
{ | ||
Id = id; | ||
NodeId = nodeId; | ||
On = on; | ||
State = state; | ||
} | ||
|
||
public static Device Create(string nodeId, bool on, DeviceState state) | ||
{ | ||
var id = Guid.NewGuid(); | ||
return new Device(id, nodeId, on, state); | ||
} | ||
|
||
public void Switch(bool on) | ||
{ | ||
On = on; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Domain.Devices; | ||
|
||
public enum DeviceState | ||
{ | ||
Connected, | ||
LowBattery, | ||
Disconnected, | ||
Unkown | ||
} |
3 changes: 2 additions & 1 deletion
3
...tchables.Domain/Switchables.Domain.csproj → SmartHome.Service/Domain/Domain.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using Domain.Common; | ||
using Domain.Devices; | ||
|
||
namespace Domain.Doorlocks; | ||
|
||
public class DoorLock : IAggregateRoot, IDeviceFunction | ||
{ | ||
public Guid Id { get; protected set; } | ||
public Guid DeviceId { get; protected set; } | ||
public bool Locked { get; protected set; } | ||
|
||
protected DoorLock(Guid id, Guid deviceId, bool locked) | ||
{ | ||
Id = id; | ||
DeviceId = deviceId; | ||
Locked = locked; | ||
} | ||
|
||
public static DoorLock Create(Device device, bool locked) | ||
{ | ||
if (device.State != DeviceState.Connected) | ||
{ | ||
throw new Exception("Device must be available and charged"); | ||
} | ||
|
||
var doorLockId = Guid.NewGuid(); | ||
|
||
return new DoorLock(doorLockId, device.Id, locked); | ||
} | ||
|
||
public void Lock() | ||
{ | ||
Locked = true; | ||
} | ||
|
||
public void UnLock() | ||
{ | ||
Locked = false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
namespace Infrastructure; | ||
public class Class1 | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 0 additions & 7 deletions
7
SmartHome.Service/Modules/Switchables/Switchables.Application/Class1.cs
This file was deleted.
Oops, something went wrong.
34 changes: 0 additions & 34 deletions
34
SmartHome.Service/Modules/Switchables/Switchables.Domain/SmartBulbs/SmartBulb.cs
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
SmartHome.Service/Modules/Switchables/Switchables.Domain/SmartBulbs/ValueObjects/RgbState.cs
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
SmartHome.Service/Modules/Switchables/Switchables.Domain/Switches/Switch.cs
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
...ome.Service/Modules/Switchables/Switchables.Infrastructure/Database/SwitchablesContext.cs
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
SmartHome.Service/Modules/Switchables/Switchables.Infrastructure/DependencyInjection.cs
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
....Service/Modules/Switchables/Switchables.Infrastructure/Switchables.Infrastructure.csproj
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.