From 56782fa7181d5dd5c0c20c519e6541c6095645d9 Mon Sep 17 00:00:00 2001 From: Michael Chus Date: Wed, 3 Jun 2026 13:56:55 +0300 Subject: [PATCH] =?UTF-8?q?refactor:=20=D1=83=D0=B4=D0=B0=D0=BB=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D0=BD=D0=B5=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C?= =?UTF-8?q?=D0=B7=D1=83=D0=B5=D0=BC=D1=8B=D0=B5=20=D0=BC=D0=BE=D0=B4=D0=B5?= =?UTF-8?q?=D0=BB=D0=B8=20StockLog,=20StockIgnoreRule,=20Supplier?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- internal/models/lot.go | 42 --------------------------- internal/repository/pricelist_test.go | 2 +- 2 files changed, 1 insertion(+), 43 deletions(-) diff --git a/internal/models/lot.go b/internal/models/lot.go index 31db4ac..bcbe472 100644 --- a/internal/models/lot.go +++ b/internal/models/lot.go @@ -1,7 +1,5 @@ package models -import "time" - // Lot represents existing lot table type Lot struct { LotName string `gorm:"column:lot_name;primaryKey;size:255" json:"lot_name"` @@ -12,43 +10,3 @@ type Lot struct { func (Lot) TableName() string { return "lot" } - -// Supplier represents existing supplier table (READ-ONLY) -type Supplier struct { - SupplierName string `gorm:"column:supplier_name;primaryKey;size:255"` - SupplierComment string `gorm:"column:supplier_comment;size:10000"` -} - -func (Supplier) TableName() string { - return "supplier" -} - -// StockLog stores warehouse stock snapshots imported from external files. -type StockLog struct { - StockLogID uint `gorm:"column:stock_log_id;primaryKey;autoIncrement"` - Partnumber string `gorm:"column:partnumber;size:255;not null"` - Supplier *string `gorm:"column:supplier;size:255"` - Date time.Time `gorm:"column:date;type:date;not null"` - Price float64 `gorm:"column:price;not null"` - Quality *string `gorm:"column:quality;size:255"` - Comments *string `gorm:"column:comments;size:15000"` - Vendor *string `gorm:"column:vendor;size:255"` - Qty *float64 `gorm:"column:qty"` -} - -func (StockLog) TableName() string { - return "stock_log" -} - -// StockIgnoreRule contains import ignore pattern rules. -type StockIgnoreRule struct { - ID uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` - Target string `gorm:"column:target;size:20;not null" json:"target"` // partnumber|description - MatchType string `gorm:"column:match_type;size:20;not null" json:"match_type"` // exact|prefix|suffix - Pattern string `gorm:"column:pattern;size:500;not null" json:"pattern"` - CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at"` -} - -func (StockIgnoreRule) TableName() string { - return "stock_ignore_rules" -} diff --git a/internal/repository/pricelist_test.go b/internal/repository/pricelist_test.go index bbf4783..7dac05e 100644 --- a/internal/repository/pricelist_test.go +++ b/internal/repository/pricelist_test.go @@ -177,7 +177,7 @@ func newTestPricelistRepository(t *testing.T) *PricelistRepository { if err != nil { t.Fatalf("open sqlite: %v", err) } - if err := db.AutoMigrate(&models.Pricelist{}, &models.PricelistItem{}, &models.Lot{}, &models.StockLog{}); err != nil { + if err := db.AutoMigrate(&models.Pricelist{}, &models.PricelistItem{}, &models.Lot{}); err != nil { t.Fatalf("migrate: %v", err) } return NewPricelistRepository(db)