mirror of
https://github.com/serty2005/rmser.git
synced 2026-02-04 19:02:33 -06:00
2701-есть адекватный порядок для строк черновика и фикс пустого поиска
This commit is contained in:
@@ -23,7 +23,7 @@ func (r *pgRepository) GetByID(id uuid.UUID) (*drafts.DraftInvoice, error) {
|
||||
var draft drafts.DraftInvoice
|
||||
err := r.db.
|
||||
Preload("Items", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Order("draft_invoice_items.raw_name ASC")
|
||||
return db.Order("draft_invoice_items.order ASC")
|
||||
}).
|
||||
Preload("Items.Product").
|
||||
Preload("Items.Product.MainUnit").
|
||||
@@ -98,6 +98,13 @@ func (r *pgRepository) UpdateItem(itemID uuid.UUID, updates map[string]interface
|
||||
Updates(updates).Error
|
||||
}
|
||||
|
||||
// UpdateItemOrder обновляет порядок позиции
|
||||
func (r *pgRepository) UpdateItemOrder(itemID uuid.UUID, newOrder int) error {
|
||||
return r.db.Model(&drafts.DraftInvoiceItem{}).
|
||||
Where("id = ?", itemID).
|
||||
Update("order", newOrder).Error
|
||||
}
|
||||
|
||||
func (r *pgRepository) Delete(id uuid.UUID) error {
|
||||
return r.db.Delete(&drafts.DraftInvoice{}, id).Error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user