{"id":16498604,"url":"https://github.com/krsbx/sequelize-fqp","last_synced_at":"2026-05-05T01:37:19.075Z","repository":{"id":47054821,"uuid":"515792259","full_name":"krsbx/sequelize-fqp","owner":"krsbx","description":"Filter Query Parser for Sequelize ORM","archived":false,"fork":false,"pushed_at":"2023-11-24T13:41:02.000Z","size":788,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-25T06:01:46.653Z","etag":null,"topics":["filter","javascript","nodejs","query","sequelize","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/krsbx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":"krsbx","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":["https://trakteer.id/krsbx"]}},"created_at":"2022-07-20T01:22:27.000Z","updated_at":"2022-08-06T07:41:50.000Z","dependencies_parsed_at":"2023-11-24T14:48:48.521Z","dependency_job_id":null,"html_url":"https://github.com/krsbx/sequelize-fqp","commit_stats":{"total_commits":32,"total_committers":2,"mean_commits":16.0,"dds":0.46875,"last_synced_commit":"3c14d93a8fdf718d3ecd0913891a27878ade85d7"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krsbx%2Fsequelize-fqp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krsbx%2Fsequelize-fqp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krsbx%2Fsequelize-fqp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krsbx%2Fsequelize-fqp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krsbx","download_url":"https://codeload.github.com/krsbx/sequelize-fqp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241391319,"owners_count":19955512,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["filter","javascript","nodejs","query","sequelize","typescript"],"created_at":"2024-10-11T14:49:22.768Z","updated_at":"2026-05-05T01:37:14.013Z","avatar_url":"https://github.com/krsbx.png","language":"TypeScript","funding_links":["https://ko-fi.com/krsbx","https://trakteer.id/krsbx"],"categories":[],"sub_categories":[],"readme":"# Sequelize Filter Query Parser\n\nFilter Query Parser for Sequelize ORM\n\nUsing [filter-query-parser](https://github.com/VJD7/filter-query-parser/) as the base\n\n# How To Use\n\n1. Create a new Middleware that can be use for all routes e.g. `parserMw`\n\n- Javascript\n\n```js\n// Files :  parser.js\n\nconst sequelizeFQP = require('sequelize-filter-query-parser');\n\nexports.queryParserMw = (req, res, next) =\u003e {\n  req.filterQueryParams = req.query.filters\n    ? sequelizeFQP(req.query.filters)\n    : {};\n  next();\n};\n```\n\n- Typescript\n\n```ts\n// Files :  parser.js\n\nimport sequelizeFQP from 'sequelize-filter-query-parser';\n\nexport const queryParserMw = (req, res, next) =\u003e {\n  req.filterQueryParams = req.query.filters\n    ? sequelizeFQP(req.query.filters)\n    : {};\n  next();\n};\n```\n\n2. Use FQP Results in baseRepository\n\n- Javascript\n\n```js\n// Files : baseRepository.js\n\nexports.findAll =\n  (model) =\u003e\n  (conditions, filterQueryParams = {}, options = {}) =\u003e {\n    /* {...} */\n\n    const rules = [{ ...filterQueryParams }];\n\n    /* {...} */\n\n    const where = { ...conditions };\n\n    if (where[Op.and]) {\n      where[Op.and] = [...where[Op.and], ...rules];\n    } else {\n      where[Op.and] = rules;\n    }\n\n    /* {...} */\n  };\n```\n\n- Typescript\n\n```ts\n// Files : baseRepository.ts\n\nexport const findAll =\n  (model) =\u003e\n  (conditions, filterQueryParams = {}, options = {}) =\u003e {\n    /* {...} */\n\n    const rules = [{ ...filterQueryParams }];\n\n    /* {...} */\n\n    const where = { ...conditions };\n\n    if (where[Op.and]) {\n      where[Op.and] = [...where[Op.and], ...rules];\n    } else {\n      where[Op.and] = rules;\n    }\n\n    /* {...} */\n  };\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrsbx%2Fsequelize-fqp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrsbx%2Fsequelize-fqp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrsbx%2Fsequelize-fqp/lists"}