mirror of
https://git.vectorsigma.ru/public/photoview.git
synced 2026-08-03 19:29:15 +00:00
Show all root albums instead of the single path
Improve sql connection error messages
This commit is contained in:
@@ -25,6 +25,10 @@ func SetupDatabase() *sql.DB {
|
||||
log.Fatalf("Could not parse mysql url: %s\n", err)
|
||||
}
|
||||
|
||||
if address.String() == "" {
|
||||
log.Fatalln("ERROR: Environment variable MYSQL_URL missing, exiting")
|
||||
}
|
||||
|
||||
queryValues := address.Query()
|
||||
queryValues.Add("multiStatements", "true")
|
||||
queryValues.Add("parseTime", "true")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Copy this file to .env
|
||||
|
||||
MYSQL_URL=user:password@/dbname
|
||||
MYSQL_URL=user:password@tcp(localhost)/dbname
|
||||
|
||||
API_ENDPOINT=http://localhost:4001/
|
||||
API_LISTEN_PORT=4001
|
||||
@@ -20,7 +20,11 @@ func (r *queryResolver) MyAlbums(ctx context.Context, filter *models.Filter) ([]
|
||||
return nil, err
|
||||
}
|
||||
|
||||
rows, err := r.Database.Query("SELECT * FROM album WHERE owner_id = ? AND parent_album IS NULL"+filterSQL, user.UserID)
|
||||
rows, err := r.Database.Query(`
|
||||
SELECT * FROM album WHERE owner_id = ? AND parent_album = (
|
||||
SELECT album_id FROM album WHERE parent_album IS NULL
|
||||
)
|
||||
`+filterSQL, user.UserID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user