-
Notifications
You must be signed in to change notification settings - Fork 132
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
[#101] add query params for all REST methods #102
[#101] add query params for all REST methods #102
Conversation
- make interfaces small and composable - fix typos in log messages and comments
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.
I put some additional ideas about the changes I made in the code review comments.
I will run the build task after getting an approval of the changes.
@@ -32,7 +33,7 @@ export default class AdminService extends CrudService<Admin> { | |||
* If the current `client.authStore.model` matches with the updated id, then | |||
* on success the `client.authStore.model` will be updated with the result. | |||
*/ | |||
update<T = Admin>(id: string, bodyParams = {}, queryParams = {}): Promise<T> { | |||
update<T = Admin>(id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise<T> { |
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.
Here and in other methods with queryParams: BaseQueryParams
, I just assumed that all those methods will have only $autoCancel
and $cancelKey
, because I couldn't find anything more in the documentation.
@@ -11,7 +16,7 @@ export default class LogService extends BaseService { | |||
/** | |||
* Returns paginated logged requests list. | |||
*/ | |||
getRequestsList(page = 1, perPage = 30, queryParams = {}): Promise<ListResult<LogRequest>> { | |||
getRequestsList(page = 1, perPage = 30, queryParams: ListLogsQueryParams = {}): Promise<ListResult<LogRequest>> { |
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.
One could argue that GetRequestsListQueryParams
is a better name, but I'll leave it to the reviewer.
@@ -52,10 +57,20 @@ export default class LogService extends BaseService { | |||
/** | |||
* Returns request logs statistics. | |||
*/ | |||
getRequestsStats(queryParams = {}): Promise<Array<HourlyStats>> { | |||
getRequestsStats(queryParams: LogStatsQueryParams = {}): Promise<Array<HourlyStats>> { |
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.
Same as in line 19, but with GetRequestStatsQueryParams
.
expand?: string; | ||
} | ||
|
||
export interface PaginatedQueryParams { |
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.
Paginable
didn't sound right for me, but maybe it's better for consistency, I'll leave it to a reviewer's taste.
@sewera Thank you for working on this. Sometime later this week, after the blocker in pocketbase/pocketbase#1187, I'll review it in more details and will let you know if something need to change. |
@sewera To avoid the back-and-forth, I've squash merged your changes locally + applied some minor nitpickings:
You can find the changes in e860e34 (ignore the |
Alright, I'll drop something in if I have anything to add by tomorrow. |
@ganigeorgiev, I've written my comment, you can find it here. |
Resolves #101.
Brief summary of what I did:
My proposed solution for this issue was to make
a couple of different interfaces describing
the capabilities of different requests.
Please find more ideas in the in-code comments.