Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
com.akaver.sportmap
SportMap-ASPNET
Commits
4379e338
Commit
4379e338
authored
May 21, 2020
by
Andres Käver
Browse files
.net upgrade, filtering in sessions
parent
ba6ba56f
Pipeline
#831
passed with stages
in 1 minute and 43 seconds
Changes
13
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
BLL.App.DTO/BLL.App.DTO.csproj
View file @
4379e338
...
...
@@ -10,7 +10,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Text.Json" Version="4.7.
1
" />
<PackageReference Include="System.Text.Json" Version="4.7.
2
" />
</ItemGroup>
</Project>
BLL.App/Services/GpsSessionService.cs
View file @
4379e338
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
...
...
@@ -21,9 +22,9 @@ namespace BLL.App.Services
}
public
virtual
async
Task
<
IEnumerable
<
GpsSessionView
>>
GetAllForViewAsync
()
public
virtual
async
Task
<
IEnumerable
<
GpsSessionView
>>
GetAllForViewAsync
(
int
minLocationsCount
=
10
,
double
minDuration
=
60
,
double
minDistance
=
10
,
DateTime
?
fromDateTime
=
null
,
DateTime
?
toDateTime
=
null
)
{
return
(
await
Repository
.
GetAllForViewAsync
()).
Select
(
e
=>
Mapper
.
MapGpsSessionView
(
e
));
return
(
await
Repository
.
GetAllForViewAsync
(
minLocationsCount
,
minDuration
,
minDistance
,
fromDateTime
,
toDateTime
)).
Select
(
e
=>
Mapper
.
MapGpsSessionView
(
e
));
}
}
}
\ No newline at end of file
Contracts.DAL.App/Repositories/IGpsSessionRepositoryCustom.cs
View file @
4379e338
using
System
;
using
System.Collections.Generic
;
using
System.Threading.Tasks
;
using
DAL.App.DTO
;
...
...
@@ -10,6 +11,6 @@ namespace Contracts.DAL.App.Repositories
public
interface
IGpsSessionRepositoryCustom
<
TGpsSessionView
>
{
Task
<
IEnumerable
<
TGpsSessionView
>>
GetAllForViewAsync
();
Task
<
IEnumerable
<
TGpsSessionView
>>
GetAllForViewAsync
(
int
minLocationsCount
=
10
,
double
minDuration
=
60
,
double
minDistance
=
10
,
DateTime
?
fromDateTime
=
null
,
DateTime
?
toDateTime
=
null
);
}
}
\ No newline at end of file
Contracts.DAL.Base/Contracts.DAL.Base.csproj
View file @
4379e338
...
...
@@ -6,7 +6,7 @@
<ItemGroup>
<PackageReference Include="com.akaver.sportmap.Contracts.Domain" Version="1.0.0" />
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="3.1.
3
" />
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="3.1.
4
" />
</ItemGroup>
</Project>
DAL.App.EF/DAL.App.EF.csproj
View file @
4379e338
...
...
@@ -5,9 +5,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.
3
" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.
3
" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.
3
" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.
4
" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.
4
" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.
4
" />
</ItemGroup>
<ItemGroup>
...
...
DAL.App.EF/Repositories/GpsSessionRepository.cs
View file @
4379e338
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
...
...
@@ -34,14 +35,29 @@ namespace DAL.App.EF.Repositories
return
result
;
}
public
virtual
async
Task
<
IEnumerable
<
GpsSessionView
>>
GetAllForViewAsync
()
public
virtual
async
Task
<
IEnumerable
<
GpsSessionView
>>
GetAllForViewAsync
(
int
minLocationsCount
=
10
,
double
minDuration
=
60
,
double
minDistance
=
10
,
DateTime
?
fromDateTime
=
null
,
DateTime
?
toDateTime
=
null
)
{
return
await
RepoDbSet
var
query
=
RepoDbSet
.
Include
(
a
=>
a
.
GpsSessionType
)
.
ThenInclude
(
a
=>
a
!.
Name
)
.
ThenInclude
(
a
=>
a
!.
Translations
)
.
Where
(
a
=>
a
.
GpsLocations
!.
Count
>=
10
)
.
OrderByDescending
(
a
=>
a
.
RecordedAt
)
.
Where
(
a
=>
a
.
GpsLocations
!.
Count
>=
minLocationsCount
&&
a
.
Duration
>=
minDuration
&&
a
.
Distance
>=
minDistance
);
if
(
fromDateTime
!=
null
)
{
query
=
query
.
Where
(
a
=>
a
.
RecordedAt
>=
fromDateTime
);
}
if
(
toDateTime
!=
null
)
{
query
=
query
.
Where
(
a
=>
a
.
RecordedAt
<=
toDateTime
);
}
query
=
query
.
OrderByDescending
(
a
=>
a
.
RecordedAt
);
var
result
=
await
query
.
Select
(
a
=>
new
GpsSessionView
()
{
Id
=
a
.
Id
,
...
...
@@ -59,6 +75,8 @@ namespace DAL.App.EF.Repositories
GpsSessionType
=
a
.
GpsSessionType
!.
Name
,
UserFirstLastName
=
a
.
AppUser
!.
FirstName
+
" "
+
a
.
AppUser
!.
LastName
,
}).
ToListAsync
();
return
result
;
}
}
}
\ No newline at end of file
DAL.Base.EF/DAL.Base.EF.csproj
View file @
4379e338
...
...
@@ -10,7 +10,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.
3
" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.
4
" />
</ItemGroup>
</Project>
DAL.Base/DAL.Base.csproj
View file @
4379e338
...
...
@@ -11,7 +11,7 @@
<ItemGroup>
<PackageReference Include="AutoMapper" Version="9.0.0" />
<PackageReference Include="System.Text.Json" Version="4.7.
1
" />
<PackageReference Include="System.Text.Json" Version="4.7.
2
" />
</ItemGroup>
</Project>
Domain.App/Domain.App.csproj
View file @
4379e338
...
...
@@ -5,7 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="3.1.
3
" />
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="3.1.
4
" />
</ItemGroup>
<ItemGroup>
...
...
Domain.Base/Domain.Base.csproj
View file @
4379e338
...
...
@@ -10,7 +10,7 @@
<ItemGroup>
<PackageReference Include="com.akaver.sportmap.Contracts.Domain" Version="1.0.0" />
<PackageReference Include="System.Text.Json" Version="4.7.
1
" />
<PackageReference Include="System.Text.Json" Version="4.7.
2
" />
</ItemGroup>
</Project>
Extensions/Extensions.csproj
View file @
4379e338
...
...
@@ -5,8 +5,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="6.5.
0
" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.5.
0
" />
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="6.5.
1
" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.5.
1
" />
</ItemGroup>
</Project>
WebApp/ApiControllers/1.0/GpsSessionsController.cs
View file @
4379e338
...
...
@@ -42,9 +42,11 @@ namespace WebApp.ApiControllers._1._0
[
AllowAnonymous
]
[
Produces
(
"application/json"
)]
[
ProducesResponseType
(
StatusCodes
.
Status200OK
,
Type
=
typeof
(
IEnumerable
<
V1DTO
.
GpsSessionView
>))]
public
async
Task
<
ActionResult
<
IEnumerable
<
V1DTO
.
GpsSessionView
>>>
GetGpsSessions
()
public
async
Task
<
ActionResult
<
IEnumerable
<
V1DTO
.
GpsSessionView
>>>
GetGpsSessions
(
int
minLocationsCount
=
10
,
double
minDuration
=
60
,
double
minDistance
=
10
,
DateTime
?
fromDateTime
=
null
,
DateTime
?
toDateTime
=
null
)
{
var
result
=
await
_bll
.
GpsSessions
.
GetAllForViewAsync
();
var
result
=
await
_bll
.
GpsSessions
.
GetAllForViewAsync
(
minLocationsCount
,
minDuration
,
minDistance
,
fromDateTime
,
toDateTime
);
return
Ok
(
result
.
Select
(
e
=>
_mapper
.
MapGpsSessionView
(
e
)));
}
...
...
WebApp/WebApp.csproj
View file @
4379e338
...
...
@@ -10,16 +10,16 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.
3
" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="3.1.
3
" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.
3
" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="3.1.
3
" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.
4
" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="3.1.
4
" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.
4
" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="3.1.
4
" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="4.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="4.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.
3
" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.
3
" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.
2
" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.
3.3
" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.
4
" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.
4
" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.
3
" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.
4.1
" />
</ItemGroup>
<ItemGroup>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment