Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1802 task create an aws thing type #2041

Merged
merged 43 commits into from
May 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
537e7f6
create Thing Type table
ssgueye2 Apr 20, 2023
a4b715d
PostgreSQL DB migration
ssgueye2 Apr 20, 2023
064a348
Model + Repo + Service Think Type
ssgueye2 Apr 20, 2023
b96fb86
Remove Gneric Thing Type
ssgueye2 Apr 21, 2023
b997330
Test API Done
ssgueye2 Apr 24, 2023
d950232
Testing ThingType Service (DONE)
ssgueye2 Apr 24, 2023
a583311
Create Thing Type Controller tested
ssgueye2 Apr 24, 2023
19ff281
some changes in the Cloud Provider
ssgueye2 Apr 26, 2023
3977d6f
Add Thing Type Button OK
ssgueye2 Apr 27, 2023
cdd6a80
Adapt CreateDeviceModelTests with Azure cloud Provider
ssgueye2 Apr 27, 2023
248559c
#1802 DONE without adding Migration Files
ssgueye2 Apr 27, 2023
91cd7a1
#1802 DONE with Migration Files Added
ssgueye2 Apr 27, 2023
2f34572
Merge branch 'main-vnext' into 1802-task-create-an-aws-thing-type
ssgueye2 Apr 27, 2023
442f42b
#1802 Correct COnflict Problem
ssgueye2 Apr 27, 2023
325c78b
#1802 PG Migration new class
ssgueye2 Apr 27, 2023
bced237
create Thing Type table
ssgueye2 Apr 20, 2023
4ad12c5
PostgreSQL DB migration
ssgueye2 Apr 20, 2023
8b39638
Model + Repo + Service Think Type
ssgueye2 Apr 20, 2023
a69dca5
Remove Gneric Thing Type
ssgueye2 Apr 21, 2023
76e405a
Test API Done
ssgueye2 Apr 24, 2023
99590c6
Testing ThingType Service (DONE)
ssgueye2 Apr 24, 2023
285f00d
Create Thing Type Controller tested
ssgueye2 Apr 24, 2023
09b886c
some changes in the Cloud Provider
ssgueye2 Apr 26, 2023
6a990dd
Add Thing Type Button OK
ssgueye2 Apr 27, 2023
2421cb4
Adapt CreateDeviceModelTests with Azure cloud Provider
ssgueye2 Apr 27, 2023
3ce4bff
#1802 DONE without adding Migration Files
ssgueye2 Apr 27, 2023
e910737
correcting Migration Pblm
ssgueye2 Apr 28, 2023
e66f1d8
correcting conflicts & bugs in Migration files
ssgueye2 Apr 28, 2023
c7430f7
Merge branch '1802-task-create-an-aws-thing-type' of https://github.c…
ssgueye2 Apr 28, 2023
f1a0916
Update AWSImageManager
ssgueye2 Apr 28, 2023
492b95f
Fix formatting
ssgueye2 Apr 28, 2023
651fbea
Fix Build Problems
ssgueye2 Apr 28, 2023
881c49e
Fixes on the PR
ssgueye2 Apr 28, 2023
9440316
change tag dictionary to tag DTO
ssgueye2 May 2, 2023
383ce52
Add Copyright CGI
ssgueye2 May 2, 2023
b23a810
remove unsused variables
ssgueye2 May 2, 2023
5ac138c
Using AWS ThingTypeID for my DB
ssgueye2 May 2, 2023
5ddbff5
handle image in Thing type creation
ssgueye2 May 2, 2023
6e4f69e
handle Thing Type image
ssgueye2 May 3, 2023
7b9fb9e
uploading avatar in Thing Type (DONE)
ssgueye2 May 3, 2023
0c3688e
adding test for InsertAndGetIdAsync function
ssgueye2 May 4, 2023
fa5f49a
adding some tests for test cov
ssgueye2 May 4, 2023
64e7abf
Merge branch 'main-vnext' into 1802-task-create-an-aws-thing-type
ssgueye2 May 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
[assembly: System.CLSCompliant(false)]

