Skip to content

Release 3.5.0#688

Merged
theorm merged 31 commits intomasterfrom
develop
Apr 10, 2026
Merged

Release 3.5.0#688
theorm merged 31 commits intomasterfrom
develop

Conversation

@theorm
Copy link
Copy Markdown
Member

@theorm theorm commented Apr 10, 2026

No description provided.

theorm and others added 30 commits February 20, 2026 17:32
* added csv-export endpoint

* added CI types reference

* reshuffles
* Add patch support and Celery hook to reviews service

Injects CeleryClient into the UserSpecialMembershipRequestReviewsService and implements a strict single-item patch method that verifies reviewer authorization (direct reviewer or via special membership access), updates the request, and enqueues an after-update Celery task. Type imports and the service interface were adjusted to include NullableId and an explicit patch signature. Unit tests were extended to use a Redis/Celery test setup (setupTestDatabaseRedisCelery), track Celery/Redis calls, and cover patch scenarios (direct reviewer, special-access reviewer, unauthorized reviewer, missing id, and non-existent request).

* Add test DB helpers for Redis and Celery

Introduce setupTestDatabaseRedisCelery to create an in-memory test DB and provide mocked Celery and Redis clients. The new helper accepts arrays/records to capture celery run calls and redis setEx calls, patches the test app's get and service methods to return the mocked clients, and exposes utilities for get/get/del on the mocked Redis client. Also add related types and imports to support the mocks, enabling tests to assert on background task and cache interactions.

