-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #364 from Sitecore/fix/recommit
MVP Changes Recommit
- Loading branch information
Showing
22 changed files
with
360 additions
and
252 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace Mvp.Feature.People.Models; | ||
|
||
public class AwardData | ||
{ | ||
public Awards[] TargetItems { get; set; } | ||
} |
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,10 @@ | ||
using Mvp.Foundation.DataFetching.GraphQL.Models; | ||
|
||
namespace Mvp.Feature.People.Models; | ||
|
||
public class Awards | ||
{ | ||
public NameItem Parent { get; set; } | ||
|
||
public TargetItemFieldValueItem Field { get; set; } | ||
} |
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,8 @@ | ||
using Mvp.Foundation.DataFetching.GraphQL.Models; | ||
|
||
namespace Mvp.Feature.People.Models; | ||
|
||
public class CountryData | ||
{ | ||
public TargetItem TargetItem { get; set; } | ||
} |
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,8 @@ | ||
namespace Mvp.Feature.People.Models; | ||
|
||
public class Facet | ||
{ | ||
public string Name { get; set; } | ||
public int Count { get; set; } | ||
public bool Selected { get; set; } | ||
} |
170 changes: 0 additions & 170 deletions
170
src/Feature/People/rendering/Models/MvpGraphQLModels.cs
This file was deleted.
Oops, something went wrong.
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,6 @@ | ||
namespace Mvp.Feature.People.Models; | ||
|
||
public class MvpSearchResponse | ||
{ | ||
public PeopleSearch Search { get; set; } | ||
} |
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,15 @@ | ||
using Mvp.Foundation.DataFetching.GraphQL.Models; | ||
|
||
namespace Mvp.Feature.People.Models; | ||
|
||
public class MvpSearchResult | ||
{ | ||
public string Id { get; set; } | ||
public string Name { get; set; } | ||
public string Path { get; set; } | ||
public ValueItem FirstName { get; set; } | ||
public ValueItem LastName { get; set; } | ||
public ValueItem Email { get; set; } | ||
public CountryData Country { get; set; } | ||
public AwardData Awards { get; set; } | ||
} |
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,10 @@ | ||
using Mvp.Foundation.DataFetching.GraphQL.Models; | ||
|
||
namespace Mvp.Feature.People.Models; | ||
|
||
public class PeopleSearch | ||
{ | ||
public MvpSearchResult[] Results { get; set; } | ||
public int Total { get; set; } | ||
public PageInfo PageInfo { get; set; } | ||
} |
84 changes: 84 additions & 0 deletions
84
src/Feature/People/rendering/Models/PeopleSearchResults.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,84 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Mvp.Feature.People.Models; | ||
|
||
public class PeopleSearchResults | ||
{ | ||
public IEnumerable<Person> People { get; set; } | ||
public int TotalCount { get; set; } | ||
public int CurrentPage { get; set; } | ||
public int PageSize { get; set; } | ||
public IDictionary<string, List<Facet>> Facets { get; set; } | ||
public bool HasNextPage | ||
{ | ||
get | ||
{ | ||
return CurrentPage < LastPage; | ||
} | ||
} | ||
|
||
public bool HasPreviousPage | ||
{ | ||
get | ||
{ | ||
return CurrentPage > 1; | ||
} | ||
} | ||
|
||
public int LastPage | ||
{ | ||
get | ||
{ | ||
if (TotalCount == 0 || PageSize == 0) | ||
{ | ||
return 1; | ||
} | ||
return (int)Math.Ceiling(((decimal)TotalCount) / ((decimal)PageSize)); | ||
} | ||
} | ||
|
||
public int PagerStart | ||
{ | ||
get | ||
{ | ||
if (CurrentPage > 3) | ||
{ | ||
return CurrentPage - 2; | ||
} | ||
else | ||
{ | ||
return 1; | ||
} | ||
} | ||
} | ||
|
||
public int PagerEnd | ||
{ | ||
get | ||
{ | ||
if (!HasNextPage) | ||
{ | ||
return CurrentPage; | ||
} | ||
|
||
if (CurrentPage + 2 >= LastPage) | ||
{ | ||
return LastPage; | ||
} | ||
if (CurrentPage < 2 && LastPage > 5) | ||
{ | ||
return CurrentPage + 4; | ||
} | ||
if (CurrentPage < 3 && LastPage > 5) | ||
{ | ||
return CurrentPage + 3; | ||
} | ||
if (CurrentPage < 3 && LastPage <= 5) | ||
{ | ||
return LastPage; | ||
} | ||
return CurrentPage + 2; | ||
} | ||
} | ||
} |
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,13 @@ | ||
namespace Mvp.Feature.People.Models | ||
{ | ||
public class Person | ||
{ | ||
public string FirstName { get; set; } | ||
public string LastName { get; set; } | ||
public string Email { get; set; } | ||
public string Url { get; set; } | ||
public string Country { get; set; } | ||
public string MvpYear { get; set; } | ||
public string MvpCategory { get; set; } | ||
} | ||
} |
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,21 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace Mvp.Feature.People.Models; | ||
|
||
public class SearchParams | ||
{ | ||
[FromQuery(Name = Constants.QueryParameters.Page)] | ||
public int CurrentPage { get; set; } | ||
|
||
[FromQuery(Name = Constants.QueryParameters.Query)] | ||
public string Keyword { get; set; } | ||
|
||
[FromQuery(Name = Constants.QueryParameters.FacetAward)] | ||
public string Award { get; set; } | ||
|
||
[FromQuery(Name = Constants.QueryParameters.FacetYear)] | ||
public string Year { get; set; } | ||
|
||
[FromQuery(Name = Constants.QueryParameters.FacetCountry)] | ||
public string Country { get; set; } | ||
} |
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.