diff --git a/LOCAL_FIRST_INTEGRATION.md b/LOCAL_FIRST_INTEGRATION.md index 28402d2..3b51a21 100644 --- a/LOCAL_FIRST_INTEGRATION.md +++ b/LOCAL_FIRST_INTEGRATION.md @@ -2,7 +2,7 @@ ## Overview -QuoteForge теперь поддерживает local-first архитектуру: приложение ВСЕГДА работает с SQLite (localdb), MariaDB используется только для синхронизации. +PriceForge теперь поддерживает local-first архитектуру: приложение ВСЕГДА работает с SQLite (localdb), MariaDB используется только для синхронизации. ## Реализованные компоненты @@ -60,7 +60,7 @@ localConfigService := services.NewLocalConfigurationService( ### Шаг 1: Обновить main.go ```go -// В cmd/qfs/main.go +// В cmd/pfs/main.go syncService := sync.NewService(pricelistRepo, configRepo, local) // Создать isOnline функцию @@ -165,10 +165,10 @@ type PendingChange struct { ```bash # Compile -go build ./cmd/qfs +go build ./cmd/pfs # Run -./quoteforge +./priceforge # Check pending changes curl http://localhost:8080/api/sync/pending/count diff --git a/MIGRATION_PRICE_REFRESH.md b/MIGRATION_PRICE_REFRESH.md index 0abe33b..b4760d2 100644 --- a/MIGRATION_PRICE_REFRESH.md +++ b/MIGRATION_PRICE_REFRESH.md @@ -59,7 +59,7 @@ POST /api/configs/:uuid/refresh-prices Запустите сервер с флагом миграции: ```bash -./quoteforge -migrate -config config.yaml +./priceforge -migrate -config config.yaml ``` Или выполните SQL миграцию вручную: @@ -71,7 +71,7 @@ mysql -u user -p RFQ_LOG < migrations/004_add_price_updated_at.sql После применения миграции перезапустите сервер: ```bash -./quoteforge -config config.yaml +./priceforge -config config.yaml ``` ## Использование @@ -89,7 +89,7 @@ mysql -u user -p RFQ_LOG < migrations/004_add_price_updated_at.sql - `internal/models/configuration.go` - добавлено поле `PriceUpdatedAt` - `internal/services/configuration.go` - добавлен метод `RefreshPrices()` - `internal/handlers/configuration.go` - добавлен обработчик `RefreshPrices()` -- `cmd/qfs/main.go` - добавлен маршрут `/api/configs/:uuid/refresh-prices` +- `cmd/pfs/main.go` - добавлен маршрут `/api/configs/:uuid/refresh-prices` - `web/templates/index.html` - добавлена кнопка и JavaScript функции - `migrations/004_add_price_updated_at.sql` - SQL миграция - `CLAUDE.md` - обновлена документация diff --git a/cmd/migrate/main.go b/cmd/migrate/main.go index 5d3faeb..da261f7 100644 --- a/cmd/migrate/main.go +++ b/cmd/migrate/main.go @@ -25,7 +25,7 @@ func main() { dryRun := flag.Bool("dry-run", false, "show what would be migrated without actually doing it") flag.Parse() - log.Println("QuoteForge Configuration Migration Tool") + log.Println("PriceForge Configuration Migration Tool") log.Println("========================================") // Load config for MariaDB connection diff --git a/config.example.yaml b/config.example.yaml index b7c8626..0b1e57d 100644 --- a/config.example.yaml +++ b/config.example.yaml @@ -12,7 +12,7 @@ database: host: "localhost" port: 3306 name: "RFQ_LOG" - user: "quoteforge" + user: "priceforge" password: "CHANGE_ME" max_open_conns: 25 max_idle_conns: 5 @@ -33,7 +33,7 @@ pricing: popularity_decay_days: 180 export: - temp_dir: "/tmp/quoteforge-exports" + temp_dir: "/tmp/priceforge-exports" max_file_age: "1h" company_name: "Your Company Name" @@ -49,10 +49,10 @@ notifications: smtp_port: 587 smtp_user: "" smtp_password: "" - from_address: "quoteforge@example.com" + from_address: "priceforge@example.com" logging: level: "info" # debug | info | warn | error format: "json" # json | text output: "stdout" # stdout | file - file_path: "/var/log/quoteforge/app.log" + file_path: "/var/log/priceforge/app.log" diff --git a/crontab b/crontab index 9b2d5b3..56076c5 100644 --- a/crontab +++ b/crontab @@ -1,15 +1,15 @@ # Cron jobs for PriceForge # Run alerts check every hour -0 * * * * /app/quoteforge-cron -job=alerts +0 * * * * /app/priceforge-cron -job=alerts # Run price updates daily at 2 AM -0 2 * * * /app/quoteforge-cron -job=update-prices +0 2 * * * /app/priceforge-cron -job=update-prices # Reset weekly counters every Sunday at 1 AM -0 1 * * 0 /app/quoteforge-cron -job=reset-counters +0 1 * * 0 /app/priceforge-cron -job=reset-counters # Update popularity scores daily at 3 AM -0 3 * * * /app/quoteforge-cron -job=update-popularity +0 3 * * * /app/priceforge-cron -job=update-popularity # Log rotation (optional) # 0 0 * * * /usr/bin/logrotate /etc/logrotate.conf \ No newline at end of file diff --git a/internal/appstate/path.go b/internal/appstate/path.go index 2468ee9..3ecb999 100644 --- a/internal/appstate/path.go +++ b/internal/appstate/path.go @@ -9,8 +9,8 @@ import ( ) const ( - appDirName = "QuoteForge" - defaultDB = "qfs.db" + appDirName = "PriceForge" + defaultDB = "pfs.db" defaultCfg = "config.yaml" envDBPath = "QFS_DB_PATH" envStateDir = "QFS_STATE_DIR" @@ -149,13 +149,13 @@ func defaultStateDir() (string, error) { return filepath.Join(base, appDirName), nil default: if xdgState := os.Getenv("XDG_STATE_HOME"); xdgState != "" { - return filepath.Join(xdgState, "quoteforge"), nil + return filepath.Join(xdgState, "priceforge"), nil } home, err := os.UserHomeDir() if err != nil { return "", fmt.Errorf("resolving user home dir: %w", err) } - return filepath.Join(home, ".local", "state", "quoteforge"), nil + return filepath.Join(home, ".local", "state", "priceforge"), nil } } diff --git a/internal/handlers/sync_readiness_test.go b/internal/handlers/sync_readiness_test.go index 002966c..16bdd1e 100644 --- a/internal/handlers/sync_readiness_test.go +++ b/internal/handlers/sync_readiness_test.go @@ -17,7 +17,7 @@ func TestSyncReadinessOfflineBlocked(t *testing.T) { gin.SetMode(gin.TestMode) dir := t.TempDir() - local, err := localdb.New(filepath.Join(dir, "qfs.db")) + local, err := localdb.New(filepath.Join(dir, "pfs.db")) if err != nil { t.Fatalf("init local db: %v", err) } diff --git a/internal/localdb/encryption.go b/internal/localdb/encryption.go index 8e25a52..4db1142 100644 --- a/internal/localdb/encryption.go +++ b/internal/localdb/encryption.go @@ -17,7 +17,7 @@ func getEncryptionKey() []byte { if key == "" { // Fallback to a machine-based key (hostname + fixed salt) hostname, _ := os.Hostname() - key = hostname + "quoteforge-salt-2024" + key = hostname + "priceforge-salt-2024" } // Hash to get exactly 32 bytes for AES-256 hash := sha256.Sum256([]byte(key)) diff --git a/internal/models/models.go b/internal/models/models.go index d758ebb..88caefd 100644 --- a/internal/models/models.go +++ b/internal/models/models.go @@ -23,7 +23,7 @@ func AllModels() []interface{} { } } -// Migrate runs auto-migration for all QuoteForge tables +// Migrate runs auto-migration for all PriceForge tables // Handles MySQL constraint errors gracefully for existing tables func Migrate(db *gorm.DB) error { for _, model := range AllModels() { diff --git a/todo.md b/todo.md index a9479de..5a1142c 100644 --- a/todo.md +++ b/todo.md @@ -48,7 +48,7 @@ ## 4. Упростить `base.html` (навигация) -- [ ] Логотип: "PriceForge" вместо "QuoteForge" +- [ ] Логотип: "PriceForge" вместо "PriceForge" - [ ] Убрать ссылки: "Мои проекты" - [ ] Оставить: "Администратор цен", "Прайслисты", "Настройки" - [ ] Убрать sync indicator из хедера (или упростить — только online/offline статус MariaDB)