* Fix race condition and add validation in user special membership request patch method (#668)

* Initial plan

* Address review comments: await Celery call, validate status, update dateLastModified, use logger

Co-authored-by: danieleguido <1181642+danieleguido@users.noreply.github.com>

* Simplify spread operator in patch method

Co-authored-by: danieleguido <1181642+danieleguido@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: danieleguido <1181642+danieleguido@users.noreply.github.com>

* Add magicLink callback URL support

Add support for a magicLink callback URL across the app: update default config with callbackUrls.magicLink and adjust passwordReset URL port; extend schema and generated types to include magicLink; make MagicLinkService read app.get('callbackUrls')?.magicLink, log it, and pass it to the celery task. Tests and test helpers were updated to mock callbackUrls and to use a combined test database setup that tracks celery/redis calls (refactor to setupTestDatabaseRedisCelery and trackers).

* Add applyInPlace option to validate hook

Extend the validate hook in src/hooks/params.ts to accept an options parameter with applyInPlace:boolean and explicitly type method as 'GET'|'POST'. When applyInPlace is true, the hook now copies sanitized values back into the original locations (context.params.query for GET, context.data for POST). This preserves previous behavior when options is omitted and makes it possible to update in-place rather than only storing values under .sanitized.

* Add hooks and tests for special membership reviews

Add JWT authentication and query validation hooks for the user-special-membership-requests-reviews service. The new hook validates/normalizes find query params: optional status (allowed: pending, approved, rejected) and order_by (transforms -dateLastModified/dateLastModified into Sequelize order tuples) and applies common query params. Also add unit tests covering valid/invalid status values, order_by transformation and validation, and optional status behavior.

* Update user-special-membership-requests-reviews.service.ts

* Add order_by support to reviews service

Expose an order_by query option for user special membership request reviews and pass it to Sequelize ordering. Adds OrderItem import and FindQuery.order_by, defaults to [['dateLastModified','DESC']] when not provided, and logs the order_by in debug output. Adjusts the find query to filter by status if present and use the provided order. Update unit tests to use the new order_by array format, add an approved mock request, and add/assert additional expectations for approved and pending results. Also includes minor formatting and error-message formatting cleanup.

* Add ordering and status filters to requests

Expose order_by and status query params for user special membership requests. The service class now accepts order_by (OrderItem[]) and status (string[]) with a default ordering by dateLastModified DESC and applies status filtering using Sequelize Op.in. The service route adds validation and transformation for order_by (supports -dateLastModified and dateLastModified) and validates status choices, applying changes in-place via existing query hooks.

* hotfix update task name for magic link

---------

Co-authored-by: Daniele Guido <1181642+danieleguido@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
…rting and this way reduce the chance of duplicates.
* refactoring of schemas: first sweep

* moved all schemas to the new structured locations

* content item

* linter

* added label fields and updated last Uid field to Id in the content item schema

* removed unused schemas

* moved all files out of public schema fodler

* entity uid -> id

* entity details uid -> id

* image uid -> id

* media source uid -> id

* text reuse cluster uid -> id

* tr cluster uid -> id

* topic uid -> id

* year uid -> id

* updated schema version to 2020-12

* schema version downgrade to a backward compatible version.

* added label resolvers

* resolving titles

* facets with labels

* uid -> id

* update impresso-jscommons dependency to v1.13.0 and refactor Facet interface usage

* uid -> id

* refactor topic resolver to remove unnecessary variable and add error handling for community computation

* updated exportable fields

* redacting non-api fields

* solr connection updated

* add "ch" option to ContentItemText and related schemas; update regex patterns for country and province codes

* cleanup of uids
* Add term search & improve magic link auth/logging

Add logging and refine magic-link authentication; add search-by-term for reviewer requests.

- authentication: log authenticated slim user in NoDBJWTStrategy; MagicLinkJWTStrategy now fetches the full entity via getEntity instead of building a slim user locally.
- magic-link service: improve debug output to include token expiration seconds when creating a magic link.
- user-special-membership-requests-reviews service: import QueryTypes/Sequelize, add optional `term` query param, implement case-insensitive LIKE filtering on subscriber email/first/last name, require specialMembershipAccess association and include subscriber attributes when `term` is provided.
- hooks: update validation to use FindQuery and add `term` field with a unicode-safe regex; make order_by/status optional.
- tests: enable SQL logging for the test DB and add a unit test to verify filtering by subscriber email via the `term` parameter.

These changes enable text search for reviewer-visible special membership requests, improve logging for debugging, and ensure the magic-link auth returns the canonical entity shape.

* Fix reviewer-scope overwrite, subscriber attribute aliases, and term validation hardening (#677)

* Initial plan

* Fix Op.or overwrite, use [col,alias] tuples for subscriber attrs, remove unused import, add term max_length

Co-authored-by: danieleguido <1181642+danieleguido@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: danieleguido <1181642+danieleguido@users.noreply.github.com>

---------

Co-authored-by: Daniele Guido <1181642+danieleguido@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
hook accepts camelCase parameters only
* Add notes field to special membership request

Add a notes property to the userSpecialMembershipRequest model (TS declaration and DB column as non-null TEXT) and include data.notes in the service create call so the notes are persisted on new special membership request records. This ensures notes are stored both in the changelog entry and as a top-level attribute.

* Make notes field optional and nullable

Allow the notes property to be optional and nullable across the model types and Sequelize definition. Updated IUserSpecialMembershipRequestAttributes to include notes?: string | null, changed the model declaration to string | null, and relaxed the Sequelize column to allowNull: true with a defaultValue of ''. This enables requests to omit notes or store null values while preserving a default empty string for existing rows.

---------

Co-authored-by: Daniele Guido <1181642+danieleguido@users.noreply.github.com>
* refactor

* Add date normalization for DateRange filters and enhance test cases for string filters
…AND filters (#685)

* Enhance string filter handling: group OR-ed terms when combined with AND filters

* Fix query structure in filtersToSolrQuery test: group OR-ed terms for clarity
* Add bitmapPositions filtering and validation

Allow filtering SpecialMembershipAccess by bitmapPositions. Added bitmapPositions to the FindQuery and applied an Op.in where clause in the service class. Introduced validateBitmapPositionsQuery hook to parse, validate and sanitize comma/array query input into a numeric array, and wired it into the before.find hooks.

* Update special-membership-access.test.ts

Added unit tests for the validation hook and for filtering behavior to ensure invalid inputs are rejected and filtering returns expected records.

---------

Co-authored-by: Daniele Guido <1181642+danieleguido@users.noreply.github.com>
Enhance the service get method to return requester metadata alongside the request record. The change updates the return type to include an optional requester, queries the User with groups/profile/userBitmap associations, and constructs a requester object (id, email, firstname, lastname, groups, profile, bitmap). Tests adjusted: logging disabled in test DB setup and a new unit test verifies requester fields are present and correct. Also minor formatting cleanup for attribute arrays.
@theorm theorm merged commit 615e161 into master Apr 10, 2026
2 checks passed
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