guardian / typerighter

Even if you’re the right typer, couldn’t hurt to use Typerighter!
Apache License 2.0
276 stars 12 forks source link

Introduce `/api/rules/archive-by-tag` endpoint #478

Closed simonbyford closed 2 months ago

simonbyford commented 3 months ago

What does this change?

Does two things:

1) adds some handling to the /api/rules/csv-import endpoint to ensure the user making the request has the correct permissions. Also stores their email address against the change instead of the dummy value "CSV Import" (see: https://github.com/guardian/typerighter/commit/b71cd93596dad8f5accb460bd9ede51e4cc386b8) 2) introduces a new endpoint /api/rules/archive-by-tag which can be used to bulk-archive rules based on a given tag (see: https://github.com/guardian/typerighter/commit/e62afe13cc6c4bf5edcde9d28cc078224ff0fbbd)

The new endpoint /api/rules/archive-by-tag accepts one parameter encoded as form-data:

For example:

curl --location 'https://manager.typerighter.gutools.co.uk/api/rules/archive-by-tag' \
--header 'accept: */*' \
--header 'content-type: application/json' \
--form 'tag="MP"'

How to test

It's slightly more complicated than the above. See these notes on the previous PR: https://github.com/guardian/typerighter/pull/477#how-to-test

Testing on CODE:

https://github.com/user-attachments/assets/c8175624-2554-4d2a-8b15-768881e2e29e

I'm not too sure why this particular request took 17 seconds. Subsequent requests took 200ms!

prout-bot commented 2 months ago

Overdue on Checker, Rule Manager (merged by @simonbyford 15 minutes and 3 seconds ago) What's gone wrong?