-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1802 task create an aws thing type (#2041)
* create Thing Type table * PostgreSQL DB migration * Model + Repo + Service Think Type * Remove Gneric Thing Type * Test API Done * Testing ThingType Service (DONE) * Create Thing Type Controller tested * some changes in the Cloud Provider * Add Thing Type Button OK * Adapt CreateDeviceModelTests with Azure cloud Provider * #1802 DONE without adding Migration Files * #1802 DONE with Migration Files Added * #1802 Correct COnflict Problem * #1802 PG Migration new class * create Thing Type table * PostgreSQL DB migration * Model + Repo + Service Think Type * Remove Gneric Thing Type * Test API Done * Testing ThingType Service (DONE) * Create Thing Type Controller tested * some changes in the Cloud Provider * Add Thing Type Button OK * Adapt CreateDeviceModelTests with Azure cloud Provider * #1802 DONE without adding Migration Files * correcting Migration Pblm * correcting conflicts & bugs in Migration files * Update AWSImageManager * Fix formatting * Fix Build Problems * Fixes on the PR * change tag dictionary to tag DTO * Add Copyright CGI * remove unsused variables * Using AWS ThingTypeID for my DB * handle image in Thing type creation * handle Thing Type image * uploading avatar in Thing Type (DONE) * adding test for InsertAndGetIdAsync function * adding some tests for test cov
- Loading branch information
Showing
51 changed files
with
2,383 additions
and
113 deletions.
There are no files selected for viewing
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
51 changes: 51 additions & 0 deletions
51
src/AzureIoTHub.Portal.Application/Mappers/AWS/ThingTypeProfile.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,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>())); | ||
|
||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/AzureIoTHub.Portal.Application/Mappers/AWS/ThingTypeSearchableAttProfile.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,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(); | ||
|
||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/AzureIoTHub.Portal.Application/Services/AWS/IThingTypeService.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,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); | ||
} | ||
} |
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
Oops, something went wrong.