mirror of
https://github.com/flibusta-apps/library_updater.git
synced 2025-12-06 07:45:35 +01:00
Compare commits
13 Commits
f1940e8335
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae74dc94bb | ||
| 7d99897b0e | |||
| 35dc3cbf6f | |||
| 4625adb6a4 | |||
| 65e23787f1 | |||
| e1af1c2623 | |||
| 788a6d232e | |||
| c8fa902da9 | |||
|
|
d2ba22541c | ||
|
|
9df3aaed03 | ||
| 688246bc23 | |||
| 7fa41a6bf1 | |||
|
|
0cafded7e2 |
2
.github/workflows/build_docker_image.yml
vendored
2
.github/workflows/build_docker_image.yml
vendored
@@ -10,7 +10,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|||||||
4
.github/workflows/rust-clippy.yml
vendored
4
.github/workflows/rust-clippy.yml
vendored
@@ -28,7 +28,7 @@ jobs:
|
|||||||
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
|
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Install Rust toolchain
|
- name: Install Rust toolchain
|
||||||
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #@v1
|
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #@v1
|
||||||
@@ -49,7 +49,7 @@ jobs:
|
|||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|
||||||
- name: Upload analysis results to GitHub
|
- name: Upload analysis results to GitHub
|
||||||
uses: github/codeql-action/upload-sarif@v3
|
uses: github/codeql-action/upload-sarif@v4
|
||||||
with:
|
with:
|
||||||
sarif_file: rust-clippy-results.sarif
|
sarif_file: rust-clippy-results.sarif
|
||||||
wait-for-processing: true
|
wait-for-processing: true
|
||||||
|
|||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
/target
|
/target
|
||||||
.vscode
|
/.vscode
|
||||||
|
/bruno
|
||||||
|
|||||||
424
Cargo.lock
generated
424
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -19,7 +19,7 @@ strip = false
|
|||||||
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
sql-parse = "0.24.0"
|
sql-parse = "0.26.0"
|
||||||
tokio = { version = "1.44.2", features = ["full"] }
|
tokio = { version = "1.44.2", features = ["full"] }
|
||||||
tokio-postgres = { version = "0.7.13", features = ["with-chrono-0_4"] }
|
tokio-postgres = { version = "0.7.13", features = ["with-chrono-0_4"] }
|
||||||
deadpool-postgres = "0.14.1"
|
deadpool-postgres = "0.14.1"
|
||||||
@@ -29,18 +29,18 @@ futures = "0.3.31"
|
|||||||
reqwest = { version = "0.12.15", features = ["stream"] }
|
reqwest = { version = "0.12.15", features = ["stream"] }
|
||||||
tokio-util = { version = "0.7.14", features = ["compat"] }
|
tokio-util = { version = "0.7.14", features = ["compat"] }
|
||||||
async-compression = { version = "0.4.21", features = ["futures-io", "gzip"] }
|
async-compression = { version = "0.4.21", features = ["futures-io", "gzip"] }
|
||||||
sentry = { version = "0.41.0", features = ["debug-images"] }
|
sentry = { version = "0.42.0", features = ["debug-images"] }
|
||||||
lazy_static = "1.5.0"
|
lazy_static = "1.5.0"
|
||||||
serde = { version = "1.0.219", features = ["derive"] }
|
serde = { version = "1.0.219", features = ["derive"] }
|
||||||
serde_json = "1.0.140"
|
serde_json = "1.0.140"
|
||||||
tokio-cron-scheduler = "0.14.0"
|
tokio-cron-scheduler = "0.14.0"
|
||||||
axum = "0.8.1"
|
axum = "0.8.1"
|
||||||
ammonia = "4.0.0"
|
ammonia = "4.1.2"
|
||||||
maplit = "1.0.2"
|
maplit = "1.0.2"
|
||||||
|
|
||||||
tracing = "0.1.41"
|
tracing = "0.1.41"
|
||||||
tracing-subscriber = { version = "0.3.19", features = ["env-filter"]}
|
tracing-subscriber = { version = "0.3.19", features = ["env-filter"]}
|
||||||
sentry-tracing = "0.41.0"
|
sentry-tracing = "0.42.0"
|
||||||
|
|
||||||
tower-http = { version = "0.6.2", features = ["trace"] }
|
tower-http = { version = "0.6.2", features = ["trace"] }
|
||||||
dotenvy = "0.15.0"
|
dotenvy = "0.15.0"
|
||||||
|
|||||||
40
src/types.rs
40
src/types.rs
@@ -828,30 +828,28 @@ impl FromVecExpression<Genre> for Genre {
|
|||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl Update for Genre {
|
impl Update for Genre {
|
||||||
async fn before_update(client: &Client) -> Result<(), Box<tokio_postgres::Error>> {
|
async fn before_update(client: &Client) -> Result<(), Box<tokio_postgres::Error>> {
|
||||||
match client.execute(
|
match client
|
||||||
"
|
.execute(
|
||||||
CREATE OR REPLACE FUNCTION update_book_sequence(source_ smallint, book_ integer, genre_ integer) RETURNS void AS $$
|
"
|
||||||
DECLARE
|
CREATE OR REPLACE FUNCTION update_genre(
|
||||||
book_id integer := -1;
|
source_ smallint, remote_id_ int, code_ varchar, description_ varchar, meta_ varchar
|
||||||
genre_id integer := -1;
|
) RETURNS void AS $$
|
||||||
BEGIN
|
BEGIN
|
||||||
SELECT id INTO book_id FROM books WHERE source = source_ AND remote_id = book_;
|
INSERT INTO genres (source, remote_id, code, description, meta)
|
||||||
|
VALUES (source_, remote_id_, code_, description_, meta_)
|
||||||
IF book_id IS NULL THEN
|
ON CONFLICT (source, remote_id) DO UPDATE SET
|
||||||
RETURN;
|
code = EXCLUDED.code,
|
||||||
END IF;
|
description = EXCLUDED.description,
|
||||||
|
meta = EXCLUDED.meta;
|
||||||
SELECT id INTO genre_id FROM genres WHERE source = source_ AND remote_id = genre_;
|
|
||||||
IF EXISTS (SELECT * FROM book_genres WHERE book = book_id AND genre = genre_id) THEN
|
|
||||||
RETURN;
|
|
||||||
END IF;
|
|
||||||
INSERT INTO book_genres (book, genre) VALUES (book_id, genre_id);
|
|
||||||
END;
|
END;
|
||||||
$$ LANGUAGE plpgsql;
|
$$ LANGUAGE plpgsql;
|
||||||
"
|
",
|
||||||
, &[]).await {
|
&[],
|
||||||
Ok(_) => Ok(()),
|
)
|
||||||
Err(err) => Err(Box::new(err)),
|
.await
|
||||||
|
{
|
||||||
|
Ok(_) => Ok(()),
|
||||||
|
Err(err) => Err(Box::new(err)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ async fn download_file(filename_str: &str) -> Result<(), Box<dyn std::error::Err
|
|||||||
|
|
||||||
let data = response
|
let data = response
|
||||||
.bytes_stream()
|
.bytes_stream()
|
||||||
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))
|
.map_err(std::io::Error::other)
|
||||||
.into_async_read();
|
.into_async_read();
|
||||||
|
|
||||||
let decoder = GzipDecoder::new(data);
|
let decoder = GzipDecoder::new(data);
|
||||||
|
|||||||
Reference in New Issue
Block a user