Supplier Module

Supplier domain — entities, certifications, compliance fields, address, geolocation, metadata, and the full service layer.

Overview

The supplier module manages master data for all suppliers, including full address and geolocation, ESG compliance flags, certifications, contact information, and rich list filtering.

Entity: Supplier

FieldTypeDB ColumnDescription
idLongidAuto-generated PK
nameStringnameLegal supplier name (required)
categoryStringcategoryBusiness category (required)
customCategoryStringcustom_categoryCustom description for "Altro"
addressStringaddressStreet address
cityStringcityCity
zipCodeStringzip_codePostal code (CAP)
provinceStringprovinceProvince/Region
countryStringcountryISO 3166-1 alpha-2
latitudeDoublelatitudeGeographic latitude
longitudeDoublelongitudeGeographic longitude
contactNameStringcontact_nameContact person name
contactEmailStringcontact_emailContact email
contactPhoneStringcontact_phoneContact phone
reachCompliantBooleanreach_compliantREACH regulation compliant (default: false)
svhcCompliantBooleansvhc_compliantSVHC substance compliant (default: false)
userIdLonguser_idOwner/creator user ID
companyIdLongcompany_idAssociated company ID
activityTypeStringactivity_typeType of supplier activity
metadataMap<String, Object>metadataArbitrary JSON key-value pairs
createdAtLocalDateTimecreated_atSet on @PrePersist
updatedAtLocalDateTimeupdated_atSet on @PreUpdate

Entity: SupplierCertification

Each supplier can have multiple certifications. Certifications are cascaded from the parent supplier (deleting a supplier also deletes its certifications).

FieldTypeDescription
idLongAuto PK
supplierSupplierParent supplier (@ManyToOne)
certificationTypeStringe.g. GOTS, GRS, OEKO_TEX, ISO_14001 (required)
certificateNumberStringCertificate reference number
certificateExpiryLocalDateExpiry date
documentIdLongFK to uploaded document
isDigitallySignedBooleanWhether digitally signed
signatureVerifiedBooleanWhether signature was verified
verificationStatusStringPENDING, VERIFIED, REJECTED
verificationDetailsStringVerification notes
verifiedAtLocalDateTimeWhen verification occurred
createdAt / updatedAtLocalDateTimeTimestamps

Entity Metadata

The metadata field is a free-form JSON column (stored as jsonb in PostgreSQL) that allows attaching arbitrary key-value pairs to any supplier without schema changes:

JSON
{
"erp_code": "SUP-0042",
"internal_rating": "A",
"vat_number": "IT12345678901",
"custom_tags": ["priority", "eu-based"]
}

GET /api/v1/suppliers Filter Parameters

The list endpoint supports rich filtering and sorting. Default page size is 50 (max 250).

ParamTypeDefaultDescription
pageinteger0Zero-based page index
sizeinteger50Items per page (max 250)
countrystringISO alpha-2 country filter
categorystringCategory filter
complianceStatusstringCompliance status filter
searchstringFree-text search across name/category
sortBystringcreated_dateSort field
sortOrderstringdescasc or desc

Service Methods

  • create(SupplierDTO, userId) — persists, returns DTO
  • update(id, SupplierDTO) — partial update, returns DTO
  • findById(id) — throws 404 if not found
  • list(page, size, country, category, complianceStatus, search, sortBy, sortOrder) — paginated
  • delete(id) — hard delete, cascades to certifications
  • bulkUpsert(items) — upserts by name