update mit archiv
release-tag / release-image (push) Successful in 2m6s

This commit is contained in:
2026-05-29 10:34:04 +02:00
parent 6aaa73b744
commit ba1019728d
4 changed files with 75 additions and 10 deletions
+17 -1
View File
@@ -178,16 +178,32 @@ func scanOrder(scanner interface{ Scan(dest ...any) error }) (*Order, error) {
}
func (s *Store) ListOrders(status string, limit int) ([]Order, error) {
return s.listOrders(status, limit, false)
}
func (s *Store) ListArchivedOrders(status string, limit int) ([]Order, error) {
return s.listOrders(status, limit, true)
}
func (s *Store) listOrders(status string, limit int, archived bool) ([]Order, error) {
if limit <= 0 || limit > 50 {
limit = 10
}
query := `SELECT id, submitter_id, submitter_name, acceptor_id, acceptor_name, commodity, quality, quantity_amount, quantity_unit, deadline, delivery_place, max_budget_auec, status, public_channel_id, public_message_id, internal_channel_id, internal_message_id, thread_id, created_at, updated_at, last_feedback FROM orders`
args := []any{}
if status != "" {
query += ` WHERE status=?`
args = append(args, status)
} else if archived {
query += ` WHERE status IN (?, ?, ?)`
args = append(args, StatusCompleted, StatusDeclined, StatusCancelled)
} else {
query += ` WHERE status NOT IN (?, ?, ?)`
args = append(args, StatusCompleted, StatusDeclined, StatusCancelled)
}
query += ` ORDER BY created_at DESC LIMIT ?`
query += ` ORDER BY updated_at DESC LIMIT ?`
args = append(args, limit)
rows, err := s.db.Query(query, args...)
if err != nil {