Fix problems with creating and mapping tags on import

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/4/head
trivernis 3 years ago
parent 90eae0bc16
commit 89e79c63fa

@ -2,6 +2,12 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "Inflector"
version = "0.11.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3"
[[package]]
name = "adler"
version = "1.0.2"
@ -25,6 +31,12 @@ dependencies = [
"version_check",
]
[[package]]
name = "aliasable"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd"
[[package]]
name = "ansi_term"
version = "0.11.0"
@ -57,9 +69,9 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
[[package]]
name = "arrayvec"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be4dc07131ffa69b8072d35f5007352af944213cde02545e2103680baed38fcd"
checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"
[[package]]
name = "async-stream"
@ -77,9 +89,9 @@ version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "648ed8c8d2ce5409ccd57453d9d1b214b342a0d69376a6feda1fd6cae3299308"
dependencies = [
"proc-macro2 1.0.30",
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.80",
"syn 1.0.81",
]
[[package]]
@ -88,9 +100,9 @@ version = "0.1.51"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44318e776df68115a881de9a8fd1b9e53368d7a4a5ce4cc48517da3393233a5e"
dependencies = [
"proc-macro2 1.0.30",
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.80",
"syn 1.0.81",
]
[[package]]
@ -127,9 +139,9 @@ checksum = "ec107f431ee3d8a8e45e6dd117adab769556ef463959e77bf6a4888d5fd500cf"
dependencies = [
"heck",
"proc-macro-error 0.4.12",
"proc-macro2 1.0.30",
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.80",
"syn 1.0.81",
]
[[package]]
@ -174,12 +186,12 @@ dependencies = [
[[package]]
name = "blake3"
version = "1.1.0"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2607a74355ce2e252d0c483b2d8a348e1bba36036e786ccc2dcd777213c86ffd"
checksum = "526c210b4520e416420759af363083471656e819a75e831b8d2c9d5a584f2413"
dependencies = [
"arrayref",
"arrayvec 0.7.1",
"arrayvec 0.7.2",
"cc",
"cfg-if 1.0.0",
"constant_time_eq",
@ -227,9 +239,9 @@ checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
[[package]]
name = "cc"
version = "1.0.71"
version = "1.0.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79c2681d6594606957bbb8631c4b90a7fcaaa72cdb714743a437b156d6a7eedd"
checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee"
dependencies = [
"jobserver",
]
@ -293,12 +305,6 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
[[package]]
name = "convert_case"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
[[package]]
name = "core-foundation"
version = "0.9.2"
@ -326,9 +332,9 @@ dependencies = [
[[package]]
name = "crc"
version = "2.0.0"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10c2722795460108a7872e1cd933a85d6ec38abc4baecad51028f702da28889f"
checksum = "49fc9a695bca7f35f5f4c15cddc84415f66a74ea78eef08e90c5024f2b540e23"
dependencies = [
"crc-catalog",
]
@ -436,7 +442,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5bbed42daaa95e780b60a50546aa345b8413a1e46f9a40a12907d3598f038db"
dependencies = [
"data-encoding",
"syn 1.0.80",
"syn 1.0.81",
]
[[package]]
@ -568,9 +574,9 @@ checksum = "18e4a4b95cea4b4ccbcf1c5675ca7c4ee4e9e75eb79944d07defde18068f79bb"
dependencies = [
"autocfg",
"proc-macro-hack",
"proc-macro2 1.0.30",
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.80",
"syn 1.0.81",
]
[[package]]
@ -790,9 +796,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.105"
version = "0.2.107"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "869d572136620d55835903746bcb5cdc54cb2851fd0aeec53220b4bb65ef3013"
checksum = "fbe5e23404da5b4f555ef85ebed98fb4083e55a00c317800bc2a50ede9f3d219"
[[package]]
name = "libsqlite3-sys"
@ -865,6 +871,7 @@ version = "0.1.0"
dependencies = [
"base64",
"futures 0.3.17",
"itertools",
"multibase",
"multihash",
"rmp-ipc",
@ -912,6 +919,7 @@ dependencies = [
name = "mediarepo-model"
version = "0.1.0"
dependencies = [
"async-trait",
"chrono",
"mediarepo-core",
"mediarepo-database",
@ -974,9 +982,9 @@ dependencies = [
[[package]]
name = "minimal-lexical"
version = "0.1.4"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c64630dcdd71f1a64c435f54885086a0de5d6a12d104d69b165fb7d5286d677"
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
name = "miniz_oxide"
@ -1055,9 +1063,9 @@ checksum = "424f6e86263cd5294cbd7f1e95746b95aca0e0d66bff31e5a40d6baa87b4aa99"
dependencies = [
"proc-macro-crate",
"proc-macro-error 1.0.4",
"proc-macro2 1.0.30",
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.80",
"syn 1.0.81",
"synstructure",
]
@ -1081,9 +1089,9 @@ dependencies = [
[[package]]
name = "nom"
version = "7.0.0"
version = "7.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ffd9d26838a953b4af82cbeb9f1592c6798916983959be223a7124e992742c1"
checksum = "1b1d11e1ef389c76fe5b81bcaf2ea32cf88b62bc494e19f493d0b30e7a930109"
dependencies = [
"memchr",
"minimal-lexical",
@ -1175,9 +1183,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
[[package]]
name = "openssl"
version = "0.10.36"
version = "0.10.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d9facdb76fec0b73c406f125d44d86fdad818d66fef0531eec9233ca425ff4a"
checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95"
dependencies = [
"bitflags",
"cfg-if 1.0.0",
@ -1195,9 +1203,9 @@ checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a"
[[package]]
name = "openssl-sys"
version = "0.9.67"
version = "0.9.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69df2d8dfc6ce3aaf44b40dec6f487d5a886516cf6879c49e98e0710f310a058"
checksum = "c6517987b3f8226b5da3661dad65ff7f300cc59fb5ea8333ca191fc65fde3edf"
dependencies = [
"autocfg",
"cc",
@ -1206,6 +1214,30 @@ dependencies = [
"vcpkg",
]
[[package]]
name = "ouroboros"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3518a68fc597f6a42f83a31e41c039c3cbaa10fa8bb239c936c235e81cce873f"
dependencies = [
"aliasable",
"ouroboros_macro",
"stable_deref_trait",
]
[[package]]
name = "ouroboros_macro"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e23813b1bcb2d41a838849a2bbae40ae5c03c85ecabf04ba97086f438484714"
dependencies = [
"Inflector",
"proc-macro-error 1.0.4",
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.81",
]
[[package]]
name = "parking_lot"
version = "0.11.2"
@ -1252,9 +1284,9 @@ version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e8fe8163d14ce7f0cdac2e040116f22eac817edabff0be91e8aff7e9accf389"
dependencies = [
"proc-macro2 1.0.30",
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.80",
"syn 1.0.81",
]
[[package]]
@ -1271,9 +1303,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "pkg-config"
version = "0.3.21"
version = "0.3.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10e2fcbb64ecbe64c8e040a386c3104d384583af58b956d870aaaf229df6e66d"
checksum = "12295df4f294471248581bc09bef3c38a5e46f1e36d6a37353621a0c6c357e1f"
[[package]]
name = "png"
@ -1295,9 +1327,9 @@ checksum = "f6519412c9e0d4be579b9f0618364d19cb434b324fc6ddb1b27b1e682c7105ed"
[[package]]
name = "ppv-lite86"
version = "0.2.14"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3ca011bd0129ff4ae15cd04c4eef202cadf6c51c21e47aba319b4e0501db741"
checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba"
[[package]]
name = "proc-macro-crate"
@ -1316,9 +1348,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18f33027081eba0a6d8aba6d1b1c3a3be58cbb12106341c2d5759fcd9b5277e7"
dependencies = [
"proc-macro-error-attr 0.4.12",
"proc-macro2 1.0.30",
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.80",
"syn 1.0.81",
"version_check",
]
@ -1329,9 +1361,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
"proc-macro-error-attr 1.0.4",
"proc-macro2 1.0.30",
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.80",
"syn 1.0.81",
"version_check",
]
@ -1341,9 +1373,9 @@ version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a5b4b77fdb63c1eca72173d68d24501c54ab1269409f6b672c85deb18af69de"
dependencies = [
"proc-macro2 1.0.30",
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.80",
"syn 1.0.81",
"syn-mid",
"version_check",
]
@ -1354,7 +1386,7 @@ version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
"proc-macro2 1.0.30",
"proc-macro2 1.0.32",
"quote 1.0.10",
"version_check",
]
@ -1382,9 +1414,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.30"
version = "1.0.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edc3358ebc67bc8b7fa0c007f945b0b18226f78437d61bec735a9eb96b61ee70"
checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43"
dependencies = [
"unicode-xid 0.2.2",
]
@ -1404,7 +1436,7 @@ version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05"
dependencies = [
"proc-macro2 1.0.30",
"proc-macro2 1.0.32",
]
[[package]]
@ -1593,15 +1625,16 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "sea-orm"
version = "0.2.6"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3c5c7f0848ed7ddb2b3956abc84d5167dd33bb34c43e3b69172f565ca657a11"
checksum = "008887f4c2d0228891facd84a2c0bfdf175671a7a727798c63c14dfe04e343b2"
dependencies = [
"async-stream",
"async-trait",
"chrono",
"futures 0.3.17",
"futures-util",
"ouroboros",
"rust_decimal",
"sea-orm-macros",
"sea-query",
@ -1609,28 +1642,28 @@ dependencies = [
"serde",
"serde_json",
"sqlx",
"url",
"uuid",
]
[[package]]
name = "sea-orm-macros"
version = "0.2.6"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9466819cb0878e7fb6f6a1d7e46471a93b7121fef39db82f5799127884e39534"
checksum = "f8d4da296bdf6ab25a89e09af3a0d80e94e18580575fae3f7fbe7314604e8c8c"
dependencies = [
"bae",
"convert_case",
"heck",
"proc-macro2 1.0.30",
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.80",
"syn 1.0.81",
]
[[package]]
name = "sea-query"
version = "0.17.2"
version = "0.18.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17002e169ec19c435d33ebfbc25aa8d7381c2410cc2e27e556be837ec5546586"
checksum = "0ae0ce1a7c495076a9d6401c917b564fb75e77e05432e6c86084ca453b8256d7"
dependencies = [
"chrono",
"rust_decimal",
@ -1646,9 +1679,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34cdc022b4f606353fe5dc85b09713a04e433323b70163e81513b141c6ae6eb5"
dependencies = [
"heck",
"proc-macro2 1.0.30",
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.80",
"syn 1.0.81",
"thiserror",
]
@ -1668,9 +1701,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51c247af6c2c4ffd372fe97e9afa579b4438e4c306c9aa3f11cbf72f1e845180"
dependencies = [
"heck",
"proc-macro2 1.0.30",
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.80",
"syn 1.0.81",
]
[[package]]
@ -1711,16 +1744,16 @@ version = "1.0.130"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b"
dependencies = [
"proc-macro2 1.0.30",
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.80",
"syn 1.0.81",
]
[[package]]
name = "serde_json"
version = "1.0.68"
version = "1.0.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f690853975602e1bfe1ccbf50504d67174e3bcf340f23b5ea9992e0587a52d8"
checksum = "e466864e431129c7e0d3476b92f20458e5879919a0596c6472738d9fa2d342f8"
dependencies = [
"indexmap",
"itoa",
@ -1875,13 +1908,13 @@ dependencies = [
"either",
"heck",
"once_cell",
"proc-macro2 1.0.30",
"proc-macro2 1.0.32",
"quote 1.0.10",
"serde_json",
"sha2",
"sqlx-core",
"sqlx-rt",
"syn 1.0.80",
"syn 1.0.81",
"url",
]
@ -1897,6 +1930,12 @@ dependencies = [
"tokio-native-tls",
]
[[package]]
name = "stable_deref_trait"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]]
name = "stringprep"
version = "0.1.2"
@ -1932,9 +1971,9 @@ checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0"
dependencies = [
"heck",
"proc-macro-error 1.0.4",
"proc-macro2 1.0.30",
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.80",
"syn 1.0.81",
]
[[package]]
@ -1950,11 +1989,11 @@ dependencies = [
[[package]]
name = "syn"
version = "1.0.80"
version = "1.0.81"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d010a1623fbd906d51d650a9916aaefc05ffa0e4053ff7fe601167f3e715d194"
checksum = "f2afee18b8beb5a596ecb4a2dce128c719b4ba399d34126b9e4396e3f9860966"
dependencies = [
"proc-macro2 1.0.30",
"proc-macro2 1.0.32",
"quote 1.0.10",
"unicode-xid 0.2.2",
]
@ -1965,9 +2004,9 @@ version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baa8e7560a164edb1621a55d18a0c59abf49d360f47aa7b821061dd7eea7fac9"
dependencies = [
"proc-macro2 1.0.30",
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.80",
"syn 1.0.81",
]
[[package]]
@ -1976,9 +2015,9 @@ version = "0.12.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f"
dependencies = [
"proc-macro2 1.0.30",
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.80",
"syn 1.0.81",
"unicode-xid 0.2.2",
]
@ -2020,9 +2059,9 @@ version = "1.0.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b"
dependencies = [
"proc-macro2 1.0.30",
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.80",
"syn 1.0.81",
]
[[package]]
@ -2071,9 +2110,9 @@ dependencies = [
[[package]]
name = "time"
version = "0.3.3"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cde1cf55178e0293453ba2cca0d5f8392a922e52aa958aee9c28ed02becc6d03"
checksum = "99beeb0daeac2bd1e86ac2c21caddecb244b39a093594da1a661ec2060c7aedd"
dependencies = [
"itoa",
"libc",
@ -2081,9 +2120,9 @@ dependencies = [
[[package]]
name = "tinyvec"
version = "1.5.0"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f83b2a3d4d9091d0abd7eba4dc2710b1718583bd4d8992e2190720ea38f391f7"
checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2"
dependencies = [
"tinyvec_macros",
]
@ -2096,9 +2135,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]]
name = "tokio"
version = "1.12.0"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2c2416fdedca8443ae44b4527de1ea633af61d8f7169ffa6e72c5b53d24efcc"
checksum = "588b2d10a336da58d877567cd8fb8a14b463e2104910f8132cd054b4b96e29ee"
dependencies = [
"autocfg",
"bytes",
@ -2123,13 +2162,13 @@ dependencies = [
[[package]]
name = "tokio-macros"
version = "1.5.0"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2dd85aeaba7b68df939bd357c6afb36c87951be9e80bf9c859f2fc3e9fca0fd"
checksum = "114383b041aa6212c579467afa0075fbbdd0718de036100bc0ba7961d8cb9095"
dependencies = [
"proc-macro2 1.0.30",
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.80",
"syn 1.0.81",
]
[[package]]
@ -2144,9 +2183,9 @@ dependencies = [
[[package]]
name = "tokio-stream"
version = "0.1.7"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b2f3f698253f03119ac0102beaa64f67a67e08074d03a22d18784104543727f"
checksum = "50145484efff8818b5ccd256697f36863f587da82cf8b409c53adf1e840798e3"
dependencies = [
"futures-core",
"pin-project-lite",
@ -2181,8 +2220,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94571df2eae3ed4353815ea5a90974a594a1792d8782ff2cbcc9392d1101f366"
dependencies = [
"crossbeam-channel",
"time 0.3.3",
"tracing-subscriber 0.3.0",
"time 0.3.4",
"tracing-subscriber 0.3.1",
]
[[package]]
@ -2191,9 +2230,9 @@ version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4f480b8f81512e825f337ad51e94c1eb5d3bbdf2b363dcd01e2b19a9ffe3f8e"
dependencies = [
"proc-macro2 1.0.30",
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.80",
"syn 1.0.81",
]
[[package]]
@ -2272,9 +2311,9 @@ dependencies = [
[[package]]
name = "tracing-subscriber"
version = "0.3.0"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5cf865b5ddc38e503a29c41c4843e616a73028ae18c637bc3eb2afaef4909c84"
checksum = "80a4ddde70311d8da398062ecf6fc2c309337de6b0f77d6c27aff8d53f6fca52"
dependencies = [
"sharded-slab",
"thread_local",
@ -2349,9 +2388,9 @@ checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e"
[[package]]
name = "unsigned-varint"
version = "0.7.0"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f8d425fafb8cd76bc3f22aace4af471d3156301d7508f2107e98fbeae10bc7f"
checksum = "d86a8dc7f45e4c1b0d30e43038c38f274e77af056aa5f74b93c2cf9eb3c1c836"
[[package]]
name = "url"
@ -2418,9 +2457,9 @@ dependencies = [
"bumpalo",
"lazy_static",
"log",
"proc-macro2 1.0.30",
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.80",
"syn 1.0.81",
"wasm-bindgen-shared",
]
@ -2440,9 +2479,9 @@ version = "0.2.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab"
dependencies = [
"proc-macro2 1.0.30",
"proc-macro2 1.0.32",
"quote 1.0.10",
"syn 1.0.80",
"syn 1.0.81",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@ -2481,9 +2520,9 @@ checksum = "d8b77fdfd5a253be4ab714e4ffa3c49caf146b4de743e97510c0656cf90f1e8e"
[[package]]
name = "whoami"
version = "1.1.5"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "483a59fee1a93fec90eb08bc2eb4315ef10f4ebc478b3a5fadc969819cb66117"
checksum = "c33ac5ee236a4efbf2c98967e12c6cc0c51d93a744159a52957ba206ae6ef5f7"
dependencies = [
"wasm-bindgen",
"web-sys",

@ -2,6 +2,12 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "Inflector"
version = "0.11.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3"
[[package]]
name = "adler"
version = "1.0.2"
@ -25,6 +31,12 @@ dependencies = [
"version_check",
]
[[package]]
name = "aliasable"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd"
[[package]]
name = "arrayref"
version = "0.3.6"
@ -690,6 +702,7 @@ version = "0.1.0"
dependencies = [
"base64",
"futures",
"itertools",
"multibase",
"multihash",
"rmp-ipc",
@ -896,6 +909,30 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
[[package]]
name = "ouroboros"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3518a68fc597f6a42f83a31e41c039c3cbaa10fa8bb239c936c235e81cce873f"
dependencies = [
"aliasable",
"ouroboros_macro",
"stable_deref_trait",
]
[[package]]
name = "ouroboros_macro"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e23813b1bcb2d41a838849a2bbae40ae5c03c85ecabf04ba97086f438484714"
dependencies = [
"Inflector",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "parking_lot"
version = "0.11.2"
@ -1101,24 +1138,26 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "sea-orm"
version = "0.2.4"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e715900921a367b557c9f5b5b5f554f514130d104c5ec1b555dfccc0e11a90e8"
checksum = "008887f4c2d0228891facd84a2c0bfdf175671a7a727798c63c14dfe04e343b2"
dependencies = [
"async-stream",
"async-trait",
"futures",
"futures-util",
"ouroboros",
"sea-query",
"sea-strum",
"serde",
"url",
]
[[package]]
name = "sea-query"
version = "0.16.5"
version = "0.18.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "365da31fb7b9b77aaf655797a0e60cfb18121906c03779558035e8fd4c6be2c2"
checksum = "0ae0ce1a7c495076a9d6401c917b564fb75e77e05432e6c86084ca453b8256d7"
dependencies = [
"sea-query-derive",
]
@ -1300,6 +1339,12 @@ version = "0.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d1bd069de53442e7a320f525a6d4deb8bb0621ac7a55f7eccbc2b58b57f43d0"
[[package]]
name = "stable_deref_trait"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]]
name = "stringprep"
version = "0.1.2"

@ -16,9 +16,10 @@ rmp-ipc = "0.9.2"
typemap_rev = "0.1.5"
futures = "0.3.17"
thumbnailer = "0.1.0"
itertools = "0.10.1"
[dependencies.sea-orm]
version = "0.2.4"
version = "0.3.2"
default-features = false
[dependencies.sqlx]

@ -49,6 +49,9 @@ pub enum RepoDatabaseError {
#[error(transparent)]
SqlxMigrateError(#[from] sqlx::migrate::MigrateError),
#[error("An invalid handle {0} was used")]
InvalidHandle(i64),
}
#[derive(Debug)]

@ -6,5 +6,6 @@ pub mod type_keys;
pub mod utils;
pub use futures;
pub use itertools;
pub use rmp_ipc;
pub use thumbnailer;

@ -2,6 +2,12 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "Inflector"
version = "0.11.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3"
[[package]]
name = "adler"
version = "1.0.2"
@ -25,6 +31,12 @@ dependencies = [
"version_check",
]
[[package]]
name = "aliasable"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd"
[[package]]
name = "arrayref"
version = "0.3.6"
@ -236,12 +248,6 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
[[package]]
name = "convert_case"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
[[package]]
name = "core-foundation"
version = "0.9.1"
@ -764,6 +770,7 @@ version = "0.1.0"
dependencies = [
"base64",
"futures",
"itertools",
"multibase",
"multihash",
"rmp-ipc",
@ -1043,6 +1050,30 @@ dependencies = [
"vcpkg",
]
[[package]]
name = "ouroboros"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3518a68fc597f6a42f83a31e41c039c3cbaa10fa8bb239c936c235e81cce873f"
dependencies = [
"aliasable",
"ouroboros_macro",
"stable_deref_trait",
]
[[package]]
name = "ouroboros_macro"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e23813b1bcb2d41a838849a2bbae40ae5c03c85ecabf04ba97086f438484714"
dependencies = [
"Inflector",
"proc-macro-error 1.0.4",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "parking_lot"
version = "0.11.2"
@ -1362,15 +1393,16 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "sea-orm"
version = "0.2.4"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e715900921a367b557c9f5b5b5f554f514130d104c5ec1b555dfccc0e11a90e8"
checksum = "008887f4c2d0228891facd84a2c0bfdf175671a7a727798c63c14dfe04e343b2"
dependencies = [
"async-stream",
"async-trait",
"chrono",
"futures",
"futures-util",
"ouroboros",
"rust_decimal",
"sea-orm-macros",
"sea-query",
@ -1378,17 +1410,17 @@ dependencies = [
"serde",
"serde_json",
"sqlx",
"url",
"uuid",
]
[[package]]
name = "sea-orm-macros"
version = "0.2.4"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82b6f4cdd6d918845980bd3572f55f95d9c79a9c2352192f33bca99d91ca350a"
checksum = "f8d4da296bdf6ab25a89e09af3a0d80e94e18580575fae3f7fbe7314604e8c8c"
dependencies = [
"bae",
"convert_case",
"heck",
"proc-macro2",
"quote",
@ -1397,9 +1429,9 @@ dependencies = [
[[package]]
name = "sea-query"
version = "0.16.5"
version = "0.18.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "365da31fb7b9b77aaf655797a0e60cfb18121906c03779558035e8fd4c6be2c2"
checksum = "0ae0ce1a7c495076a9d6401c917b564fb75e77e05432e6c86084ca453b8256d7"
dependencies = [
"chrono",
"rust_decimal",
@ -1635,6 +1667,12 @@ dependencies = [
"tokio-native-tls",
]
[[package]]
name = "stable_deref_trait"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]]
name = "stringprep"
version = "0.1.2"

@ -13,10 +13,10 @@ tracing = "0.1.29"
path = "../mediarepo-core"
[dependencies.sqlx]
version = "0.5.7"
version = "0.5.9"
features = ["migrate"]
[dependencies.sea-orm]
version = "0.2.3"
version = "0.3.2"
features = ["sqlx-sqlite", "runtime-tokio-native-tls", "macros"]
default-features = false

@ -35,7 +35,7 @@ pub async fn get_hashes_with_namespaced_tags(
.as_str(),
vec![],
))
.all(&db)
.all(db)
.await?;
let mut hash_namespaces: HashMap<i64, HashMap<String, String>> = HashMap::new();
for hnt in hash_namespace_tags {

@ -2,6 +2,12 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "Inflector"
version = "0.11.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3"
[[package]]
name = "adler"
version = "1.0.2"
@ -25,6 +31,12 @@ dependencies = [
"version_check",
]
[[package]]
name = "aliasable"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd"
[[package]]
name = "arrayref"
version = "0.3.6"
@ -236,12 +248,6 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
[[package]]
name = "convert_case"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
[[package]]
name = "core-foundation"
version = "0.9.1"
@ -764,6 +770,7 @@ version = "0.1.0"
dependencies = [
"base64",
"futures",
"itertools",
"multibase",
"multihash",
"rmp-ipc",
@ -792,6 +799,7 @@ dependencies = [
name = "mediarepo-model"
version = "0.1.0"
dependencies = [
"async-trait",
"chrono",
"mediarepo-core",
"mediarepo-database",
@ -1069,6 +1077,30 @@ dependencies = [
"vcpkg",
]
[[package]]
name = "ouroboros"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3518a68fc597f6a42f83a31e41c039c3cbaa10fa8bb239c936c235e81cce873f"
dependencies = [
"aliasable",
"ouroboros_macro",
"stable_deref_trait",
]
[[package]]
name = "ouroboros_macro"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e23813b1bcb2d41a838849a2bbae40ae5c03c85ecabf04ba97086f438484714"
dependencies = [
"Inflector",
"proc-macro-error 1.0.4",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "parking_lot"
version = "0.11.2"
@ -1388,15 +1420,16 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "sea-orm"
version = "0.2.4"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e715900921a367b557c9f5b5b5f554f514130d104c5ec1b555dfccc0e11a90e8"
checksum = "008887f4c2d0228891facd84a2c0bfdf175671a7a727798c63c14dfe04e343b2"
dependencies = [
"async-stream",
"async-trait",
"chrono",
"futures",
"futures-util",
"ouroboros",
"rust_decimal",
"sea-orm-macros",
"sea-query",
@ -1404,17 +1437,17 @@ dependencies = [
"serde",
"serde_json",
"sqlx",
"url",
"uuid",
]
[[package]]
name = "sea-orm-macros"
version = "0.2.4"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82b6f4cdd6d918845980bd3572f55f95d9c79a9c2352192f33bca99d91ca350a"
checksum = "f8d4da296bdf6ab25a89e09af3a0d80e94e18580575fae3f7fbe7314604e8c8c"
dependencies = [
"bae",
"convert_case",
"heck",
"proc-macro2",
"quote",
@ -1423,9 +1456,9 @@ dependencies = [
[[package]]
name = "sea-query"
version = "0.16.5"
version = "0.18.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "365da31fb7b9b77aaf655797a0e60cfb18121906c03779558035e8fd4c6be2c2"
checksum = "0ae0ce1a7c495076a9d6401c917b564fb75e77e05432e6c86084ca453b8256d7"
dependencies = [
"chrono",
"rust_decimal",
@ -1661,6 +1694,12 @@ dependencies = [
"tokio-native-tls",
]
[[package]]
name = "stable_deref_trait"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]]
name = "stringprep"
version = "0.1.2"

@ -12,6 +12,8 @@ serde = "1.0.130"
mime_guess = "2.0.3"
mime = "0.3.16"
tracing = "0.1.29"
async-trait = "0.1.51"
[dependencies.mediarepo-core]
path = "../mediarepo-core"
@ -20,7 +22,7 @@ path = "../mediarepo-core"
path = "../mediarepo-database"
[dependencies.sea-orm]
version = "0.2.3"
version = "0.3.2"
features = ["runtime-tokio-native-tls", "macros"]
default-features = false

@ -0,0 +1,16 @@
pub mod tag_handle;
use async_trait::async_trait;
use mediarepo_core::error::RepoResult;
use sea_orm::DatabaseConnection;
#[async_trait]
pub trait EntityHandle {
type Model;
/// Returns the ID that is stored in the handle
fn id(&self) -> i64;
/// Returns the model associated with the handle
async fn model(&self, db: DatabaseConnection) -> RepoResult<Self::Model>;
}

@ -0,0 +1,24 @@
use crate::handles::EntityHandle;
use crate::tag::Tag;
use async_trait::async_trait;
use mediarepo_core::error::{RepoDatabaseError, RepoResult};
use sea_orm::DatabaseConnection;
pub struct TagHandle(pub(crate) i64);
#[async_trait]
impl EntityHandle for TagHandle {
type Model = Tag;
fn id(&self) -> i64 {
self.0
}
async fn model(&self, db: DatabaseConnection) -> RepoResult<Self::Model> {
let tag = Tag::by_id(db, self.0)
.await?
.ok_or_else(|| RepoDatabaseError::InvalidHandle(self.id()))?;
Ok(tag)
}
}

@ -1,5 +1,6 @@
pub mod file;
pub mod file_type;
pub mod handles;
pub mod hash;
pub mod namespace;
pub mod repo;

@ -1,7 +1,9 @@
use mediarepo_core::error::RepoResult;
use mediarepo_database::entities::namespace;
use sea_orm::prelude::*;
use sea_orm::{DatabaseConnection, Set};
use sea_orm::{
Condition, ConnectionTrait, DatabaseBackend, DatabaseConnection, InsertResult, Set, Statement,
};
use std::fmt::Debug;
#[derive(Clone)]
@ -42,6 +44,65 @@ impl Namespace {
Ok(namespace)
}
/// Returns all namespaces by name
#[tracing::instrument(level = "debug", skip(db))]
pub async fn all_by_name(db: DatabaseConnection, names: Vec<String>) -> RepoResult<Vec<Self>> {
if names.is_empty() {
return Ok(Vec::with_capacity(0));
}
let mut condition = Condition::any();
for name in names {
condition = condition.add(namespace::Column::Name.eq(name));
}
let namespaces = namespace::Entity::find()
.filter(condition)
.all(&db)
.await?
.into_iter()
.map(|model| Self::new(db.clone(), model))
.collect();
Ok(namespaces)
}
/// Adds all namespaces to the database
#[tracing::instrument(level = "debug", skip(db))]
pub async fn add_all(db: DatabaseConnection, names: Vec<String>) -> RepoResult<Vec<Self>> {
if names.is_empty() {
return Ok(vec![]);
}
let models: Vec<namespace::ActiveModel> = names
.into_iter()
.map(|name| namespace::ActiveModel {
name: Set(name),
..Default::default()
})
.collect();
let txn = db.begin().await?;
let last_id = txn
.query_one(Statement::from_string(
DatabaseBackend::Sqlite,
r#"SELECT MAX(id) AS "max_id" FROM namespaces;"#.to_owned(),
))
.await?
.and_then(|result| result.try_get("", "max_id").ok())
.unwrap_or(-1);
let result: InsertResult<namespace::ActiveModel> =
namespace::Entity::insert_many(models).exec(&txn).await?;
let namespaces = namespace::Entity::find()
.filter(namespace::Column::Id.between(last_id, result.last_insert_id + 1))
.all(&txn)
.await?
.into_iter()
.map(|model| Self::new(db.clone(), model))
.collect();
txn.commit().await?;
Ok(namespaces)
}
/// Adds a namespace to the database
#[tracing::instrument(level = "debug", skip(db))]
pub async fn add<S: ToString + Debug>(db: DatabaseConnection, name: S) -> RepoResult<Self> {

@ -6,6 +6,7 @@ use crate::tag::Tag;
use crate::thumbnail::Thumbnail;
use chrono::{Local, NaiveDateTime};
use mediarepo_core::error::{RepoError, RepoResult};
use mediarepo_core::itertools::Itertools;
use mediarepo_core::thumbnailer::ThumbnailSize;
use mediarepo_core::utils::parse_namespace_and_tag;
use mediarepo_database::get_database;
@ -280,7 +281,25 @@ impl Repo {
/// Adds all tags that are not in the database to the database and returns the ones already existing as well
#[tracing::instrument(level = "debug", skip_all)]
pub async fn add_all_tags(&self, tags: Vec<(Option<String>, String)>) -> RepoResult<Vec<Tag>> {
let mut tags_to_add = tags;
let mut tags_to_add = tags.into_iter().unique().collect_vec();
let mut namespaces_to_add = tags_to_add
.iter()
.filter_map(|(namespace, _)| namespace.clone())
.unique()
.collect_vec();
let mut existing_namespaces =
Namespace::all_by_name(self.db.clone(), namespaces_to_add.clone()).await?;
{
let existing_namespaces_set = existing_namespaces
.iter()
.map(|n| n.name().clone())
.collect::<HashSet<String>>();
namespaces_to_add.retain(|namespace| !existing_namespaces_set.contains(namespace));
}
existing_namespaces
.append(&mut Namespace::add_all(self.db.clone(), namespaces_to_add).await?);
let mut existing_tags = self.tags_by_names(tags_to_add.clone()).await?;
{
let existing_tags_set = existing_tags
@ -290,14 +309,15 @@ impl Repo {
tags_to_add.retain(|t| !existing_tags_set.contains(t));
}
for (namespace, name) in tags_to_add {
let tag = if let Some(namespace) = namespace {
self.add_namespaced_tag(namespace, name).await?
} else {
self.add_unnamespaced_tag(name).await?
};
existing_tags.push(tag);
}
let namespace_map = existing_namespaces
.into_iter()
.map(|namespace| (namespace.name().clone(), namespace.id()))
.collect::<HashMap<String, i64>>();
let tags_to_add = tags_to_add
.into_iter()
.map(|(nsp, name)| (nsp.and_then(|n| namespace_map.get(&n)).map(|i| *i), name))
.collect_vec();
existing_tags.append(&mut Tag::add_all(self.db.clone(), tags_to_add).await?);
Ok(existing_tags)
}

@ -5,9 +5,10 @@ use mediarepo_database::entities::hash_tag;
use mediarepo_database::entities::namespace;
use mediarepo_database::entities::tag;
use sea_orm::prelude::*;
use sea_orm::query::ConnectionTrait;
use sea_orm::sea_query::Expr;
use sea_orm::QuerySelect;
use sea_orm::{Condition, DatabaseConnection, JoinType, Set};
use sea_orm::{Condition, DatabaseBackend, DatabaseConnection, JoinType, Set, Statement};
use sea_orm::{InsertResult, QuerySelect};
use std::fmt::Debug;
#[derive(Clone)]
@ -77,7 +78,7 @@ impl Tag {
namespaces_with_names: Vec<(Option<String>, String)>,
) -> RepoResult<Vec<Self>> {
if namespaces_with_names.is_empty() {
return Ok(Vec::new());
return Ok(vec![]);
}
let mut or_condition = Condition::any();
@ -126,6 +127,46 @@ impl Tag {
Ok(tags)
}
pub async fn add_all(
db: DatabaseConnection,
namespaces_with_names: Vec<(Option<i64>, String)>,
) -> RepoResult<Vec<Self>> {
if namespaces_with_names.is_empty() {
return Ok(vec![]);
}
let models: Vec<tag::ActiveModel> = namespaces_with_names
.into_iter()
.map(|(namespace_id, name)| tag::ActiveModel {
name: Set(name),
namespace_id: Set(namespace_id),
..Default::default()
})
.collect();
let txn = db.begin().await?;
let last_id: i64 = txn
.query_one(Statement::from_string(
DatabaseBackend::Sqlite,
r#"SELECT MAX(id) as "max_id" FROM tags"#.to_owned(),
))
.await?
.and_then(|res| res.try_get("", "max_id").ok())
.unwrap_or(-1);
let result: InsertResult<tag::ActiveModel> =
tag::Entity::insert_many(models).exec(&txn).await?;
let tags: Vec<Self> = tag::Entity::find()
.find_also_related(namespace::Entity)
.filter(tag::Column::Id.between(last_id, result.last_insert_id + 1))
.all(&txn)
.await?
.into_iter()
.map(|(t, n)| Self::new(db.clone(), t, n))
.collect();
txn.commit().await?;
Ok(tags)
}
/// Adds a new tag to the database
#[tracing::instrument(level = "debug", skip(db))]
pub async fn add<S: ToString + Debug>(

@ -2,6 +2,12 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "Inflector"
version = "0.11.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3"
[[package]]
name = "adler"
version = "1.0.2"
@ -25,6 +31,12 @@ dependencies = [
"version_check",
]
[[package]]
name = "aliasable"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd"
[[package]]
name = "arrayref"
version = "0.3.6"
@ -249,12 +261,6 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
[[package]]
name = "convert_case"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
[[package]]
name = "core-foundation"
version = "0.9.1"
@ -806,6 +812,7 @@ version = "0.1.0"
dependencies = [
"base64",
"futures 0.3.17",
"itertools",
"multibase",
"multihash",
"rmp-ipc",
@ -834,6 +841,7 @@ dependencies = [
name = "mediarepo-model"
version = "0.1.0"
dependencies = [
"async-trait",
"chrono",
"mediarepo-core",
"mediarepo-database",
@ -1128,6 +1136,30 @@ dependencies = [
"vcpkg",
]
[[package]]
name = "ouroboros"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3518a68fc597f6a42f83a31e41c039c3cbaa10fa8bb239c936c235e81cce873f"
dependencies = [
"aliasable",
"ouroboros_macro",
"stable_deref_trait",
]
[[package]]
name = "ouroboros_macro"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e23813b1bcb2d41a838849a2bbae40ae5c03c85ecabf04ba97086f438484714"
dependencies = [
"Inflector",
"proc-macro-error 1.0.4",
"proc-macro2 1.0.29",
"quote 1.0.10",
"syn 1.0.80",
]
[[package]]
name = "parking_lot"
version = "0.11.2"
@ -1491,15 +1523,16 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "sea-orm"
version = "0.2.6"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3c5c7f0848ed7ddb2b3956abc84d5167dd33bb34c43e3b69172f565ca657a11"
checksum = "008887f4c2d0228891facd84a2c0bfdf175671a7a727798c63c14dfe04e343b2"
dependencies = [
"async-stream",
"async-trait",
"chrono",
"futures 0.3.17",
"futures-util",
"ouroboros",
"rust_decimal",
"sea-orm-macros",
"sea-query",
@ -1507,17 +1540,17 @@ dependencies = [
"serde",
"serde_json",
"sqlx",
"url",
"uuid",
]
[[package]]
name = "sea-orm-macros"
version = "0.2.6"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9466819cb0878e7fb6f6a1d7e46471a93b7121fef39db82f5799127884e39534"
checksum = "f8d4da296bdf6ab25a89e09af3a0d80e94e18580575fae3f7fbe7314604e8c8c"
dependencies = [
"bae",
"convert_case",
"heck",
"proc-macro2 1.0.29",
"quote 1.0.10",
@ -1526,9 +1559,9 @@ dependencies = [
[[package]]
name = "sea-query"
version = "0.17.0"
version = "0.18.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1db6d690760e4f48663f0ecd9d91b03c1e6a5b17991d1c53043c5f07ba7db29"
checksum = "0ae0ce1a7c495076a9d6401c917b564fb75e77e05432e6c86084ca453b8256d7"
dependencies = [
"chrono",
"rust_decimal",
@ -1786,6 +1819,12 @@ dependencies = [
"tokio-native-tls",
]
[[package]]
name = "stable_deref_trait"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]]
name = "stringprep"
version = "0.1.2"

@ -7,14 +7,14 @@ use mediarepo_api::types::files::{
SortKey, ThumbnailMetadataResponse, UpdateFileNameRequest,
};
use mediarepo_core::error::RepoError;
use mediarepo_core::itertools::Itertools;
use mediarepo_core::rmp_ipc::prelude::*;
use mediarepo_core::thumbnailer::ThumbnailSize;
use mediarepo_core::utils::parse_namespace_and_tag;
use mediarepo_database::queries::tags::get_hashes_with_namespaced_tags;
use mediarepo_model::file::File;
use std::cmp::Ordering;
use std::collections::{HashMap, HashSet};
use std::iter::FromIterator;
use std::collections::HashMap;
use tokio::io::AsyncReadExt;
pub struct FilesNamespace;
@ -112,11 +112,10 @@ impl FilesNamespace {
.await?;
file.set_name(metadata.name).await?;
let tags: HashSet<String> = HashSet::from_iter(tags.into_iter());
let tags = repo
.add_all_tags(tags.into_iter().map(parse_namespace_and_tag).collect())
.await?;
let tag_ids: Vec<i64> = tags.into_iter().map(|t| t.id()).collect();
let tag_ids: Vec<i64> = tags.into_iter().map(|t| t.id()).unique().collect();
file.add_tags(tag_ids).await?;
ctx.emitter

Loading…
Cancel
Save