Skip to content

Commit 6532713

Browse files
committed
Merge branch 'release/v0.11.16'
2 parents f9cb0f6 + 0e1ff95 commit 6532713

File tree

25 files changed

+170
-22522
lines changed

25 files changed

+170
-22522
lines changed

.github/workflows/check_changelog.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: check-changelog
2+
on:
3+
pull_request:
4+
5+
jobs:
6+
check-changelog:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: tarides/changelog-check-action@v2
10+
with:
11+
changelog: CHANGELOG.md

.github/workflows/run_migrations.yml

+5
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,8 @@ jobs:
6666
with:
6767
command: run
6868
args: migrate
69+
- name: Revert migrations
70+
uses: actions-rs/cargo@v1
71+
with:
72+
command: run
73+
args: migrate --revert

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [[0.11.16]](https://github.com/thoth-pub/thoth/releases/tag/v0.11.16) - 2024-02-19
10+
### Changed
11+
- [561](https://github.com/thoth-pub/thoth/issues/561) - Add "Publisher Website" as a location platform
12+
- [553](https://github.com/thoth-pub/thoth/pull/553) - Upgrade rust to `1.76.0` in production and development `Dockerfile`
13+
- [305](https://github.com/thoth-pub/thoth/issues/305) - Update rust edition to 2021
14+
- [555](https://github.com/thoth-pub/thoth/pull/555) - Remove thoth-client's schema.json with auto-generated GraphQL schema language file on compilation
15+
16+
### Added
17+
- [244](https://github.com/thoth-pub/thoth/issues/244) - Expose GraphQL schema file in /schema.graphql
18+
- [503](https://github.com/thoth-pub/thoth/issues/503) - Allow reverting migrations in the CLI and check that migrations can be reverted in run-migration github action
19+
- [557](https://github.com/thoth-pub/thoth/pull/557) - Added github action to chech that the changelog has been updated on PRs
20+
921
## [[0.11.15]](https://github.com/thoth-pub/thoth/releases/tag/v0.11.15) - 2024-01-18
1022
### Changed
1123
- [536](https://github.com/thoth-pub/thoth/issues/536) - Rename "SciELO" location platform to "SciELO Books"

Cargo.lock

+8-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "thoth"
3-
version = "0.11.15"
3+
version = "0.11.16"
44
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
5-
edition = "2018"
5+
edition = "2021"
66
license = "Apache-2.0"
77
description = "GraphQL API for bibliographic data"
88
repository = "https://github.com/thoth-pub/thoth"
@@ -16,11 +16,11 @@ maintenance = { status = "actively-developed" }
1616
members = ["thoth-api", "thoth-api-server", "thoth-app", "thoth-app-server", "thoth-client", "thoth-errors", "thoth-export-server"]
1717

1818
[dependencies]
19-
thoth-api = { version = "0.11.15", path = "thoth-api", features = ["backend"] }
20-
thoth-api-server = { version = "0.11.15", path = "thoth-api-server" }
21-
thoth-app-server = { version = "0.11.15", path = "thoth-app-server" }
22-
thoth-errors = { version = "0.11.15", path = "thoth-errors" }
23-
thoth-export-server = { version = "0.11.15", path = "thoth-export-server" }
19+
thoth-api = { version = "0.11.16", path = "thoth-api", features = ["backend"] }
20+
thoth-api-server = { version = "0.11.16", path = "thoth-api-server" }
21+
thoth-app-server = { version = "0.11.16", path = "thoth-app-server" }
22+
thoth-errors = { version = "0.11.16", path = "thoth-errors" }
23+
thoth-export-server = { version = "0.11.16", path = "thoth-export-server" }
2424
clap = { version = "4.4.7", features = ["cargo", "env"] }
2525
dialoguer = { version = "0.11.0", features = ["password"] }
2626
dotenv = "0.15.0"

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
ARG RUST_IMAGE=rust:1.75.0
2-
ARG MUSL_IMAGE=clux/muslrust:1.75.0
1+
ARG RUST_IMAGE=rust:1.76.0
2+
ARG MUSL_IMAGE=clux/muslrust:1.76.0
33

44
FROM ${RUST_IMAGE} as wasm
55

Dockerfile.dev

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG RUST_VERSION=1.75.0
1+
ARG RUST_VERSION=1.76.0
22

33
FROM rust:${RUST_VERSION}
44

@@ -48,6 +48,7 @@ RUN mkdir thoth-api/src thoth-api-server/src thoth-app/src \
4848
RUN touch thoth-api/src/lib.rs thoth-api-server/src/lib.rs \
4949
thoth-app/src/lib.rs thoth-app-server/src/lib.rs thoth-client/src/lib.rs \
5050
thoth-errors/src/lib.rs thoth-export-server/src/lib.rs
51+
RUN echo "fn main() {}" > thoth-client/build.rs
5152
RUN wasm-pack build thoth-app/ \
5253
--target web \
5354
--debug

src/bin/thoth.rs

+16-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
use clap::{crate_authors, crate_version, value_parser, Arg, Command};
1+
use clap::{crate_authors, crate_version, value_parser, Arg, ArgAction, Command};
22
use dialoguer::{console::Term, theme::ColorfulTheme, Input, MultiSelect, Password, Select};
33
use dotenv::dotenv;
44
use std::env;
55
use thoth::api::account::model::{AccountData, LinkedPublisher};
66
use thoth::api::account::service::{all_emails, all_publishers, register, update_password};
7-
use thoth::api::db::{establish_connection, run_migrations};
7+
use thoth::api::db::{establish_connection, revert_migrations, run_migrations};
88
use thoth::api_server;
99
use thoth::app_server;
1010
use thoth::export_server;
@@ -129,7 +129,16 @@ fn thoth_commands() -> Command {
129129
.about(env!("CARGO_PKG_DESCRIPTION"))
130130
.subcommand_required(true)
131131
.arg_required_else_help(true)
132-
.subcommand(Command::new("migrate").about("Run the database migrations"))
132+
.subcommand(
133+
Command::new("migrate")
134+
.about("Run the database migrations")
135+
.arg(
136+
Arg::new("revert")
137+
.long("revert")
138+
.help("Revert all database migrations")
139+
.action(ArgAction::SetTrue),
140+
),
141+
)
133142
.subcommand(
134143
Command::new("start")
135144
.about("Start an instance of Thoth API or GUI")
@@ -240,7 +249,10 @@ fn main() -> ThothResult<()> {
240249
}
241250
_ => unreachable!(),
242251
},
243-
Some(("migrate", _)) => run_migrations(),
252+
Some(("migrate", migrate_matches)) => match migrate_matches.get_flag("revert") {
253+
true => revert_migrations(),
254+
false => run_migrations(),
255+
},
244256
Some(("init", init_matches)) => {
245257
let host = init_matches.get_one::<String>("host").unwrap().to_owned();
246258
let port = init_matches.get_one::<String>("port").unwrap().to_owned();

thoth-api-server/Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
[package]
22
name = "thoth-api-server"
3-
version = "0.11.15"
3+
version = "0.11.16"
44
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
5-
edition = "2018"
5+
edition = "2021"
66
license = "Apache-2.0"
77
description = "Actix instance serving Thoth's GraphQL endpoints"
88
repository = "https://github.com/thoth-pub/thoth"
99
readme = "README.md"
1010

1111
[dependencies]
12-
thoth-api = { version = "0.11.15", path = "../thoth-api", features = ["backend"] }
13-
thoth-errors = { version = "0.11.15", path = "../thoth-errors" }
12+
thoth-api = { version = "0.11.16", path = "../thoth-api", features = ["backend"] }
13+
thoth-errors = { version = "0.11.16", path = "../thoth-errors" }
1414
actix-web = "4.4.1"
1515
actix-cors = "0.7.0"
1616
actix-identity = "0.6.0"

thoth-api-server/src/lib.rs

+6
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ async fn graphql_index(config: Data<ApiConfig>) -> HttpResponse {
8484
))
8585
}
8686

87+
#[get("/schema.graphql")]
88+
async fn graphql_schema(st: Data<Arc<Schema>>) -> HttpResponse {
89+
HttpResponse::Ok().body(st.as_schema_language())
90+
}
91+
8792
#[post("/graphql")]
8893
async fn graphql(
8994
st: Data<Arc<Schema>>,
@@ -192,6 +197,7 @@ fn config(cfg: &mut ServiceConfig) {
192197
cfg.service(login_credentials);
193198
cfg.service(login_session);
194199
cfg.service(account_details);
200+
cfg.service(graphql_schema);
195201
}
196202

197203
#[allow(clippy::too_many_arguments)]

thoth-api/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "thoth-api"
3-
version = "0.11.15"
3+
version = "0.11.16"
44
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
5-
edition = "2018"
5+
edition = "2021"
66
license = "Apache-2.0"
77
description = "GraphQL API for bibliographic data"
88
repository = "https://github.com/thoth-pub/thoth"
@@ -16,7 +16,7 @@ maintenance = { status = "actively-developed" }
1616
backend = ["diesel", "diesel-derive-enum", "diesel_migrations", "futures", "actix-web"]
1717

1818
[dependencies]
19-
thoth-errors = { version = "0.11.15", path = "../thoth-errors" }
19+
thoth-errors = { version = "0.11.16", path = "../thoth-errors" }
2020
actix-web = { version = "4.4.1", optional = true }
2121
argon2rs = "0.2.5"
2222
isbn2 = "0.4.0"
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
UPDATE location SET location_platform = 'Other' WHERE location_platform IN (
2+
'Publisher Website'
3+
);
4+
5+
-- Drop the default and unique constraint, otherwise it won't be able to cast to text
6+
ALTER TABLE location ALTER COLUMN location_platform DROP DEFAULT;
7+
DROP INDEX location_uniq_platform_idx;
8+
9+
ALTER TABLE location ALTER COLUMN location_platform TYPE text;
10+
DROP TYPE location_platform;
11+
CREATE TYPE location_platform AS ENUM (
12+
'Project MUSE',
13+
'OAPEN',
14+
'DOAB',
15+
'JSTOR',
16+
'EBSCO Host',
17+
'OCLC KB',
18+
'ProQuest KB',
19+
'ProQuest ExLibris',
20+
'EBSCO KB',
21+
'JISC KB',
22+
'Google Books',
23+
'Internet Archive',
24+
'ScienceOpen',
25+
'SciELO Books',
26+
'Other'
27+
);
28+
ALTER TABLE location ALTER location_platform TYPE location_platform USING location_platform::location_platform;
29+
ALTER TABLE location
30+
ALTER COLUMN location_platform SET DEFAULT 'Other'::location_platform;
31+
32+
CREATE UNIQUE INDEX location_uniq_platform_idx
33+
ON location (publication_id, location_platform)
34+
WHERE NOT location_platform = 'Other'::location_platform;

thoth-api/migrations/v0.11.16/up.sql

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TYPE location_platform ADD VALUE 'Publisher Website';

thoth-api/src/db.rs

+8
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,11 @@ pub fn run_migrations() -> ThothResult<()> {
3939
Err(error) => Err(ThothError::DatabaseError(error.to_string())),
4040
}
4141
}
42+
43+
pub fn revert_migrations() -> ThothResult<()> {
44+
let mut connection = establish_connection().get().unwrap();
45+
match connection.revert_all_migrations(MIGRATIONS) {
46+
Ok(_) => Ok(()),
47+
Err(error) => Err(ThothError::DatabaseError(error.to_string())),
48+
}
49+
}

thoth-api/src/model/location/mod.rs

+11
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ pub enum LocationPlatform {
6060
#[cfg_attr(feature = "backend", db_rename = "SciELO Books")]
6161
#[strum(serialize = "SciELO Books")]
6262
ScieloBooks,
63+
#[cfg_attr(feature = "backend", db_rename = "Publisher Website")]
64+
#[strum(serialize = "Publisher Website")]
65+
PublisherWebsite,
6366
#[cfg_attr(feature = "backend", db_rename = "Other")]
6467
#[default]
6568
Other,
@@ -180,6 +183,10 @@ fn test_locationplatform_display() {
180183
);
181184
assert_eq!(format!("{}", LocationPlatform::ScienceOpen), "ScienceOpen");
182185
assert_eq!(format!("{}", LocationPlatform::ScieloBooks), "SciELO Books");
186+
assert_eq!(
187+
format!("{}", LocationPlatform::PublisherWebsite),
188+
"Publisher Website"
189+
);
183190
assert_eq!(format!("{}", LocationPlatform::Other), "Other");
184191
}
185192

@@ -242,6 +249,10 @@ fn test_locationplatform_fromstr() {
242249
LocationPlatform::from_str("SciELO Books").unwrap(),
243250
LocationPlatform::ScieloBooks
244251
);
252+
assert_eq!(
253+
LocationPlatform::from_str("Publisher Website").unwrap(),
254+
LocationPlatform::PublisherWebsite
255+
);
245256
assert_eq!(
246257
LocationPlatform::from_str("Other").unwrap(),
247258
LocationPlatform::Other

thoth-app-server/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "thoth-app-server"
3-
version = "0.11.15"
3+
version = "0.11.16"
44
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
5-
edition = "2018"
5+
edition = "2021"
66
license = "Apache-2.0"
77
description = "Actix instance serving Thoth's WASM GUI statically"
88
repository = "https://github.com/thoth-pub/thoth"

thoth-app/Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "thoth-app"
3-
version = "0.11.15"
3+
version = "0.11.16"
44
authors = ["Javier Arias <javi@openbookpublishers.com>", "Ross Higman <ross@openbookpublishers.com>"]
5-
edition = "2018"
5+
edition = "2021"
66
license = "Apache-2.0"
77
description = "WASM APP for bibliographic data"
88
repository = "https://github.com/thoth-pub/thoth"
@@ -41,5 +41,5 @@ uuid = { version = "0.8.2", features = ["serde", "v4"] }
4141
# `getrandom` is a dependency of `uuid`, we need to explicitly import and include the `js` feature to enable wasm
4242
# https://docs.rs/getrandom/latest/getrandom/#webassembly-support
4343
getrandom = { version = "0.2", features = ["js"] }
44-
thoth-api = { version = "0.11.15", path = "../thoth-api" }
45-
thoth-errors = { version = "0.11.15", path = "../thoth-errors" }
44+
thoth-api = { version = "0.11.16", path = "../thoth-api" }
45+
thoth-errors = { version = "0.11.16", path = "../thoth-errors" }

thoth-app/manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"start_url": "/?homescreen=1",
1010
"background_color": "#ffffff",
1111
"theme_color": "#ffdd57",
12-
"version": "0.11.15",
12+
"version": "0.11.16",
1313
"icons": [
1414
{
1515
"src": "\/android-icon-36x36.png",

thoth-client/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
assets/schema.graphql

0 commit comments

Comments
 (0)