mirror of
https://github.com/Sea-Haven-Industries/proposal-system.git
synced 2026-10-01 03:33:13 +00:00
Some checks are pending
Deploy / Deploy to AWS (push) Waiting to run
Adds a managed pricing library so admins can seed/curate reference priced items
directly, instead of the corpus being populated only by ingesting Sent proposals.
v1 PR5.
API:
- PricingLibraryItem entity + migration; /api/pricing-library CRUD (admin), with
GET {id} reachable by internal Lambda callers (admins role via internal key).
- Create/update publish an ADDITIVE library-ingest SQS job {pricingLibraryItemId},
wrapped so a publish failure never rolls back the save.
Lambda (library-ingest):
- Additive event-shape branch: pricingLibraryItemId -> fetch item, format markdown,
upload to pricing-library/{category}/{id}.md, trigger KB sync. The existing
proposalId path is byte-for-byte unchanged. Explicit error when neither id present;
warns when both present.
Web:
- Pricing Library management page (/admin/pricing-library): list / create / edit / delete.
GPT-4.1 cross-review on the event-shape change: no BLOCK (neither/both-id handling
applied). Verified: api 159 tests; web tsc + 26 tests; lambdas ruff + 37 pytest.
39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
using FluentValidation;
|
|
using ProposalSystem.Application.DTOs;
|
|
|
|
namespace ProposalSystem.Application.Validators;
|
|
|
|
/// <summary>
|
|
/// PR5: Validates CreatePricingLibraryItemRequest payloads.
|
|
/// </summary>
|
|
public class CreatePricingLibraryItemValidator : AbstractValidator<CreatePricingLibraryItemRequest>
|
|
{
|
|
public CreatePricingLibraryItemValidator()
|
|
{
|
|
RuleFor(x => x.Title)
|
|
.NotEmpty().WithMessage("Title is required")
|
|
.MaximumLength(200);
|
|
|
|
RuleFor(x => x.Description)
|
|
.MaximumLength(5000)
|
|
.When(x => x.Description != null);
|
|
|
|
RuleFor(x => x.ServiceCategory).IsInEnum();
|
|
|
|
RuleFor(x => x.Unit)
|
|
.MaximumLength(50)
|
|
.When(x => x.Unit != null);
|
|
|
|
RuleFor(x => x.UnitPrice)
|
|
.GreaterThanOrEqualTo(0).WithMessage("Unit price must be zero or positive")
|
|
.When(x => x.UnitPrice.HasValue);
|
|
|
|
RuleFor(x => x.Keywords)
|
|
.MaximumLength(2000)
|
|
.When(x => x.Keywords != null);
|
|
|
|
RuleFor(x => x.Source)
|
|
.MaximumLength(100)
|
|
.When(x => x.Source != null);
|
|
}
|
|
}
|