SuperSeller3000/migrations/Version20260518160000.php
Simon Kuehn c19637465b feat: Frappe ERP matching, pipeline model cache, ACL, stock field, specs by type
Frappe ERP:
- findExistingCustomer() on FrappeErpAdapter — two-step name+address lookup
- FrappeHttpClient: add put() method; switch invoice submit to PUT docstatus=1 (Frappe v16)
- buildItemDescription() uses specsText + inventory number + serial number
- Integration tests: find Simon Kühn, create real 1337€ invoice, cancel+delete in tearDown
- FRAPPE_GENERIC_ITEM_CODE=SKU002 added to .env.local and bin/test-integration

Pipeline — model cache:
- PhotoUploadHandler: after vision, check DB for existing article with same modelNumber
- On match: copy ebayTitle/ebayDescription/specsText/attributes, skip specs+JSON+eBay steps
- DraftArticleHandler: apply model_match data and mark job complete directly
- ArticleRepository: findCompletedByModelNumber() query

Pipeline — specs by article type:
- SpecsResearchAgent: accept attributeFields list, format as bullet list in {{fields}} var
- SpecsResearchHandler: derive attribute names from ArticleType, pass to agent
- SpecsResearchMessage: add attributeFields param
- Prompt migration: replace hardcoded laptop spec list with {{fields}} placeholder

Article:
- specsText field (nullable text column + migration)
- stock field visible on index and editable in CRUD form
- addAttributeValue()/removeAttributeValue() adder-remover pair for Symfony form binding
- AttributeValue::getArticle() getter
- AttributeValueFormType: detect required attributes from ArticleType assignments, set required=true
- ManualIngestType: add stock/quantity field (default 1, min 1)

Users / ACL:
- PermissionVoter: define named permission constants + allPermissions()
- User: getGrantedPermissions()/setGrantedPermissions() helpers
- UserCrudController: permissions checkbox group on edit form

UI / assets:
- public/css/admin/custom.css: red asterisk for required fields
- DashboardController: register custom CSS

Infra:
- PipelineJobFailureListener: mark job failed (with real error) when Messenger exhausts retries
- doctrine.yaml: exclude app.inventory_seq from schema diff
- ErpAdapterInterface: add findExistingCustomer()

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 16:42:15 +00:00

68 lines
2.6 KiB
PHP

<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20260518160000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Update specs_research prompt to use article-type-specific attribute fields instead of hardcoded laptop specs';
}
public function up(Schema $schema): void
{
$body = 'You are a hardware specifications expert. Extract the technical specifications for the {{articleType}}: "{{subject}}".
Web search results:
{{searchResults}}
Based on the search results above, extract the following specifications:
{{fields}}
Be specific and accurate. Use the exact values from the search results.
If a specification is not found in the search results, omit it rather than guessing.
Output only the specifications as a plain list — no introduction, no commentary.
If the search results reveal that the model number in "{{subject}}" contains an OCR error
(e.g. a letter misread as a digit), output the corrected model number on the very first line
in exactly this format, then leave a blank line before the specs:
CORRECTED_MODEL_NUMBER: <corrected number>
If the model number is correct or no model number was provided, omit the CORRECTED_MODEL_NUMBER line entirely.';
$this->addSql('UPDATE app.prompt_templates SET body = :body WHERE key = :key', [
'body' => $body,
'key' => 'specs_research',
]);
}
public function down(Schema $schema): void
{
$body = 'You are a hardware specifications expert. Extract the technical specifications for the {{articleType}}: "{{subject}}".
Web search results:
{{searchResults}}
Based on the search results above, list all technical specifications including:
processor, RAM, storage variants, display size and resolution, GPU, battery capacity,
ports, connectivity, weight, dimensions, OS, and any other relevant specs.
Be specific and accurate. If a spec is not found in the search results, omit it rather than guessing.
If the search results reveal that the model number in "{{subject}}" contains an OCR error
(e.g. a letter misread as a digit), output the corrected model number on the very first line
in exactly this format, then leave a blank line before the specs:
CORRECTED_MODEL_NUMBER: <corrected number>
If the model number is correct or no model number was provided, omit the CORRECTED_MODEL_NUMBER line entirely.';
$this->addSql('UPDATE app.prompt_templates SET body = :body WHERE key = :key', [
'body' => $body,
'key' => 'specs_research',
]);
}
}