Skip to content

Commit a9249a9

Browse files
committed
Merge branch 'release/v0.2.1'
2 parents 86fa01a + d7d7f77 commit a9249a9

File tree

104 files changed

+7617
-1064
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+7617
-1064
lines changed

.travis.yml

+24-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
1+
dist: bionic
12
language: rust
23
rust:
3-
- stable
4-
- beta
5-
before_script:
6-
- rustup component add rustfmt
7-
- rustup component add clippy || cargo install --git https://github.com/rust-lang/rust-clippy/ --force clippy
4+
- stable
5+
- beta
6+
env:
7+
- THOTH_API=http://localhost:8000
8+
before_install:
9+
- sudo apt-get -y install pkg-config nodejs-dev node-gyp libssl1.0-dev npm
10+
- sudo npm install -g npm@6.14.8
11+
- sudo npm install -g n@6.7.0
12+
- sudo n 12.19.0
13+
- sudo npm install -g rollup@2.28.2
14+
addons:
15+
apt:
16+
update: true
17+
install:
18+
- cargo install wasm-pack
19+
- rustup component add rustfmt
20+
- rustup component add clippy || cargo install --git https://github.com/rust-lang/rust-clippy/ --force clippy
821
script:
9-
- cargo build --verbose
10-
- cargo test --workspace --verbose
11-
- cargo clippy --all --all-targets --all-features -- -D warnings
12-
- cargo fmt --all -- --check
22+
- wasm-pack build thoth-app/ --target web --release
23+
- rollup thoth-app/main.js --format iife --file thoth-app/pkg/thoth_app.js
24+
- cargo build --verbose
25+
- cargo test --workspace --verbose
26+
- cargo clippy --all --all-targets --all-features -- -D warnings
27+
- cargo fmt --all -- --check
1328
deploy:
1429
provider: cargo
1530
token:

CHANGELOG.md

