mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 11:26:27 +00:00
Implemented pagination in profile list
This commit is contained in:
1 parent
cfb39b986d
commit
7c19937bce
11 files changed
+210
-134
No files matched your search
@@ -13,8 +13,10 @@
|
||||
<PackageReference Include="IdentityModel" Version="6.1.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
|
||||
<PackageReference Include="ReactiveUI" Version="18.4.26" />
|
||||
<PackageReference Include="StrawberryShake.Server" Version="13.0.5" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.31.0" />
|
||||
<PackageReference Include="System.Reactive" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
using System.Reactive.Linq;
|
||||
using ReactiveUI;
|
||||
using StrawberryShake;
|
||||
|
||||
namespace Artemis.WebClient.Workshop.Extensions;
|
||||
|
||||
public static class ReactiveExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Projects the data of the provided operation result into a new observable sequence if the result is successfull and
|
||||
/// contains data.
|
||||
/// </summary>
|
||||
/// <param name="source">A sequence of operation results to invoke a transform function on.</param>
|
||||
/// <param name="selector">A transform function to apply to the data of each source element.</param>
|
||||
/// <typeparam name="TSource">The type of data contained in the operation result.</typeparam>
|
||||
/// <typeparam name="TResult">The type of data to project from the result.</typeparam>
|
||||
/// <returns>
|
||||
/// An observable sequence whose elements are the result of invoking the transform function on each element of
|
||||
/// source.
|
||||
/// </returns>
|
||||
public static IObservable<TResult> SelectOperationResult<TSource, TResult>(this IObservable<IOperationResult<TSource>> source, Func<TSource, TResult?> selector) where TSource : class
|
||||
{
|
||||
return source
|
||||
.Where(s => !s.Errors.Any())
|
||||
.Select(s => s.Data)
|
||||
.WhereNotNull()
|
||||
.Select(selector)
|
||||
.WhereNotNull();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
query GetEntries($filter: EntryFilterInput) {
|
||||
entries(where: $filter) {
|
||||
nodes {
|
||||
query GetEntries($filter: EntryFilterInput $skip: Int $take: Int) {
|
||||
entries(where: $filter skip: $skip take: $take) {
|
||||
totalCount
|
||||
items {
|
||||
id
|
||||
author
|
||||
name
|
||||
|
||||
@@ -11,24 +11,21 @@ type Category {
|
||||
name: String!
|
||||
}
|
||||
|
||||
"A connection to a list of items."
|
||||
type EntriesConnection {
|
||||
"A list of edges."
|
||||
edges: [EntriesEdge!]
|
||||
"A flattened list of the nodes."
|
||||
nodes: [Entry!]
|
||||
"Information to aid in pagination."
|
||||
pageInfo: PageInfo!
|
||||
"Identifies the total count of items in the connection."
|
||||
totalCount: Int!
|
||||
"Information about the offset pagination."
|
||||
type CollectionSegmentInfo {
|
||||
"Indicates whether more items exist following the set defined by the clients arguments."
|
||||
hasNextPage: Boolean!
|
||||
"Indicates whether more items exist prior the set defined by the clients arguments."
|
||||
hasPreviousPage: Boolean!
|
||||
}
|
||||
|
||||
"An edge in a connection."
|
||||
type EntriesEdge {
|
||||
"A cursor for use in pagination."
|
||||
cursor: String!
|
||||
"The item at the end of the edge."
|
||||
node: Entry!
|
||||
"A segment of a collection."
|
||||
type EntriesCollectionSegment {
|
||||
"A flattened list of the items."
|
||||
items: [Entry!]
|
||||
"Information to aid in pagination."
|
||||
pageInfo: CollectionSegmentInfo!
|
||||
totalCount: Int!
|
||||
}
|
||||
|
||||
type Entry {
|
||||
@@ -54,35 +51,13 @@ type Image {
|
||||
}
|
||||
|
||||
type Mutation {
|
||||
addEntry(input: EntryInput!): Entry
|
||||
}
|
||||
|
||||
"Information about pagination in a connection."
|
||||
type PageInfo {
|
||||
"When paginating forwards, the cursor to continue."
|
||||
endCursor: String
|
||||
"Indicates whether more edges exist following the set defined by the clients arguments."
|
||||
hasNextPage: Boolean!
|
||||
"Indicates whether more edges exist prior the set defined by the clients arguments."
|
||||
hasPreviousPage: Boolean!
|
||||
"When paginating backwards, the cursor to continue."
|
||||
startCursor: String
|
||||
addEntry(input: CreateEntryInput!): Entry
|
||||
updateEntry(input: UpdateEntryInput!): Entry
|
||||
}
|
||||
|
||||
type Query {
|
||||
categories(order: [CategorySortInput!], where: CategoryFilterInput): [Category!]!
|
||||
entries(
|
||||
"Returns the elements in the list that come after the specified cursor."
|
||||
after: String,
|
||||
"Returns the elements in the list that come before the specified cursor."
|
||||
before: String,
|
||||
"Returns the first _n_ elements from the list."
|
||||
first: Int,
|
||||
"Returns the last _n_ elements from the list."
|
||||
last: Int,
|
||||
order: [EntrySortInput!],
|
||||
where: EntryFilterInput
|
||||
): EntriesConnection
|
||||
entries(order: [EntrySortInput!], skip: Int, take: Int, where: EntryFilterInput): EntriesCollectionSegment
|
||||
entry(id: UUID!): Entry
|
||||
searchEntries(input: String!, order: [EntrySortInput!], type: EntryType, where: EntryFilterInput): [Entry!]!
|
||||
}
|
||||
@@ -142,6 +117,15 @@ input CategorySortInput {
|
||||
name: SortEnumType
|
||||
}
|
||||
|
||||
input CreateEntryInput {
|
||||
categories: [Int!]!
|
||||
description: String!
|
||||
entryType: EntryType!
|
||||
name: String!
|
||||
summary: String!
|
||||
tags: [String!]!
|
||||
}
|
||||
|
||||
input DateTimeOperationFilterInput {
|
||||
eq: DateTime
|
||||
gt: DateTime
|
||||
@@ -176,13 +160,6 @@ input EntryFilterInput {
|
||||
tags: ListFilterInputTypeOfTagFilterInput
|
||||
}
|
||||
|
||||
input EntryInput {
|
||||
description: String!
|
||||
entryType: EntryType!
|
||||
name: String!
|
||||
tags: [String!]!
|
||||
}
|
||||
|
||||
input EntrySortInput {
|
||||
author: SortEnumType
|
||||
authorId: SortEnumType
|
||||
@@ -308,6 +285,15 @@ input TagFilterInput {
|
||||
or: [TagFilterInput!]
|
||||
}
|
||||
|
||||
input UpdateEntryInput {
|
||||
categories: [Int!]!
|
||||
description: String!
|
||||
id: UUID!
|
||||
name: String!
|
||||
summary: String!
|
||||
tags: [String!]!
|
||||
}
|
||||
|
||||
input UuidOperationFilterInput {
|
||||
eq: UUID
|
||||
gt: UUID
|
||||
|
||||
Reference in new issue
Block a user