[assembly: InternalsVisibleTo("AzureIoTHub.Portal.Shared")]
[assembly: InternalsVisibleTo("AzureIoTHub.Portal.Infrastructure")]
[assembly: InternalsVisibleTo("AzureIoTHub.Portal.Server")]
[assembly: InternalsVisibleTo("AzureIoTHub.Portal.Client")]
[assembly: InternalsVisibleTo("AzureIoTHub.Portal.Tests.Unit")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

<ItemGroup>
<PackageReference Include="AutoMapper" Version="12.0.1" />
<PackageReference Include="AWSSDK.IoT" Version="3.7.107.5" />
<PackageReference Include="Azure.Messaging.EventHubs" Version="5.8.1" />
<PackageReference Include="Microsoft.Azure.Devices" Version="1.38.2" />
<PackageReference Include="Microsoft.Azure.Devices.Provisioning.Service" Version="1.18.2" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Copyright (c) CGI France. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace AzureIoTHub.Portal.Application.Mappers.AWS
{
using AutoMapper;
using AzureIoTHub.Portal.Domain.Entities.AWS;
using AzureIoTHub.Portal.Models.v10.AWS;
using Amazon.IoT.Model;
public class ThingTypeProfile : Profile
{
public ThingTypeProfile()
{
_ = CreateMap<ThingTypeDto, ThingType>()
.ForMember(dest => dest.Id, opts => opts.MapFrom(src => src.ThingTypeID))
.ForMember(dest => dest.Name, opts => opts.MapFrom(src => src.ThingTypeName))
.ForMember(dest => dest.Description, opts => opts.MapFrom(src => src.ThingTypeDescription))
.ForMember(dest => dest.ThingTypeSearchableAttributes, opts => opts.MapFrom(src => src.ThingTypeSearchableAttDtos.Select(pair => new ThingTypeSearchableAtt
{
Name = pair.Name
})))
.ForMember(dest => dest.Tags, opts => opts.MapFrom(src => src.Tags.Select(pair => new ThingTypeTag
{
Key = pair.Key,
Value = pair.Value
})));

_ = CreateMap<ThingType, ThingTypeDto>()
.ForMember(dest => dest.ThingTypeID, opts => opts.MapFrom(src => src.Id))
.ForMember(dest => dest.ThingTypeName, opts => opts.MapFrom(src => src.Name))
.ForMember(dest => dest.ThingTypeDescription, opts => opts.MapFrom(src => src.Description))
.ForMember(dest => dest.Tags, opts => opts.MapFrom(src => src.Tags != null ? src.Tags.ToList() : null))
.ForMember(dest => dest.ThingTypeSearchableAttDtos, opts => opts.MapFrom(
src => src.ThingTypeSearchableAttributes != null ? src.ThingTypeSearchableAttributes.ToList() : null));

_ = CreateMap<ThingTypeDto, CreateThingTypeRequest>()
.ForMember(dest => dest.ThingTypeName, opts => opts.MapFrom(src => src.ThingTypeName))
.ForMember(dest => dest.ThingTypeProperties, opts => opts.MapFrom(src => new ThingTypeProperties
{
ThingTypeDescription = src.ThingTypeDescription,
SearchableAttributes = src.ThingTypeSearchableAttDtos.Select(pair => pair.Name).ToList() ?? new List<string>()
}))
.ForMember(dest => dest.Tags, opts => opts.MapFrom(src => src.Tags.Select(pair => new Tag
{
Key = pair.Key,
Value = pair.Value
}).ToList() ?? new List<Tag>()));

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (c) CGI France. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace AzureIoTHub.Portal.Application.Mappers.AWS
{
using AutoMapper;
using AzureIoTHub.Portal.Domain.Entities.AWS;
using AzureIoTHub.Portal.Models.v10.AWS;

public class ThingTypeSearchableAttProfile : Profile
{
public ThingTypeSearchableAttProfile()
{
_ = CreateMap<ThingTypeSearchableAtt, ThingTypeSearchableAttDto>()
.ForMember(dest => dest.Name, opts => opts.MapFrom(src => src.Name))
.ReverseMap();

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (c) CGI France. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace AzureIoTHub.Portal.Application.Services.AWS
{
using AzureIoTHub.Portal.Models.v10.AWS;
using Microsoft.AspNetCore.Http;

public interface IThingTypeService
{
//Create a thing type
Task<string> CreateThingType(ThingTypeDto thingType);

Task<string> GetThingTypeAvatar(string thingTypeId);

Task<string> UpdateThingTypeAvatar(string thingTypeId, IFormFile file);

Task DeleteThingTypeAvatar(string thingTypeId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,9 @@
<ItemGroup>
<ProjectReference Include="..\AzureIoTHub.Portal.Shared\AzureIoTHub.Portal.Shared.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="Components\AWS\" />
</ItemGroup>

</Project>
Loading