-
Notifications
You must be signed in to change notification settings - Fork 8
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
[CPDLP-3228] NPQ MVP Prep - Disable NPQ endpoints in ECF specific separation environment #5027
[CPDLP-3228] NPQ MVP Prep - Disable NPQ endpoints in ECF specific separation environment #5027
Conversation
df70c3f
to
bda6e60
Compare
Review app deployed to https://cpd-ecf-review-5027-web.test.teacherservices.cloud |
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.
could we also disable NPQ statements as well from the statements joint endpoint?
service = RecordDeclaration.new({ cpd_lead_provider: }.merge(permitted_params["attributes"] || {})) | ||
attributes = permitted_params["attributes"] || {} | ||
|
||
if FeatureFlag.active?(:disable_npq_endpoints) && attributes[:course_identifier].to_s.starts_with?("npq-") |
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 understand why we might have this at the controller level, is there an argument of having this check at the record service level instead 🤔
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.
As we can identify the NPQ declarations, I think it's best to return as soon as possible; that way, we don't interfere with the service classes.
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.
The feature check is now done in RecordDeclaration
service class
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.
Hi @mooktakim
Think /api/v{1}{2}{3}/participant-declarations/{id}/void
is a shared endpoint as well as the statements one like @cwrw said?
As an idea, maybe we could return a deprecation warning do LPs rather than a 404 error?
@leandroalemao Good question, LPs asked for a "sandbox" like environment without the NPQ endpoints, so we have to disable them, also this will probably be used when we switch off the service so we need to completely disable those |
bda6e60
to
1f6b485
Compare
1f6b485
to
4bc13c6
Compare
@leandroalemao added void endpoints now too |
lib/npq_api_endpoint_route.rb
Outdated
|
||
class NpqApiEndpointRoute | ||
def self.matches?(_request) | ||
!FeatureFlag.active?(:disable_npq_endpoints) |
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 wonder if we should change this to check the ENV is separation instead and switch it to the feature flag later to avoid hitting the db everytime those URLs are hit? let's discuss
1dc4034
to
7fb238f
Compare
765078d
to
b2435b7
Compare
a624d14
to
9eb7a51
Compare
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.
Looking good.. thanks @mooktakim 👍 😄
9eb7a51
to
a2f4991
Compare
a2f4991
to
fda99b8
Compare
@@ -23,6 +23,10 @@ def statements | |||
cohort_id: cohorts.map(&:id), | |||
) | |||
|
|||
if NpqApiEndpoint.disable_npq_endpoints? |
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 wonder if we can use statement_class
and only return Finance::Statement::ECF
there instead to avoid the extra queries here might be simpler, similar to the declaration query?
44dcc9c
to
da1fdea
Compare
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.
thank you @mooktakim ! Looks great, after this is tested we will need to wait for the separation env to be ready then we can switch the config to that from review and merge 🙌
da1fdea
to
bb30096
Compare
config/environments/migration.rb
Outdated
@@ -8,4 +8,9 @@ | |||
|
|||
# Used to handle HTTP_X_WITH_SERVER_DATE header for server side datetime overwrite | |||
config.middleware.use TimeTraveler | |||
|
|||
# Enable/disable aspects of the separation environment |
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.
sorry could this move to separation instead of migration env? :D
…aration environment
…fig.separation[:disable_npq_endpoints]
bb30096
to
f8e2ce8
Compare
Context
Changes proposed in this pull request
disable_npq_endpoints
feature addedNpqApiEndpointRoute
created to constraint NPQ routescourse_identifier
includes npq courseParticipantDeclarations::Index
updated to not return NPQ declarations if feature enabledApi::V3::ParticipantDeclarationsQuery
updated to not return NPQ declarations if feature enabledGuidance to review