test
Some checks failed
Run tests / run_tests (push) Failing after 59s

This commit is contained in:
Snorre 2025-04-06 05:26:36 +02:00
parent 5b188064a7
commit d06ccea420

View file

@ -96,7 +96,8 @@ in {
# VALUES(${user.})" # VALUES(${user.})"
genUser = index: user: let genUser = index: user: let
values = values =
builtins.mapAttrs (name: value: builtins.mapAttrs
(name: value:
if (isBool value) if (isBool value)
then then
if value if value
@ -126,9 +127,11 @@ in {
if [ -n $(${sq} "SELECT 1 FROM Users WHERE Username = '${user.Username}'") ]; then if [ -n $(${sq} "SELECT 1 FROM Users WHERE Username = '${user.Username}'") ]; then
# Create user # Create user
${sq} "INSERT INTO Users (${concatStringsSep "," ${sq} "INSERT INTO Users (${concatStringsSep ","
(builtins.filter (x: x != "HashedPasswordFile") (
builtins.filter (x: x != "HashedPasswordFile")
(lib.attrsets.mapAttrsToList (name: value: "${name}") (lib.attrsets.mapAttrsToList (name: value: "${name}")
options.services.declarative-jellyfin.Users.options))}) \\ options.services.declarative-jellyfin.Users.options)
)}) \\
VALUES(${builtins.attrValues values})" VALUES(${builtins.attrValues values})"
fi fi
''; '';
@ -139,11 +142,14 @@ in {
'' ''
mkdir -p ${path} mkdir -p ${path}
# Make sure there is a database # Make sure there is a database
if [ -z "${path}/${dbname}" ] && cp ${defaultDB} "${path}/${dbname}" if [ -z "${path}/${dbname}" ]; then
cp ${defaultDB} "${path}/${dbname}"
fi
maxIndex=$(${sq} 'SELECT InternalId FROM Users ORDER BY InternalId DESC LIMIT 1') maxIndex=$(${sq} 'SELECT InternalId FROM Users ORDER BY InternalId DESC LIMIT 1')
if [ -n "$maxIndex" ] && maxIndex="1" if [ -n "$maxIndex" ]; then
maxIndex="1"
fi
'' ''
); );