Skip to content

Commit

Permalink
CheckIn application refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
dyatlov-a committed Oct 3, 2023
1 parent 8634368 commit a3b6c85
Show file tree
Hide file tree
Showing 41 changed files with 316 additions and 163 deletions.
47 changes: 34 additions & 13 deletions Inc.TeamAssistant.sln
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Inc.TeamAssistant.Appraiser
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Inc.TeamAssistant.Appraiser.Application", "src\Inc.TeamAssistant.Appraiser.Application\Inc.TeamAssistant.Appraiser.Application.csproj", "{33B4F8C6-954D-4DB7-9B36-A361D3AE867C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "core", "core", "{15DCF7E1-1D36-4C21-A623-35A1D037A4DA}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "checkin", "checkin", "{15DCF7E1-1D36-4C21-A623-35A1D037A4DA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Inc.TeamAssistant.Appraiser.DataAccess.InMemory", "src\Inc.TeamAssistant.Appraiser.DataAccess.InMemory\Inc.TeamAssistant.Appraiser.DataAccess.InMemory.csproj", "{C0D1ED70-7064-4BFD-8557-19FB2918A426}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "infrastructure", "infrastructure", "{8285EFA4-C244-455D-94D1-86994A904BFF}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "frontend", "frontend", "{8285EFA4-C244-455D-94D1-86994A904BFF}"
EndProject


Expand All @@ -20,7 +20,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{1943C11E
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Inc.TeamAssistant.Appraiser.DomainTests", "tests\Inc.TeamAssistant.Appraiser.DomainTests\Inc.TeamAssistant.Appraiser.DomainTests.csproj", "{B8F7A67F-CFA3-4CF2-BACB-B14C282BF202}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "common", "common", "{BF819FCA-A383-4283-B680-4B80B7B5CA32}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "appraiser", "appraiser", "{BF819FCA-A383-4283-B680-4B80B7B5CA32}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Inc.TeamAssistant.Appraiser.Model", "src\Inc.TeamAssistant.Appraiser.Model\Inc.TeamAssistant.Appraiser.Model.csproj", "{B9C88CA2-123E-4D55-A931-91B0CFA08447}"
EndProject
Expand All @@ -42,16 +42,22 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Inc.TeamAssistant.Appraiser
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Inc.TeamAssistant.Appraiser.PrimitivesTests", "tests\Inc.TeamAssistant.Appraiser.PrimitivesTests\Inc.TeamAssistant.Appraiser.PrimitivesTests.csproj", "{EDDAA1F7-5B38-4932-9FCE-05486134097D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Inc.TeamAssistant.CheckIn.All", "src\Inc.TeamAssistant.CheckIn.All\Inc.TeamAssistant.CheckIn.All.csproj", "{16408C70-078E-4322-970D-1964C9608158}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Inc.TeamAssistant.CheckIn.Application", "src\Inc.TeamAssistant.CheckIn.Application\Inc.TeamAssistant.CheckIn.Application.csproj", "{16408C70-078E-4322-970D-1964C9608158}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Inc.TeamAssistant.Reviewer.All", "src\Inc.TeamAssistant.Reviewer.All\Inc.TeamAssistant.Reviewer.All.csproj", "{23EF103D-FA94-40EA-BB7E-F3387D15E6A1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "modules", "modules", "{70E979AF-B6E2-4044-9161-91FA02A2644F}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "reviewer", "reviewer", "{70E979AF-B6E2-4044-9161-91FA02A2644F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Inc.TeamAssistant.WebUI", "src\Inc.TeamAssistant.WebUI\Inc.TeamAssistant.WebUI.csproj", "{642949CD-0C5B-4596-9165-A7338DE1D88F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Inc.TeamAssistant.Reviewer.AllTests", "tests\Inc.TeamAssistant.Reviewer.AllTests\Inc.TeamAssistant.Reviewer.AllTests.csproj", "{428A2391-4DEB-40AF-9591-D8BA7123429F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Inc.TeamAssistant.CheckIn.Domain", "src\Inc.TeamAssistant.CheckIn.Domain\Inc.TeamAssistant.CheckIn.Domain.csproj", "{09877689-83E7-4BBB-ABE8-6DDB59E09BCA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Inc.TeamAssistant.CheckIn.DataAccess", "src\Inc.TeamAssistant.CheckIn.DataAccess\Inc.TeamAssistant.CheckIn.DataAccess.csproj", "{FAD42E3A-8AD4-4FF2-B94D-25921937033B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Inc.TeamAssistant.CheckIn.Model", "src\Inc.TeamAssistant.CheckIn.Model\Inc.TeamAssistant.CheckIn.Model.csproj", "{9A44D500-411B-46B9-90CB-FC220F9BB5F7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -128,29 +134,44 @@ Global
{428A2391-4DEB-40AF-9591-D8BA7123429F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{428A2391-4DEB-40AF-9591-D8BA7123429F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{428A2391-4DEB-40AF-9591-D8BA7123429F}.Release|Any CPU.Build.0 = Release|Any CPU
{09877689-83E7-4BBB-ABE8-6DDB59E09BCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{09877689-83E7-4BBB-ABE8-6DDB59E09BCA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{09877689-83E7-4BBB-ABE8-6DDB59E09BCA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{09877689-83E7-4BBB-ABE8-6DDB59E09BCA}.Release|Any CPU.Build.0 = Release|Any CPU
{FAD42E3A-8AD4-4FF2-B94D-25921937033B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FAD42E3A-8AD4-4FF2-B94D-25921937033B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FAD42E3A-8AD4-4FF2-B94D-25921937033B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FAD42E3A-8AD4-4FF2-B94D-25921937033B}.Release|Any CPU.Build.0 = Release|Any CPU
{9A44D500-411B-46B9-90CB-FC220F9BB5F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9A44D500-411B-46B9-90CB-FC220F9BB5F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9A44D500-411B-46B9-90CB-FC220F9BB5F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9A44D500-411B-46B9-90CB-FC220F9BB5F7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{33B4F8C6-954D-4DB7-9B36-A361D3AE867C} = {15DCF7E1-1D36-4C21-A623-35A1D037A4DA}
{9F662515-1BAD-4BCC-B8EC-184124B163C4} = {15DCF7E1-1D36-4C21-A623-35A1D037A4DA}
{C0D1ED70-7064-4BFD-8557-19FB2918A426} = {8285EFA4-C244-455D-94D1-86994A904BFF}
{E2A11CB2-5CEF-4137-93CA-A7BB3D44F00A} = {8285EFA4-C244-455D-94D1-86994A904BFF}
{B8F7A67F-CFA3-4CF2-BACB-B14C282BF202} = {1943C11E-7A4A-4300-BDC1-DA333BD3EBED}
{B9C88CA2-123E-4D55-A931-91B0CFA08447} = {BF819FCA-A383-4283-B680-4B80B7B5CA32}
{61649230-BDDC-4916-BD91-76125E1297C3} = {73CA6C4E-FE60-4BEF-9902-FFA9241616F9}
{8285EFA4-C244-455D-94D1-86994A904BFF} = {73CA6C4E-FE60-4BEF-9902-FFA9241616F9}
{15DCF7E1-1D36-4C21-A623-35A1D037A4DA} = {73CA6C4E-FE60-4BEF-9902-FFA9241616F9}
{BF819FCA-A383-4283-B680-4B80B7B5CA32} = {73CA6C4E-FE60-4BEF-9902-FFA9241616F9}
{74473972-177A-4BF8-ACAA-0EBB619E5C59} = {1943C11E-7A4A-4300-BDC1-DA333BD3EBED}
{BCAEF60E-28CD-4315-8A95-2737F4FC18B1} = {8285EFA4-C244-455D-94D1-86994A904BFF}
{7683BC47-3CD1-4F24-8571-EF8E61340045} = {73CA6C4E-FE60-4BEF-9902-FFA9241616F9}
{6E3EBCF7-4BA6-4635-B242-D5812775301C} = {7683BC47-3CD1-4F24-8571-EF8E61340045}
{AD512F03-E2F2-49A2-BA51-54845B229B9E} = {7683BC47-3CD1-4F24-8571-EF8E61340045}
{FB5621C7-106D-479E-B977-80E967242275} = {BF819FCA-A383-4283-B680-4B80B7B5CA32}
{EDDAA1F7-5B38-4932-9FCE-05486134097D} = {1943C11E-7A4A-4300-BDC1-DA333BD3EBED}
{70E979AF-B6E2-4044-9161-91FA02A2644F} = {73CA6C4E-FE60-4BEF-9902-FFA9241616F9}
{16408C70-078E-4322-970D-1964C9608158} = {70E979AF-B6E2-4044-9161-91FA02A2644F}
{23EF103D-FA94-40EA-BB7E-F3387D15E6A1} = {70E979AF-B6E2-4044-9161-91FA02A2644F}
{642949CD-0C5B-4596-9165-A7338DE1D88F} = {73CA6C4E-FE60-4BEF-9902-FFA9241616F9}
{428A2391-4DEB-40AF-9591-D8BA7123429F} = {1943C11E-7A4A-4300-BDC1-DA333BD3EBED}
{33B4F8C6-954D-4DB7-9B36-A361D3AE867C} = {BF819FCA-A383-4283-B680-4B80B7B5CA32}
{9F662515-1BAD-4BCC-B8EC-184124B163C4} = {BF819FCA-A383-4283-B680-4B80B7B5CA32}
{C0D1ED70-7064-4BFD-8557-19FB2918A426} = {BF819FCA-A383-4283-B680-4B80B7B5CA32}
{BCAEF60E-28CD-4315-8A95-2737F4FC18B1} = {BF819FCA-A383-4283-B680-4B80B7B5CA32}
{E2A11CB2-5CEF-4137-93CA-A7BB3D44F00A} = {BF819FCA-A383-4283-B680-4B80B7B5CA32}
{16408C70-078E-4322-970D-1964C9608158} = {15DCF7E1-1D36-4C21-A623-35A1D037A4DA}
{FAD42E3A-8AD4-4FF2-B94D-25921937033B} = {15DCF7E1-1D36-4C21-A623-35A1D037A4DA}
{09877689-83E7-4BBB-ABE8-6DDB59E09BCA} = {15DCF7E1-1D36-4C21-A623-35A1D037A4DA}
{61649230-BDDC-4916-BD91-76125E1297C3} = {8285EFA4-C244-455D-94D1-86994A904BFF}
{642949CD-0C5B-4596-9165-A7338DE1D88F} = {8285EFA4-C244-455D-94D1-86994A904BFF}
{9A44D500-411B-46B9-90CB-FC220F9BB5F7} = {15DCF7E1-1D36-4C21-A623-35A1D037A4DA}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ public static IServiceCollection AddApplication(this IServiceCollection services

services
.AddSingleton(addStoryOptions)
.AddMediatR(c =>
{
c.Lifetime = ServiceLifetime.Scoped;
c.RegisterServicesFromAssemblyContaining<AddStoryToAssessmentSessionCommandHandler>();
})
.AddValidatorsFromAssemblyContaining<AddStoryToAssessmentSessionCommandValidator>(
ServiceLifetime.Scoped,
includeInternalTypes: true)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Inc.TeamAssistant.Appraiser.Model.CheckIn;
using Inc.TeamAssistant.CheckIn.Model;
using Microsoft.AspNetCore.Mvc;

namespace Inc.TeamAssistant.Appraiser.Backend.Controllers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Inc.TeamAssistant.Appraiser.Application\Inc.TeamAssistant.Appraiser.Application.csproj" />
<ProjectReference Include="..\Inc.TeamAssistant.CheckIn.DataAccess\Inc.TeamAssistant.CheckIn.DataAccess.csproj" />
<ProjectReference Include="..\Inc.TeamAssistant.WebUI\Inc.TeamAssistant.WebUI.csproj" />
<ProjectReference Include="..\Inc.TeamAssistant.Appraiser.DataAccess.InMemory\Inc.TeamAssistant.Appraiser.DataAccess.InMemory.csproj" />
<ProjectReference Include="..\Inc.TeamAssistant.Appraiser.DataAccess.Postgres\Inc.TeamAssistant.Appraiser.DataAccess.Postgres.csproj" />
<ProjectReference Include="..\Inc.TeamAssistant.Appraiser.Notifications\Inc.TeamAssistant.Appraiser.Notifications.csproj" />
<ProjectReference Include="..\Inc.TeamAssistant.CheckIn.All\Inc.TeamAssistant.CheckIn.All.csproj" />
<ProjectReference Include="..\Inc.TeamAssistant.CheckIn.Application\Inc.TeamAssistant.CheckIn.Application.csproj" />
<ProjectReference Include="..\Inc.TeamAssistant.Reviewer.All\Inc.TeamAssistant.Reviewer.All.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="GeoTimeZone" Version="5.3.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="7.0.11" />
<PackageReference Include="Net.Codecrete.QrCodeGenerator" Version="2.0.3" />
<PackageReference Include="QRCoder" Version="1.4.3" />
Expand Down
21 changes: 16 additions & 5 deletions src/Inc.TeamAssistant.Appraiser.Backend/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Inc.TeamAssistant.Appraiser.Application;
using Inc.TeamAssistant.Appraiser.Application.Contracts;
using Inc.TeamAssistant.Appraiser.Backend;
using Inc.TeamAssistant.Appraiser.Backend.Hubs;
using Inc.TeamAssistant.Appraiser.Backend.Services;
Expand All @@ -7,9 +8,11 @@
using Inc.TeamAssistant.WebUI.Services;
using Inc.TeamAssistant.Appraiser.DataAccess.InMemory;
using Inc.TeamAssistant.Appraiser.DataAccess.Postgres;
using Inc.TeamAssistant.Appraiser.Model.CheckIn;
using Inc.TeamAssistant.Appraiser.Notifications;
using Inc.TeamAssistant.CheckIn.All;
using Inc.TeamAssistant.CheckIn.Application;
using Inc.TeamAssistant.CheckIn.Application.Contracts;
using Inc.TeamAssistant.CheckIn.DataAccess;
using Inc.TeamAssistant.CheckIn.Model;
using Inc.TeamAssistant.Reviewer.All;
using Inc.TeamAssistant.Reviewer.All.DialogContinuations;
using Inc.TeamAssistant.Reviewer.All.Holidays;
Expand All @@ -25,16 +28,24 @@
var holidayOptions = builder.Configuration.GetRequiredSection(nameof(HolidayOptions)).Get<HolidayOptions>()!;

builder.Services
.AddMediatR(c =>
{
c.Lifetime = ServiceLifetime.Scoped;
c.RegisterServicesFromAssemblyContaining<IAssessmentSessionRepository>();
c.RegisterServicesFromAssemblyContaining<ILocationsRepository>();
})

.AddApplication(builder.Configuration)
.AddInMemoryDataAccess()
.AddPostgresDataAccess(connectionString, Settings.AnonymousUser)
.AddNotifications()
.AddServices(telegramBotOptions, builder.Environment.WebRootPath)

.AddSingleton<ICheckInService, CheckInService>()
.AddScoped<ICheckInService, CheckInService>()
.AddScoped<ILocationBuilder, DummyLocationBuilder>()
.AddScoped<Inc.TeamAssistant.CheckIn.All.Contracts.ITranslateProvider, TranslateProvider>()
.AddCheckIn(checkInOptions, connectionString)
.AddScoped<ITranslateProvider, TranslateProvider>()
.AddCheckInApplication(checkInOptions)
.AddCheckInDataAccess(connectionString)

.AddScoped<Inc.TeamAssistant.Reviewer.All.Contracts.ITranslateProvider, TranslateProvider>()
.AddReviewer(reviewerOptions, connectionString)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,66 +1,32 @@
using GeoTimeZone;
using Inc.TeamAssistant.Appraiser.Model.CheckIn;
using Inc.TeamAssistant.Appraiser.Model.CheckIn.Queries.GetLocations;
using Inc.TeamAssistant.Appraiser.Model.Common;
using Inc.TeamAssistant.CheckIn.All.Contracts;
using Inc.TeamAssistant.CheckIn.All.Model;
using Inc.TeamAssistant.CheckIn.Model;
using Inc.TeamAssistant.CheckIn.Model.Queries.GetLocations;
using MediatR;

namespace Inc.TeamAssistant.Appraiser.Backend.Services.CheckIn;

internal sealed class CheckInService : ICheckInService
{
private readonly ILocationsRepository _locationsRepository;
private readonly ILogger<CheckInService> _logger;
private readonly IMediator _mediator;

public CheckInService(ILocationsRepository locationsRepository, ILogger<CheckInService> logger)
public CheckInService(IMediator mediator)
{
_locationsRepository = locationsRepository ?? throw new ArgumentNullException(nameof(locationsRepository));
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
_mediator = mediator ?? throw new ArgumentNullException(nameof(mediator));
}

public async Task<ServiceResult<GetLocationsResult?>> GetLocations(Guid mapId, CancellationToken cancellationToken)
{
try
{
var locations = await _locationsRepository.GetLocations(mapId, cancellationToken);
var result = await _mediator.Send(new GetLocationsQuery(mapId), cancellationToken);

return locations.Any()
? ServiceResult.Success((GetLocationsResult?)new(locations
.GroupBy(l => l.DisplayName)
.ToDictionary(l => l.Key, l => (IReadOnlyCollection<LocationDto>)l
.OrderByDescending(i => i.Created)
.Select(ConvertFrom)
.ToArray())))
return result.Locations.Any()
? ServiceResult.Success((GetLocationsResult?)result)
: ServiceResult.NotFound<GetLocationsResult?>();
}
catch (Exception ex)
{
return ServiceResult.Failed<GetLocationsResult?>(ex.Message);
}
}

private LocationDto ConvertFrom(LocationOnMap location)
{
if (location is null)
throw new ArgumentNullException(nameof(location));

TimeSpan? baseUtcOffset = null;

try
{
var timeZoneId = TimeZoneLookup.GetTimeZone(location.Latitude, location.Longitude).Result;
var timeZone = TimeZoneInfo.FindSystemTimeZoneById(timeZoneId);
baseUtcOffset = timeZone.BaseUtcOffset;
}
catch (Exception ex)
{
_logger.LogWarning(
ex,
"Can not detect time zone for location (Latitude: {Latitude}, Longitude: {Longitude})",
location.Latitude,
location.Longitude);
}

return new(location.DisplayName, location.Longitude, location.Latitude, baseUtcOffset);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Inc.TeamAssistant.Appraiser.Model.CheckIn;
using Inc.TeamAssistant.Appraiser.Model.CheckIn.Queries.GetLocations;
using Inc.TeamAssistant.CheckIn.Model;
using Inc.TeamAssistant.CheckIn.Model.Queries.GetLocations;

namespace Inc.TeamAssistant.Appraiser.Backend.Services.CheckIn;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Inc.TeamAssistant.Appraiser.Application.Contracts;
using Inc.TeamAssistant.Appraiser.Primitives;
using Inc.TeamAssistant.CheckIn.All.Contracts;
using Inc.TeamAssistant.CheckIn.Application.Contracts;

namespace Inc.TeamAssistant.Appraiser.Backend.Services.CheckIn;

Expand Down
34 changes: 0 additions & 34 deletions src/Inc.TeamAssistant.CheckIn.All/ServiceCollectionExtensions.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Inc.TeamAssistant.CheckIn.All;
namespace Inc.TeamAssistant.CheckIn.Application;

public sealed class CheckInOptions
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using Inc.TeamAssistant.CheckIn.Application.Contracts;
using Inc.TeamAssistant.CheckIn.Domain;
using Inc.TeamAssistant.CheckIn.Model.Commands.AddLocationToMap;
using MediatR;

namespace Inc.TeamAssistant.CheckIn.Application.CommandHandlers.AddLocationToMap;

internal sealed class AddLocationToMapCommandHandler : IRequestHandler<AddLocationToMapCommand, AddLocationToMapResult>
{
private readonly ILocationsRepository _locationsRepository;

public AddLocationToMapCommandHandler(ILocationsRepository locationsRepository)
{
_locationsRepository = locationsRepository ?? throw new ArgumentNullException(nameof(locationsRepository));
}

public async Task<AddLocationToMapResult> Handle(
AddLocationToMapCommand command,
CancellationToken cancellationToken)
{
if (command is null)
throw new ArgumentNullException(nameof(command));

var existsMap = await _locationsRepository.Find(command.ChatId, cancellationToken);
var map = existsMap ?? new(command.ChatId);

var location = new LocationOnMap(
command.UserId,
command.DisplayName,
command.Longitude,
command.Latitude,
command.Data,
map);

await _locationsRepository.Insert(location, cancellationToken);

return new AddLocationToMapResult(map.Id, FirstLocationOnMap: existsMap is null);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Inc.TeamAssistant.CheckIn.All.Model;
using Inc.TeamAssistant.CheckIn.Domain;

namespace Inc.TeamAssistant.CheckIn.All.Contracts;
namespace Inc.TeamAssistant.CheckIn.Application.Contracts;

public interface ILocationsRepository
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Inc.TeamAssistant.Appraiser.Primitives;

namespace Inc.TeamAssistant.CheckIn.All.Contracts;
namespace Inc.TeamAssistant.CheckIn.Application.Contracts;

public interface ITranslateProvider
{
Expand Down
Loading

0 comments on commit a3b6c85

Please sign in to comment.