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

Support filtering works by multiple work_statuses and by updated_at_with_relations #484

Merged
merged 15 commits into from
Mar 20, 2023

Conversation

rhigman
Copy link
Member

@rhigman rhigman commented Mar 8, 2023

Required for automatic dissemination (initially to Crossref), where we need to find works which are either ACTIVE or FORTHCOMING, and which have had their metadata updated within a certain timeframe (i.e. since the last scheduled dissemination - as we will be making both initial submissions and updates).

Also enables filtering by multiple language_relations. Filtering by updated_at_with_relations requires specifying a timestamp and whether the field value should be greater than (after) or less than (before) this timestamp.

Copy link
Member

@ja573 ja573 left a comment

Choose a reason for hiding this comment

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

Overall, rather than TimeExpression I'm more inclined to support filtering by field more widely. Something like:

pub enum Operator {
    Eq,
    Neq,
    Gt,
    Lt,
    Gte,
    Lte,
    Ilike,
}

pub struct WorkFilter {
    pub field: WorkField,
    pub operator: Operator,
    pub value: String,
}

fn works (
        [...]
        filters: Vec<WorkFilter>,
        [...]
)

@@ -130,7 +139,13 @@ impl QueryRoot {
default = vec![],
description = "Specific types to filter by",
),
work_status(description = "A specific status to filter by"),
work_statuses(
Copy link
Member

Choose a reason for hiding this comment

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

Instead of replacing the current argument, keep both for the time being to avoid breaking dependants. The current GraphQL specification doesn't allow marking arguments as deprecated (though it will in the next release), so we'll just need to rely on using the description as the deprecation notice

@rhigman
Copy link
Member Author

rhigman commented Mar 16, 2023

As discussed, due to other priorities, we'll keep the basic TimeExpression filtering for now and improve it later under #486.

@rhigman rhigman requested a review from ja573 March 16, 2023 17:01
Copy link
Member

@ja573 ja573 left a comment

Choose a reason for hiding this comment

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

We should also keep language_relation and flag it as deprecated like work_status

@ja573
Copy link
Member

ja573 commented Mar 20, 2023

I'm just thinking that it'd also be good to update thoth-client/assets/schema.json, even though it's not exactly needed

@rhigman rhigman requested a review from ja573 March 20, 2023 10:24
@rhigman rhigman merged commit ae1d04c into develop Mar 20, 2023
@rhigman rhigman deleted the feature/crossref_schema_changes branch March 20, 2023 10:41
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