refactor: extract entitlement entity names to constants#895
Conversation
Greptile SummaryThis PR extracts two repeated magic strings used in entitlement checks into exported package-level constants in
Confidence Score: 5/5Pure rename refactor with no logic changes; the constant values are identical to the original magic strings, so runtime behaviour is unchanged. Both constant values exactly match the strings they replace, the entityLimits map and both handler call sites are updated consistently, and no residual magic-string usages were found elsewhere in the codebase. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant H as Handler (Store)
participant E as EntitlementService.Check
participant L as entityLimits map
H->>E: Check(ctx, userID, EntityNameMessageSendSchedule / EntityNamePhoneAPIKey, countFunc)
E->>L: lookup entityLimits[entityName]
L-->>E: plan limits (or not found → unlimited)
E-->>H: "EntitlementCheckResult{Allowed, Message}"
Reviews (1): Last reviewed commit: "refactor: extract entitlement entity nam..." | Re-trigger Greptile |
7d6c30e to
78135be
Compare
Move EntityNameMessageSendSchedule and EntityNamePhoneAPIKey constants from the services package to their respective entity files in the entities package, keeping them co-located with the types they describe. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Replace magic strings with exported constants: services.EntityNameMessageSendSchedule and services.EntityNamePhoneAPIKey. This makes it easier to add new entitlement-limited entities and avoids typo risks.