Skip to content

Reject null instrument type in notice updates #565

Description

@coderabbitai

Summary

Reject an explicitly submitted null value for instrument_type in notice updates.

Rationale

The current validation can allow a superadministrator to submit instrument_type: null. NoticeService::update treats that value as an instrument-type change and clears related Formalization.term_number values. This permits an unintended reset of generated term numbers.

Affected areas

  • app/Http/Requests/Notice/NoticeUpdateRequest.php
  • app/Services/NoticeService.php

Required changes

Keep the optional behavior when instrument_type is absent. When the request contains instrument_type, require a non-null value and validate it against InstrumentType. Ensure NoticeService::update receives only valid, non-null instrument types when the field is supplied.

Acceptance criteria

  • A request without instrument_type remains valid.
  • A request with instrument_type: null is rejected for every authorized role.
  • A request with a valid InstrumentType value remains valid for authorized users.
  • A rejected null value does not clear any related Formalization.term_number values.

Backlinks

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions