-
Notifications
You must be signed in to change notification settings - Fork 10
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
Implemented: code to define success response schema(#85zrhhcgr) #47
base: main
Are you sure you want to change the base?
Conversation
src/types/index.ts
Outdated
interface SuccessResponse<Type> { | ||
list: Type[]; | ||
count: { | ||
[x: string]: number; |
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.
We should have attributes in count
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.
Added total
and groups
attributes at root of schema.
…ndexable types from the schema, also added the total, groups property at root(#85zrhhcgr)
src/types/index.ts
Outdated
@@ -39,6 +39,12 @@ interface Response { | |||
serverResponse?: any; | |||
} | |||
|
|||
interface SuccessResponse<Type> { |
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.
We should define practices for list and object responses, and name accordingly
Related Issues
Closes #38
Short Description and Why It's Useful
Added two different approaches for defining schema
Defined an interface using generics, so as the same can be directly used for different type of success responses. Also added another property as object
count
that contains indexable types to contains different types of count like total (for total number of products), matches (in case when we are fetching resps as groups).2.) By extending interface
Screenshots of Visual Changes before/after (If There Are Any)
Contribution and Currently Important Rules Acceptance