-
Notifications
You must be signed in to change notification settings - Fork 20
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
Alleop - reviews and ratings to have separate from 1 to 5 starts #64
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using GraphQL; | ||
using GraphQL.Types; | ||
using ReviewsRatings.Models; | ||
using ReviewsRatings.Services; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace ReviewsRatings.GraphQL.Types | ||
{ | ||
[GraphQLMetadata("Totals")] | ||
public class TotalsType : ObjectGraphType<Totals> | ||
{ | ||
public TotalsType(IProductReviewService productReviewService) | ||
{ | ||
Name = "Range"; | ||
Field(b => b.Total5); | ||
Field(b => b.Total4); | ||
Field(b => b.Total3); | ||
Field(b => b.Total2); | ||
Field(b => b.Total1); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,5 +32,12 @@ query Reviews( | |
from | ||
to | ||
} | ||
totals { | ||
total5 | ||
total4 | ||
total3 | ||
total2 | ||
total1 | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,5 +32,12 @@ query ReviewsByProductId( | |
from | ||
to | ||
} | ||
totals { | ||
total5 | ||
total4 | ||
total3 | ||
total2 | ||
total1 | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -35,6 +35,14 @@ type Data { | |||||||||||
approved: Boolean | ||||||||||||
} | ||||||||||||
|
||||||||||||
type Totals { | ||||||||||||
total5: Int | ||||||||||||
total4: Int | ||||||||||||
total3: Int | ||||||||||||
total2: Int | ||||||||||||
total1: Int | ||||||||||||
} | ||||||||||||
|
||||||||||||
type Range { | ||||||||||||
total: Int | ||||||||||||
from: Int | ||||||||||||
|
@@ -72,6 +80,11 @@ type Query { | |||||||||||
averageRatingByProductId(productId: String!): Float | ||||||||||||
@cacheControl(scope: PRIVATE) | ||||||||||||
totalReviewsByProductId(productId: String!): Int @cacheControl(scope: PRIVATE) | ||||||||||||
totalReviewsByProductId5(productId: String!): Int @cacheControl(scope: PRIVATE) | ||||||||||||
totalReviewsByProductId4(productId: String!): Int @cacheControl(scope: PRIVATE) | ||||||||||||
totalReviewsByProductId3(productId: String!): Int @cacheControl(scope: PRIVATE) | ||||||||||||
totalReviewsByProductId2(productId: String!): Int @cacheControl(scope: PRIVATE) | ||||||||||||
totalReviewsByProductId1(productId: String!): Int @cacheControl(scope: PRIVATE) | ||||||||||||
Comment on lines
+83
to
+87
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can remove those queries and just add the new field
Suggested change
|
||||||||||||
reviewsByShopperId( | ||||||||||||
shopperId: String! | ||||||||||||
from: Int | ||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
query TotalReviewsByProductId1($productId: String!) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need to create new queries, just add a new field |
||
totalReviewsByProductId1(productId: $productId) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
query TotalReviewsByProductId2($productId: String!) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same |
||
totalReviewsByProductId2(productId: $productId) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can remove those resolvers