airqo-platform / airqo-platform/AirQo-api

Refactor 'listExpiringTokens' and 'listExpiredTokens' to reduce code duplication

Open
#3,641 0 comments 0 reactions 1 assignee Claimed by @Baalmart View on GitHub
Dominant language
JavaScript
Stars
26
Forks
24
Avg merge
5h 36m
Merged PRs (30d)
81

Description

As per [PR #3634](https://github.com/airqo-platform/AirQo-api/pull/3634), the methods `listExpiringTokens` and `listExpiredTokens` in `src/auth-service/utils/control-access.js` have similar structures and logic, differing mainly in the function called (`getExpiringTokens` vs. `getExpiredTokens`). It is suggested to refactor these methods into a single reusable function or higher-order function that accepts a parameter to differentiate the behavior. This will enhance maintainability and reduce redundancy.

Requester: @Baalmart

[Comment Link](https://github.com/airqo-platform/AirQo-api/pull/3634#discussion_r1797805206)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.