Skip to content

Entity: Product

Represents a handmade product available in the institute's catalog.

Fields

FieldTypeNullableDefaultDescription
idserialnoautoPrimary key
namevarchar(255)noProduct name
descriptiontextyesnullOptional product description
pricenumeric(10,2)noPrice in BRL

Standard columns (created_at, updated_at, deleted_at) are inherited per ADR-007 and should not be listed here.

Relations

RelationTypeTarget entityFKOn delete
photosone-to-manyProductPhotoproduct_photo.product_idcascade
artisansmany-to-manyArtisanvia product_artisancascade

Business rules

  • A product must have at least one photo.
  • A product must have at least one artisan.
  • price must be greater than zero.

Notes

  • Photos are stored in Cloudflare R2; the database only keeps the object key.
  • The many-to-many relation with artisans is managed via the product_artisan join table.