Files
yellowjacket/backend/database/sql/sqlcgen/excluded_paths.sql.go
T
yonluandClaude Opus 5 dc890d1fcc feat(library): remove a track from the library without deleting the file
RemoveFromLibrary deletes the audio_files rows the way the scan's own
orphan cleanup does and records each path in excluded_paths. The
exclusion is not an enhancement: without it the next scan finds the
file, sees no row and imports it again, so the button undoes itself.

The soft scan compares files on disk against rows in the database, so
surveyAudioFiles and countAudioFiles both take the exclusion set —
otherwise an excluded path makes the two disagree forever and queues a
full scan on every launch. Deleting a row cascades to queue_tracks, so
the removal calls the same CompactQueue hook RemoveLibrary does.

Also lands the requested badge: library-status-indicator is a button
again where it can act, utils/library-status.ts states once what owning
and wanting mean, and the long-declared queued state finally has a
producer.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UDCbcCZQepnpSQYJ6SxxZm
2026-08-14 13:12:01 -04:00

76 lines
1.8 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.30.0
// source: excluded_paths.sql
package sqlcgen
import (
"context"
)
const clearExcludedPaths = `-- name: ClearExcludedPaths :exec
DELETE FROM excluded_paths
`
func (q *Queries) ClearExcludedPaths(ctx context.Context) error {
_, err := q.db.ExecContext(ctx, clearExcludedPaths)
return err
}
const countExcludedPathsByLibrary = `-- name: CountExcludedPathsByLibrary :one
SELECT COUNT(*) FROM excluded_paths
WHERE library_id = ?
`
func (q *Queries) CountExcludedPathsByLibrary(ctx context.Context, libraryID int64) (int64, error) {
row := q.db.QueryRowContext(ctx, countExcludedPathsByLibrary, libraryID)
var count int64
err := row.Scan(&count)
return count, err
}
const excludePath = `-- name: ExcludePath :exec
INSERT INTO excluded_paths (library_id, file_path)
VALUES (?, ?)
ON CONFLICT(library_id, file_path) DO NOTHING
`
type ExcludePathParams struct {
LibraryID int64
FilePath string
}
func (q *Queries) ExcludePath(ctx context.Context, arg ExcludePathParams) error {
_, err := q.db.ExecContext(ctx, excludePath, arg.LibraryID, arg.FilePath)
return err
}
const getExcludedPathsByLibrary = `-- name: GetExcludedPathsByLibrary :many
SELECT file_path FROM excluded_paths
WHERE library_id = ?
`
func (q *Queries) GetExcludedPathsByLibrary(ctx context.Context, libraryID int64) ([]string, error) {
rows, err := q.db.QueryContext(ctx, getExcludedPathsByLibrary, libraryID)
if err != nil {
return nil, err
}
defer rows.Close()
var items []string
for rows.Next() {
var file_path string
if err := rows.Scan(&file_path); err != nil {
return nil, err
}
items = append(items, file_path)
}
if err := rows.Close(); err != nil {
return nil, err
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}