+43-27
Original file line numberDiff line numberDiff line change
@@ -4,79 +4,95 @@ All notable changes to thoth will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7-
## [[0.1.10]](https://github.com/OpenBookPublishers/thoth/releases/tag/v0.1.10) - 2020-06-03
7+
## [[0.2.1]](https://github.com/thoth-pub/thoth/releases/tag/v0.2.1) - 2020-11-02
8+
### Changed
9+
- Redirect to relevant routes upon save and create actions in APP
10+
11+
### Added
12+
- Delete functionality in all APP objects
13+
14+
## [[0.2.0]](https://github.com/thoth-pub/thoth/releases/tag/v0.2.0) - 2020-10-23
15+
### Changed
16+
- [#38](https://github.com/thoth-pub/thoth/issues/38) - Split client and server
17+
- [#98](https://github.com/thoth-pub/thoth/issues/98) - Streamline Thoth logo
18+
19+
### Added
20+
- [#97](https://github.com/thoth-pub/thoth/issues/97), [#39](https://github.com/thoth-pub/thoth/issues/39), [#41](https://github.com/thoth-pub/thoth/issues/41) - Implement WASM frontend with Yew
21+
- [#40](https://github.com/thoth-pub/thoth/issues/40) - Implement API authentication
22+
23+
## [[0.1.10]](https://github.com/thoth-pub/thoth/releases/tag/v0.1.10) - 2020-06-03
824
### Changed
925
- Roadmap button in index catalogue
1026

11-
## [[0.1.9]](https://github.com/OpenBookPublishers/thoth/releases/tag/v0.1.9) - 2020-06-03
27+
## [[0.1.9]](https://github.com/thoth-pub/thoth/releases/tag/v0.1.9) - 2020-06-03
1228
### Added
1329
- Roadmap document
1430

15-
## [[0.1.8]](https://github.com/OpenBookPublishers/thoth/releases/tag/v0.1.8) - 2020-06-02
31+
## [[0.1.8]](https://github.com/thoth-pub/thoth/releases/tag/v0.1.8) - 2020-06-02
1632
### Changed
1733
- New design for the index catalogue
1834

19-
## [[0.1.7]](https://github.com/OpenBookPublishers/thoth/releases/tag/v0.1.7) - 2020-03-27
35+
## [[0.1.7]](https://github.com/thoth-pub/thoth/releases/tag/v0.1.7) - 2020-03-27
2036
### Changed
21-
- [#35](https://github.com/openbookpublishers/thoth/issues/35) - Fix date format and lack in ONIX sender header
37+
- [#35](https://github.com/thoth-pub/thoth/issues/35) - Fix date format and lack in ONIX sender header
2238
- Add place of publication to ONIX file
2339
- Use code 03 (description) instead of 30 (abstract) in OAPEN ONIX
2440

25-
## [[0.1.6]](https://github.com/OpenBookPublishers/thoth/releases/tag/v0.1.6) - 2020-03-26
41+
## [[0.1.6]](https://github.com/thoth-pub/thoth/releases/tag/v0.1.6) - 2020-03-26
2642
### Changed
2743
- Fix incompatibilities with OAPEN ONIX parser
2844
- Map ONIX parameter to UUID directly, instead of converting afterwards
2945
- Normalise server route definitions
3046

31-
## [[0.1.5]](https://github.com/OpenBookPublishers/thoth/releases/tag/v0.1.5) - 2020-03-25
47+
## [[0.1.5]](https://github.com/thoth-pub/thoth/releases/tag/v0.1.5) - 2020-03-25
3248
### Changed
3349
- Load assets statically
3450

35-
## [[0.1.4]](https://github.com/OpenBookPublishers/thoth/releases/tag/v0.1.4) - 2020-03-24
51+
## [[0.1.4]](https://github.com/thoth-pub/thoth/releases/tag/v0.1.4) - 2020-03-24
3652
### Changed
3753
- "/" now renders its own page, instead of redirecting to "/graphiql"
38-
- [#27](https://github.com/openbookpublishers/thoth/issues/27) - Produce an OAPEN compatible ONIX file
54+
- [#27](https://github.com/thoth-pub/thoth/issues/27) - Produce an OAPEN compatible ONIX file
3955

4056
### Added
41-
- [#26](https://github.com/openbookpublishers/thoth/issues/26) - Create an endpoint to allow generating ONIX streams from "/onix/{workId}"
57+
- [#26](https://github.com/thoth-pub/thoth/issues/26) - Create an endpoint to allow generating ONIX streams from "/onix/{workId}"
4258

4359
### Removed
4460
- Dropped support for creating ONIX from binary
4561

46-
## [[0.1.3]](https://github.com/OpenBookPublishers/thoth/releases/tag/v0.1.3) - 2020-03-16
62+
## [[0.1.3]](https://github.com/thoth-pub/thoth/releases/tag/v0.1.3) - 2020-03-16
4763
### Changed
4864
- Pin compiler's docker image to a specific version (best practice)
4965
- Use COPY instead of ADD for directories in Dockerfile (best practice)
50-
- [#24](https://github.com/openbookpublishers/thoth/issues/24) - Implemented rust style guidelines
66+
- [#24](https://github.com/thoth-pub/thoth/issues/24) - Implemented rust style guidelines
5167

5268
### Added
53-
- [#23](https://github.com/openbookpublishers/thoth/issues/23) - Redirect "/" to "/graphiql"
54-
- [#18](https://github.com/openbookpublishers/thoth/issues/18) - Create ThothError structure to start catching all other types of errors
55-
- [#24](https://github.com/openbookpublishers/thoth/issues/24) - Enforce rust style guidelines using husky (pre-push hook) and travis
56-
- [#17](https://github.com/openbookpublishers/thoth/issues/17) - Allow producing a proto ONIX file from the binary
69+
- [#23](https://github.com/thoth-pub/thoth/issues/23) - Redirect "/" to "/graphiql"
70+
- [#18](https://github.com/thoth-pub/thoth/issues/18) - Create ThothError structure to start catching all other types of errors
71+
- [#24](https://github.com/thoth-pub/thoth/issues/24) - Enforce rust style guidelines using husky (pre-push hook) and travis
72+
- [#17](https://github.com/thoth-pub/thoth/issues/17) - Allow producing a proto ONIX file from the binary
5773

58-
## [[0.1.2]](https://github.com/OpenBookPublishers/thoth/releases/tag/v0.1.2) - 2020-03-03
74+
## [[0.1.2]](https://github.com/thoth-pub/thoth/releases/tag/v0.1.2) - 2020-03-03
5975
### Changed
60-
- [#10](https://github.com/openbookpublishers/thoth/issues/10) - Port exposing is handled in Dockerfile instead of docker-compose
61-
- [#16](https://github.com/openbookpublishers/thoth/issues/16) - Moved server start function from binary to library
62-
- [#9](https://github.com/openbookpublishers/thoth/issues/9) - Docker image is now compiled statically
76+
- [#10](https://github.com/thoth-pub/thoth/issues/10) - Port exposing is handled in Dockerfile instead of docker-compose
77+
- [#16](https://github.com/thoth-pub/thoth/issues/16) - Moved server start function from binary to library
78+
- [#9](https://github.com/thoth-pub/thoth/issues/9) - Docker image is now compiled statically
6379

6480
### Added
65-
- [#13](https://github.com/openbookpublishers/thoth/issues/13) - Added limit and offset arguments to all queries
66-
- [#13](https://github.com/openbookpublishers/thoth/issues/13) - Added default order by clauses to all queries
67-
- [#15](https://github.com/openbookpublishers/thoth/issues/15) - Implemented GraphQL errors for diesel errors
68-
- [#13](https://github.com/openbookpublishers/thoth/issues/13) - Added filter arguments for publishers and works queries
81+
- [#13](https://github.com/thoth-pub/thoth/issues/13) - Added limit and offset arguments to all queries
82+
- [#13](https://github.com/thoth-pub/thoth/issues/13) - Added default order by clauses to all queries
83+
- [#15](https://github.com/thoth-pub/thoth/issues/15) - Implemented GraphQL errors for diesel errors
84+
- [#13](https://github.com/thoth-pub/thoth/issues/13) - Added filter arguments for publishers and works queries
6985

70-
## [[0.1.1]](https://github.com/OpenBookPublishers/thoth/releases/tag/v0.1.1) - 2020-02-27
86+
## [[0.1.1]](https://github.com/thoth-pub/thoth/releases/tag/v0.1.1) - 2020-02-27
7187
### Changed
7288
- Improved Dockerfile to allow running database migrations at run time
7389

7490
### Added
7591
- Implemented imprints for publisher graphql object
76-
- [#6](https://github.com/openbookpublishers/thoth/issues/6) - Added subcommands to main binary to allow running embedded migrations without having to install diesel\_cli
92+
- [#6](https://github.com/thoth-pub/thoth/issues/6) - Added subcommands to main binary to allow running embedded migrations without having to install diesel\_cli
7793
- Automatic publication to crates.io
7894

79-
## [[0.1.0]](https://github.com/OpenBookPublishers/thoth/releases/tag/v0.1.0) - 2020-02-21
95+
## [[0.1.0]](https://github.com/thoth-pub/thoth/releases/tag/v0.1.0) - 2020-02-21
8096
### Added
8197
- Database migrations
8298
- GraphQL handlers implementing the thoth schema

Cargo.lock

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

Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thoth"
3-
version = "0.2.0"
3+
version = "0.2.1"
44
authors = ["Javier Arias <javi@openbookpublishers.com>"]
55
edition = "2018"
66
license = "Apache-2.0"
@@ -16,8 +16,8 @@ maintenance = { status = "actively-developed" }
1616
members = ["thoth-api", "thoth-app", "thoth-client"]
1717

1818
[dependencies]
19-
thoth-api = {version = "*", path = "thoth-api", features = ["backend"] }
20-
thoth-client = {version = "*", path = "thoth-client" }
19+
thoth-api = {version = "0.2.1", path = "thoth-api", features = ["backend"] }
20+
thoth-client = {version = "0.2.1", path = "thoth-client" }
2121
actix-http = "1.0.1"
2222
actix-rt = "1.0.0"
2323
actix-web = "3.0.0"

Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ ARG THOTH_API
44
FROM ${BASE_IMAGE} as build
55

66
# Install build dependencies
7-
RUN sudo apt-get install -y
87
RUN sudo apt-get update && sudo apt-get -y install pkg-config npm
98
RUN sudo npm install -g npm@6.14.8
109
RUN sudo npm install -g n@6.7.0

thoth-api/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thoth-api"
3-
version = "0.2.0"
3+
version = "0.2.1"
44
authors = ["Javier Arias <javi@openbookpublishers.com>"]
55
edition = "2018"
66
license = "Apache-2.0"

thoth-api/migrations/0.1.0/up.sql

+13-13
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ CREATE UNIQUE INDEX publisher_uniq_idx ON publisher(lower(publisher_name));
1212

1313
CREATE TABLE imprint (
1414
imprint_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
15-
publisher_id UUID NOT NULL REFERENCES publisher(publisher_id),
15+
publisher_id UUID NOT NULL REFERENCES publisher(publisher_id) ON DELETE CASCADE,
1616
imprint_name TEXT NOT NULL CHECK (octet_length(imprint_name) >= 1),
1717
imprint_url TEXT CHECK (imprint_url ~* '^[^:]*:\/\/(?:[^\/:]*:[^\/@]*@)?(?:[^\/:.]*\.)+([^:\/]+)')
1818
);
@@ -56,7 +56,7 @@ CREATE TABLE work (
5656
subtitle TEXT CHECK (octet_length(subtitle) >= 1),
5757
reference TEXT CHECK (octet_length(reference) >= 1),
5858
edition INTEGER NOT NULL CHECK (edition > 0),
59-
imprint_id UUID NOT NULL REFERENCES imprint(imprint_id),
59+
imprint_id UUID NOT NULL REFERENCES imprint(imprint_id) ON DELETE CASCADE,
6060
doi TEXT CHECK (doi ~* 'https:\/\/doi.org\/10.\d{4,9}\/[-._\;\(\)\/:a-zA-Z0-9]+$'),
6161
publication_date DATE,
6262
place TEXT CHECK (octet_length(reference) >= 1),
@@ -583,7 +583,7 @@ CREATE TYPE language_code AS ENUM (
583583

584584
CREATE TABLE language (
585585
language_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
586-
work_id UUID NOT NULL REFERENCES work(work_id),
586+
work_id UUID NOT NULL REFERENCES work(work_id) ON DELETE CASCADE,
587587
language_code language_code NOT NULL,
588588
language_relation language_relation NOT NULL,
589589
main_language BOOLEAN NOT NULL DEFAULT False
@@ -606,16 +606,16 @@ CREATE TABLE series (
606606
issn_print TEXT NOT NULL CHECK (issn_print ~* '\d{4}\-\d{3}(\d|X)'),
607607
issn_digital TEXT NOT NULL CHECK (issn_digital ~* '\d{4}\-\d{3}(\d|X)'),
608608
series_url TEXT CHECK (series_url ~* '^[^:]*:\/\/(?:[^\/:]*:[^\/@]*@)?(?:[^\/:.]*\.)+([^:\/]+)'),
609-
imprint_id UUID NOT NULL REFERENCES imprint(imprint_id)
609+
imprint_id UUID NOT NULL REFERENCES imprint(imprint_id) ON DELETE CASCADE
610610
);
611611

612612
-- UNIQ index on ISSNs
613613
CREATE UNIQUE INDEX series_issn_print_idx ON series(issn_print);
614614
CREATE UNIQUE INDEX series_issn_digital_idx ON series(issn_digital);
615615

616616
CREATE TABLE issue (
617-
series_id UUID NOT NULL REFERENCES series(series_id),
618-
work_id UUID NOT NULL REFERENCES work(work_id),
617+
series_id UUID NOT NULL REFERENCES series(series_id) ON DELETE CASCADE,
618+
work_id UUID NOT NULL REFERENCES work(work_id) ON DELETE CASCADE,
619619
issue_ordinal INTEGER NOT NULL CHECK (issue_ordinal > 0),
620620
PRIMARY KEY (series_id, work_id)
621621
);
@@ -650,8 +650,8 @@ CREATE TYPE contribution_type AS ENUM (
650650
);
651651

652652
CREATE TABLE contribution (
653-
work_id UUID NOT NULL REFERENCES work(work_id),
654-
contributor_id UUID NOT NULL REFERENCES contributor(contributor_id),
653+
work_id UUID NOT NULL REFERENCES work(work_id) ON DELETE CASCADE,
654+
contributor_id UUID NOT NULL REFERENCES contributor(contributor_id) ON DELETE CASCADE,
655655
contribution_type contribution_type NOT NULL,
656656
main_contribution BOOLEAN NOT NULL DEFAULT False,
657657
biography TEXT CHECK (octet_length(biography) >= 1),
@@ -674,7 +674,7 @@ CREATE TYPE publication_type AS ENUM (
674674
CREATE TABLE publication (
675675
publication_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
676676
publication_type publication_type NOT NULL,
677-
work_id UUID NOT NULL REFERENCES work(work_id),
677+
work_id UUID NOT NULL REFERENCES work(work_id) ON DELETE CASCADE,
678678
isbn TEXT CHECK (octet_length(isbn) = 17),
679679
publication_url TEXT CHECK (publication_url ~* '^[^:]*:\/\/(?:[^\/:]*:[^\/@]*@)?(?:[^\/:.]*\.)+([^:\/]+)')
680680
);
@@ -991,7 +991,7 @@ CREATE TYPE currency_code AS ENUM (
991991

992992
CREATE TABLE price (
993993
price_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
994-
publication_id UUID NOT NULL REFERENCES publication(publication_id),
994+
publication_id UUID NOT NULL REFERENCES publication(publication_id) ON DELETE CASCADE,
995995
currency_code currency_code NOT NULL,
996996
unit_price double precision NOT NULL
997997
);
@@ -1009,7 +1009,7 @@ CREATE TYPE subject_type AS ENUM (
10091009

10101010
CREATE TABLE subject (
10111011
subject_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
1012-
work_id UUID NOT NULL REFERENCES work(work_id),
1012+
work_id UUID NOT NULL REFERENCES work(work_id) ON DELETE CASCADE,
10131013
subject_type subject_type NOT NULL,
10141014
subject_code TEXT NOT NULL CHECK (octet_length(subject_code) >= 1),
10151015
subject_ordinal INTEGER NOT NULL CHECK (subject_ordinal > 0)
@@ -1027,8 +1027,8 @@ CREATE UNIQUE INDEX funder_doi_uniq_idx ON funder(lower(funder_doi));
10271027

10281028
CREATE TABLE funding (
10291029
funding_id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
1030-
work_id UUID NOT NULL REFERENCES work(work_id),
1031-
funder_id UUID NOT NULL REFERENCES funder(funder_id),
1030+
work_id UUID NOT NULL REFERENCES work(work_id) ON DELETE CASCADE,
1031+
funder_id UUID NOT NULL REFERENCES funder(funder_id) ON DELETE CASCADE,
10321032
program TEXT CHECK (octet_length(program) >= 1),
10331033
project_name TEXT CHECK (octet_length(project_name) >= 1),
10341034
project_shortname TEXT CHECK (octet_length(project_shortname) >= 1),

thoth-api/src/contribution/model.rs

+20-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ pub struct Contribution {
3939
pub institution: Option<String>,
4040
}
4141

42-
#[cfg_attr(feature = "backend", derive(juniper::GraphQLInputObject, Insertable))]
43-
#[cfg_attr(feature = "backend", table_name = "contribution")]
42+
#[cfg_attr(
43+
feature = "backend",
44+
derive(juniper::GraphQLInputObject, Insertable),
45+
table_name = "contribution"
46+
)]
4447
pub struct NewContribution {
4548
pub work_id: Uuid,
4649
pub contributor_id: Uuid,
@@ -50,6 +53,21 @@ pub struct NewContribution {
5053
pub institution: Option<String>,
5154
}
5255

56+
#[cfg_attr(
57+
feature = "backend",
58+
derive(juniper::GraphQLInputObject, AsChangeset),
59+
changeset_options(treat_none_as_null = "true"),
60+
table_name = "contribution"
61+
)]
62+
pub struct PatchContribution {
63+
pub work_id: Uuid,
64+
pub contributor_id: Uuid,
65+
pub contribution_type: ContributionType,
66+
pub main_contribution: bool,
67+
pub biography: Option<String>,
68+
pub institution: Option<String>,
69+
}
70+
5371
impl Default for ContributionType {
5472
fn default() -> ContributionType {
5573
ContributionType::Author

0 commit comments

Comments
 (0)