Skip to content

Dockerizamos la TaleEngine, SQLServer y Seq #35

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

Open
wants to merge 3 commits into
base: xunit
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
25 changes: 25 additions & 0 deletions TaleEngine/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
Expand Down
155 changes: 77 additions & 78 deletions TaleEngine/TaleEngine.Application/Mappers/ActivityMapper.cs
Original file line number Diff line number Diff line change
@@ -1,80 +1,79 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using TaleEngine.Application.Contracts.Dtos;
using TaleEngine.Bussiness.Contracts.Models;

namespace TaleEngine.Application.Mappers
{
public static class ActivityMapper
{
public static ActivityDto Map(ActivityModel activityModel)
{
if (activityModel == null) return null;

return new ActivityDto
{
Id = activityModel.Id,
Title = activityModel.Title,
Description = activityModel.Description,
Places = activityModel.Places,
ActivityEnd = activityModel.EndDateTime.ToString(),
ActivityStart = activityModel.StartDateTime.ToString(),
StatusId = activityModel.StatusId,
TypeId = activityModel.TypeId,
Image = activityModel.Image,
TimeSlotId = activityModel.TimeSlotId ?? 0
};
}

public static List<ActivityDto> Map(List<ActivityModel> activityModels)
{
if (activityModels == null || activityModels.Count == 0) return null;

return activityModels.Select(Map).ToList();
}


public static ActivityModel Map(ActivityDto activityDto)
{
if (activityDto == null) return null;

return new ActivityModel
{
Id = activityDto.Id,
Title = activityDto.Title,
Description = activityDto.Description,
Places = activityDto.Places,
Image = activityDto.Image,
TypeId = activityDto.TypeId,
StatusId = activityDto.StatusId,
EndDateTime = ParseTime(activityDto.ActivityEnd),
StartDateTime = ParseTime(activityDto.ActivityStart),
TimeSlotId = activityDto.TimeSlotId
};
}

public static List<ActivityModel> Map(List<ActivityDto> activityDtos)
{
if (activityDtos == null || activityDtos.Count == 0) return null;

return activityDtos.Select(Map).ToList();
}

private static DateTime? ParseTime(string date)
{
DateTime? result;

try
{
result = DateTime.Parse(date);
}
catch (Exception e)
{
result = null;
}

return result;
}
}
}
using TaleEngine.Application.Contracts.Dtos;
using TaleEngine.Bussiness.Contracts.Models;

namespace TaleEngine.Application.Mappers
{
public static class ActivityMapper
{
public static ActivityDto Map(ActivityModel activityModel)
{
if (activityModel == null) return null;

return new ActivityDto
{
Id = activityModel.Id,
Title = activityModel.Title,
Description = activityModel.Description,
Places = activityModel.Places,
ActivityEnd = activityModel.EndDateTime.ToString(),
ActivityStart = activityModel.StartDateTime.ToString(),
StatusId = activityModel.StatusId,
TypeId = activityModel.TypeId,
Image = activityModel.Image,
TimeSlotId = activityModel.TimeSlotId ?? 0
};
}

public static List<ActivityDto> Map(List<ActivityModel> activityModels)
{
if (activityModels == null || activityModels.Count == 0) return null;

return activityModels.Select(Map).ToList();
}

public static ActivityModel Map(ActivityDto activityDto)
{
if (activityDto == null) return null;

return new ActivityModel
{
Id = activityDto.Id,
Title = activityDto.Title,
Description = activityDto.Description,
Places = activityDto.Places,
Image = activityDto.Image,
TypeId = activityDto.TypeId,
StatusId = activityDto.StatusId,
EndDateTime = ParseTime(activityDto.ActivityEnd),
StartDateTime = ParseTime(activityDto.ActivityStart),
TimeSlotId = activityDto.TimeSlotId
};
}

public static List<ActivityModel> Map(List<ActivityDto> activityDtos)
{
if (activityDtos == null || activityDtos.Count == 0) return null;

return activityDtos.Select(Map).ToList();
}

private static DateTime? ParseTime(string date)
{
DateTime? result;

try
{
result = DateTime.Parse(date);
}
catch (Exception)
{
result = null;
}

return result;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using TaleEngine.Application.Contracts.Dtos;
using TaleEngine.Application.Contracts.Services;
using TaleEngine.Application.Mappers;
Expand All @@ -12,7 +13,7 @@ public class ActivityStatusService : IActivityStatusService

public ActivityStatusService(IActivityStatusDomainService activityStatusDomainService)
{
_activityStatusDomainService = activityStatusDomainService;
_activityStatusDomainService = activityStatusDomainService ?? throw new ArgumentNullException(nameof(activityStatusDomainService));
}

public List<ActivityStatusDto> GetActivityStatuses()
Expand All @@ -24,4 +25,4 @@ public List<ActivityStatusDto> GetActivityStatuses()
return result;
}
}
}
}
1 change: 0 additions & 1 deletion TaleEngine/TaleEngine.Application/Services/EventService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using TaleEngine.Application.Contracts.Dtos;
using TaleEngine.Application.Contracts.Services;
using TaleEngine.Application.Mappers;
using TaleEngine.Bussiness.Contracts;
using TaleEngine.Bussiness.Contracts.DomainServices;

namespace TaleEngine.Application.Services
Expand Down
Loading