-
Notifications
You must be signed in to change notification settings - Fork 36
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
feat (NEXP): add page instead of offset as pagination request option #243
base: master
Are you sure you want to change the base?
feat (NEXP): add page instead of offset as pagination request option #243
Conversation
… offset option mikroOrm and mongoose
… offset option mikroOrm and mongoose
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.
No entiendo los cambios de codigo que te marqué.
@@ -19,7 +17,7 @@ class ItemMikroORMRepository extends BaseMikroORMRepository<IItemDomain> impleme | |||
super(Item.name, ItemSchema); | |||
} | |||
|
|||
async list(criteria: ICriteria): Promise<IPaginator> | |||
async list(criteria: ICriteria): Promise<any> |
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.
??
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.
Actualmente el list no devuelve un IPaginator (en el de mongoose tambien estaba asi sin que lo tocara)
en cambio ambos devuelven un ResponsePayload de tipo
interface ResponsePayload { data: unknown; metadata?: unknown; }
Deberia cambiar el tipado del list (lo cual significa modificarlo en todos los dominios como en file y otras)? o mantengo el any
@@ -25,7 +25,7 @@ class CreateMikroORMConnection implements ICreateConnection | |||
{ | |||
orm = await MikroORM.init({ | |||
entities: this.entities, | |||
clientUrl: this.config.DB_URI, | |||
clientUrl: this.config.uri, |
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.
???
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.
En este caso no me tomaba el DB_URI lo cual entiendo que era la forma anterior de invocar los params del .env, ahi adapte para recibirlo por constructor en el factory insertarlo como variable privada en el objeto y utilizarla de ahi, cuando resolvamos lo del tipado del pagiantor subo ambas
Quality Gate failedFailed conditions |
📜 Description
To avoid force the frontend to calculate and offset to select a page of a pagination we move that logic to the backend
option [page] as added to Pagination object
in case that page param come we use it to calculate the correct offset and return a response to the frontend
this param has priority over "offset" param
its still an optional param so paginate its still able to work with limit and offset
if it come we take the page parameter and multiply by limit to know how much offset we need on the db query
**Notes:
Only works on Mongo queries
🧪 Accept Criteria Tests
adding a page param on should return the correct offset number
if a no existent page is passed return an empty array
🔮 Last Notes
📋 Author Checklist
📋Reviewer Checklist