Skip to content

Commit

Permalink
Merge pull request #2 from lucas-mrq/add-rooms
Browse files Browse the repository at this point in the history
Add Planning & Layer Management
  • Loading branch information
lucas-mrq authored May 23, 2024
2 parents 99f3259 + 28796f6 commit be71717
Show file tree
Hide file tree
Showing 85 changed files with 6,393 additions and 58 deletions.
16 changes: 0 additions & 16 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@ jobs:
- id: docker-tag
uses: yuya-takeyama/docker-tag-from-github-ref-action@v1

- name: Configure AWS credentials
id: aws-credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# Should use us-east-1 region to push to ECR public registry
aws-region: us-east-1

- name: Docker Login to ACR
# You may pin to the exact commit or the version.
uses: docker/login-action@v3.1.0
Expand All @@ -45,20 +36,13 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
with:
registry-type: public

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
${{ env.registry_name }}/${{ github.repository_owner }}/${{ env.image_name }}
${{ steps.login-ecr.outputs.registry }}/cgi-fr/${{ env.image_name }}
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
Expand Down
56 changes: 28 additions & 28 deletions src/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_VERSION=1.2.3
ARG GITHUB_RUN_NUMBER=4
WORKDIR /src
RUN ls
COPY ["IoTHub.Portal.Server/IoTHub.Portal.Server.csproj", "IoTHub.Portal.Server/"]
COPY ["IoTHub.Portal.Shared/IoTHub.Portal.Shared.csproj", "IoTHub.Portal.Shared/"]
COPY ["IoTHub.Portal.Client/IoTHub.Portal.Client.csproj", "IoTHub.Portal.Client/"]
RUN dotnet restore "IoTHub.Portal.Server/IoTHub.Portal.Server.csproj"
COPY . .
WORKDIR "/src/IoTHub.Portal.Server"
RUN dotnet build "IoTHub.Portal.Server.csproj" -c Release -o /app/build -p:Version="${BUILD_VERSION}.${GITHUB_RUN_NUMBER}"

FROM build AS publish
ARG BUILD_VERSION=1.2.3
ARG GITHUB_RUN_NUMBER=4
RUN dotnet publish "IoTHub.Portal.Server.csproj" -c Release -o /app/publish -p:Version="${BUILD_VERSION}.${GITHUB_RUN_NUMBER}"

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "IoTHub.Portal.Server.dll"]
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_VERSION=1.2.3
ARG GITHUB_RUN_NUMBER=4
WORKDIR /src
RUN ls
COPY ["IoTHub.Portal.Server/IoTHub.Portal.Server.csproj", "IoTHub.Portal.Server/"]
COPY ["IoTHub.Portal.Shared/IoTHub.Portal.Shared.csproj", "IoTHub.Portal.Shared/"]
COPY ["IoTHub.Portal.Client/IoTHub.Portal.Client.csproj", "IoTHub.Portal.Client/"]
RUN dotnet restore "IoTHub.Portal.Server/IoTHub.Portal.Server.csproj"
COPY . .
WORKDIR "/src/IoTHub.Portal.Server"
RUN dotnet build "IoTHub.Portal.Server.csproj" -c Release -o /app/build -p:Version="${BUILD_VERSION}.${GITHUB_RUN_NUMBER}"

FROM build AS publish
ARG BUILD_VERSION=1.2.3
ARG GITHUB_RUN_NUMBER=4
RUN dotnet publish "IoTHub.Portal.Server.csproj" -c Release -o /app/publish -p:Version="${BUILD_VERSION}.${GITHUB_RUN_NUMBER}"

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "IoTHub.Portal.Server.dll"]
18 changes: 18 additions & 0 deletions src/IoTHub.Portal.Application/Mappers/LayerProfile.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (c) CGI France. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace IoTHub.Portal.Infrastructure.Mappers
{
using AutoMapper;
using IoTHub.Portal.Domain.Entities;
using IoTHub.Portal.Shared.Models.v10;

public class LayerProfile : Profile
{
public LayerProfile()
{
_ = CreateMap<LayerDto, Layer>()
.ReverseMap();
}
}
}
18 changes: 18 additions & 0 deletions src/IoTHub.Portal.Application/Mappers/PlanningProfile.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (c) CGI France. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace IoTHub.Portal.Infrastructure.Mappers
{
using AutoMapper;
using IoTHub.Portal.Domain.Entities;
using IoTHub.Portal.Shared.Models.v10;

public class PlanningProfile : Profile
{
public PlanningProfile()
{
_ = CreateMap<PlanningDto, Planning>()
.ReverseMap();
}
}
}
18 changes: 18 additions & 0 deletions src/IoTHub.Portal.Application/Mappers/ScheduleProfile.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (c) CGI France. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace IoTHub.Portal.Infrastructure.Mappers
{
using AutoMapper;
using IoTHub.Portal.Domain.Entities;
using IoTHub.Portal.Shared.Models.v10;

public class ScheduleProfile : Profile
{
public ScheduleProfile()
{
_ = CreateMap<ScheduleDto, Schedule>()
.ReverseMap();
}
}
}
3 changes: 2 additions & 1 deletion src/IoTHub.Portal.Application/Services/IDeviceService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ Task<PaginatedResult<DeviceListItem>> GetDevices(
string[]? orderBy = null,
Dictionary<string, string>? tags = default,
string? modelId = null,
List<string>? labels = default);
List<string>? labels = default,
string? layerId = null);

Task<TDto> GetDevice(string deviceId);

Expand Down
18 changes: 18 additions & 0 deletions src/IoTHub.Portal.Application/Services/ILayerService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (c) CGI France. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace IoTHub.Portal.Application.Services
{
using System.Threading.Tasks;
using IoTHub.Portal.Domain.Entities;
using IoTHub.Portal.Shared.Models.v10;

public interface ILayerService
{
Task<LayerDto> CreateLayer(LayerDto level);
Task UpdateLayer(LayerDto level);
Task DeleteLayer(string levelId);
Task<Layer> GetLayer(string levelId);
Task<IEnumerable<LayerDto>> GetLayers();
}
}
18 changes: 18 additions & 0 deletions src/IoTHub.Portal.Application/Services/IPlanningService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (c) CGI France. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace IoTHub.Portal.Application.Services
{
using System.Threading.Tasks;
using IoTHub.Portal.Domain.Entities;
using IoTHub.Portal.Shared.Models.v10;

public interface IPlanningService
{
Task<PlanningDto> CreatePlanning(PlanningDto planning);
Task UpdatePlanning(PlanningDto planning);
Task DeletePlanning(string planningId);
Task<Planning> GetPlanning(string planningId);
Task<IEnumerable<PlanningDto>> GetPlannings();
}
}
18 changes: 18 additions & 0 deletions src/IoTHub.Portal.Application/Services/IScheduleService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (c) CGI France. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace IoTHub.Portal.Application.Services
{
using System.Threading.Tasks;
using IoTHub.Portal.Domain.Entities;
using IoTHub.Portal.Shared.Models.v10;

public interface IScheduleService
{
Task<ScheduleDto> CreateSchedule(ScheduleDto schedule);
Task UpdateSchedule(ScheduleDto schedule);
Task DeleteSchedule(string scheduleId);
Task<Schedule> GetSchedule(string scheduleId);
Task<IEnumerable<ScheduleDto>> GetSchedules();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright (c) CGI France. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace IoTHub.Portal.Application.Services
{
public interface ISendPlanningCommandService
{
}
}
Loading

0 comments on commit be71717

Please sign in to comment.