feat: track purchase site URL for new components
Build & Deploy / build (push) Failing after 4s
Build & Deploy / docker (push) Skipped

- New nullable purchase_url column on components
- Store/update validators accept an optional purchaseUrl (must be a valid
  absolute URL with a protocol when provided)
- components/create.vue: NewPartSearch import now also fills purchaseUrl
  from the scraped part's source URL (pc-builder.io product page); the
  field remains manually editable for second-hand parts entered by hand
- components/edit.vue: purchaseUrl is editable after creation
- components/show.vue: displays the purchase site as a clickable link
  when present
- 4 new functional tests: create with/without a purchase URL, invalid URL
  rejected (asserts the Inertia inputErrorsBag flash, not a raw 422 -
  content negotiation only returns JSON for XHR/API-style requests), and
  updating an existing component's purchase URL
This commit is contained in:
Kevin L'Hereec committed 2026-07-23 14:10:54 +02:00
1 parent 497ae797ca
commit 4174d92711
10 files changed
+174 -6

No files matched your search

+3 -1
View File
@@ -19,7 +19,7 @@ export class ComponentTypeSchema extends BaseModel {
}
export class ComponentSchema extends BaseModel {
static $columns = ['computerId', 'createdAt', 'id', 'name', 'price', 'purchaseDate', 'typeId', 'updatedAt', 'userId'] as const
static $columns = ['computerId', 'createdAt', 'id', 'name', 'price', 'purchaseDate', 'purchaseUrl', 'typeId', 'updatedAt', 'userId'] as const
$columns = ComponentSchema.$columns
@column()
declare computerId: number | null
@@ -34,6 +34,8 @@ export class ComponentSchema extends BaseModel {
@column.date()
declare purchaseDate: DateTime
@column()
declare purchaseUrl: string | null
@column()
declare typeId: number | null
@column.dateTime({ autoCreate: true, autoUpdate: true })
declare updatedAt: DateTime | null