Skip to content
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

Add configuration settings for collections subscriptions. (PP-1850) #2153

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tdilauro
Copy link
Contributor

@tdilauro tdilauro commented Nov 4, 2024

Description

Adds start and end date configuration settings for collection subscriptions.

NB: Submitting this PR as draft, since additional work is needed fully implement the subscription functionality.

  • CM Admin UI: support date picker field in configuration forms.
  • CM backend: New functionality to use the configuration settings to block libraries from using the collection.

Motivation and Context

Support automatic activation/deactivation of library associations with a collection.

[Jira PP-1850]

How Has This Been Tested?

Checklist

  • I have updated the documentation accordingly.
  • All new and existing tests passed.

@tdilauro tdilauro requested a review from a team November 4, 2024 14:24
Copy link

codecov bot commented Nov 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.78%. Comparing base (fed3447) to head (c798d51).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2153   +/-   ##
=======================================
  Coverage   90.78%   90.78%           
=======================================
  Files         350      350           
  Lines       40608    40611    +3     
  Branches     8796     8796           
=======================================
+ Hits        36864    36867    +3     
  Misses       2439     2439           
  Partials     1305     1305           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dbernstein dbernstein self-requested a review November 4, 2024 16:37
Copy link
Member

@jonathangreen jonathangreen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some comments with a couple questions on this one

),
required=False,
),
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be adding these settings for every circulation API? It seems like we only really want them for OPDS importer based APIs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think they could be handy more generally; but, I'm fine moving them to the OPDS collections setting hierarchy for now.

I'm planning to implement the subscription (vs. association) concept across all collection types, but the absence of these settings on a collection would be interpreted as always subscribed (i.e., no restriction).

@@ -570,6 +570,33 @@ class BaseCirculationApiSettings(BaseSettings):
)
}

subscription_activation_date: str | None = FormField(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since these are coming in as dates, should we be setting the type here to reflect that, rather then just a generic str?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did try using subscription_activation_date: datetime.date | None = FormField( ... for these, but ran into type errors in Pydantic.

I can dig into that some more as I do the implementation.

@jonathangreen
Copy link
Member

I was thinking about this one, and I'm wondering if we want to store the subscription end dates as full datetime. We are going to need a particular time to say a subscription ends, and we will need to think about what timezone that should be in.

A couple options I was thinking about:

  • Have the UI allow choosing the date and time the subscription ends
  • Choose the date, and use the users timezone to come up with an end datetime that gets sent to the CM
  • Allow both selecting a date and the timezone the subscription end should be enforced in

@tdilauro
Copy link
Contributor Author

tdilauro commented Nov 25, 2024

I was thinking about this one, and I'm wondering if we want to store the subscription end dates as full datetime. We are going to need a particular time to say a subscription ends, and we will need to think about what timezone that should be in.

My original thought on this was to use UTC to make this easier to manage with the distributors, who might also be enforcing their subscriptions. It would make things simpler. If libraries are able to negotiate a single "grace" day on each end of the subscription.

We could always add an offset later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants