Skip to content

Commit

Permalink
Merge branch 'release/v0.7.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
ja573 committed Feb 8, 2022
2 parents 03d6eeb + e03323c commit 06c1bad
Show file tree
Hide file tree
Showing 35 changed files with 1,139 additions and 43 deletions.
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Question
about: Ask a question about Thoth
title: ''
labels: question
assignees: ''

---

**My question relates to**
Please mark with an "x":
- [ ] Thoth APP (graphical interface)
- [ ] Thoth GraphQL API
- [ ] Thoth Export API
- [ ] Something else


**My question is**
Write your question here
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [[0.7.2]](https://github.com/thoth-pub/thoth/releases/tag/v0.7.2) - 2022-02-08
### Changed
- [#339](https://github.com/thoth-pub/thoth/pull/339) - Update publication types to include AZW3, DOCX and FictionBook
- [#331](https://github.com/thoth-pub/thoth/pull/331) - Update series model to include description and CFP URL
- Allow triggering docker action manually

### Added
- Add code of conduct and support document to repository

## [[0.7.1]](https://github.com/thoth-pub/thoth/releases/tag/v0.7.1) - 2022-01-24
### Changed
- Removed redundant `to_string` calls to comply with [`rustc 1.58.0`](https://github.com/rust-lang/rust/releases/tag/1.58.0)
Expand Down
776 changes: 776 additions & 0 deletions CODE_OF_CONDUCT.md

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "thoth"
version = "0.7.1"
version = "0.7.2"
authors = ["Javier Arias <[email protected]>", "Ross Higman <[email protected]>"]
edition = "2018"
license = "Apache-2.0"
Expand All @@ -16,11 +16,11 @@ maintenance = { status = "actively-developed" }
members = ["thoth-api", "thoth-api-server", "thoth-app", "thoth-app-server", "thoth-client", "thoth-errors", "thoth-export-server"]

[dependencies]
thoth-api = { version = "0.7.1", path = "thoth-api", features = ["backend"] }
thoth-api-server = { version = "0.7.1", path = "thoth-api-server" }
thoth-app-server = { version = "0.7.1", path = "thoth-app-server" }
thoth-errors = { version = "0.7.1", path = "thoth-errors" }
thoth-export-server = { version = "0.7.1", path = "thoth-export-server" }
thoth-api = { version = "0.7.2", path = "thoth-api", features = ["backend"] }
thoth-api-server = { version = "0.7.2", path = "thoth-api-server" }
thoth-app-server = { version = "0.7.2", path = "thoth-app-server" }
thoth-errors = { version = "0.7.2", path = "thoth-errors" }
thoth-export-server = { version = "0.7.2", path = "thoth-export-server" }
clap = "2.33.3"
dialoguer = "0.7.1"
dotenv = "0.9.0"
Expand Down
28 changes: 28 additions & 0 deletions SUPPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Support

## Thoth wiki
The Thoth team actively contributes to its [Wiki](../../wiki), if you have a question about book metadata we might have an entry about it.

Our wiki also includes the [Thoth User Manual](../../wiki/Thoth-User-Manual).

## Asking quality questions
> This section has been borrowed from Titus Wormer's [remarkjs support document](https://github.com/remarkjs/.github/blob/main/support.md)
Questions can go to [GitHub discussions](https://github.com/thoth-pub/thoth/discussions).

Help us help you!
Spend time framing questions and add links and resources.
Spending the extra time up front can help save everyone time in the long run.
Here are some tips:

* [Talk to a duck](https://rubberduckdebugging.com)!
* Don’t fall for the [XY problem](https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem/66378#66378)
* Search to find out if a similar question has been asked
* Try to define what you need help with:
* Is there something in particular you want to do?
* What problem are you encountering and what steps have you taken to try
and fix it?
* Is there a concept you don’t understand?
* Screenshots can help, but if there’s important text such as code or error
messages in them, please also provide those as text
* The more time you put into asking your question, the better we can help you
6 changes: 3 additions & 3 deletions thoth-api-server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "thoth-api-server"
version = "0.7.1"
version = "0.7.2"
authors = ["Javier Arias <[email protected]>", "Ross Higman <[email protected]>"]
edition = "2018"
license = "Apache-2.0"
Expand All @@ -9,8 +9,8 @@ repository = "https://github.com/thoth-pub/thoth"
readme = "README.md"

[dependencies]
thoth-api = { version = "0.7.1", path = "../thoth-api", features = ["backend"] }
thoth-errors = { version = "0.7.1", path = "../thoth-errors" }
thoth-api = { version = "0.7.2", path = "../thoth-api", features = ["backend"] }
thoth-errors = { version = "0.7.2", path = "../thoth-errors" }
actix-web = "3.3.2"
actix-cors = "0.5.4"
actix-identity = "0.3.1"
Expand Down
4 changes: 2 additions & 2 deletions thoth-api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "thoth-api"
version = "0.7.1"
version = "0.7.2"
authors = ["Javier Arias <[email protected]>", "Ross Higman <[email protected]>"]
edition = "2018"
license = "Apache-2.0"
Expand All @@ -16,7 +16,7 @@ maintenance = { status = "actively-developed" }
backend = ["diesel", "diesel-derive-enum", "diesel_migrations", "futures", "actix-web"]

[dependencies]
thoth-errors = { version = "0.7.1", path = "../thoth-errors" }
thoth-errors = { version = "0.7.2", path = "../thoth-errors" }
actix-web = { version = "3.3.2", optional = true }
argon2rs = "0.2.5"
isbn2 = "0.4.0"
Expand Down
20 changes: 20 additions & 0 deletions thoth-api/migrations/0.7.2/down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
ALTER TABLE series
DROP COLUMN series_description,
DROP COLUMN series_cfp_url;

-- We cannot drop individual enum values - we must drop the type and recreate it
--
-- Delete publications with about-to-be-dropped types
DELETE FROM publication WHERE publication_type IN ('AZW3', 'DOCX', 'FictionBook');
ALTER TABLE publication ALTER publication_type TYPE text;
DROP TYPE publication_type;
CREATE TYPE publication_type AS ENUM (
'Paperback',
'Hardback',
'PDF',
'HTML',
'XML',
'Epub',
'Mobi'
);
ALTER TABLE publication ALTER publication_type TYPE publication_type USING publication_type::publication_type;
9 changes: 9 additions & 0 deletions thoth-api/migrations/0.7.2/up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ALTER TABLE series
-- Description of the series
ADD COLUMN series_description TEXT CHECK (octet_length(series_description) >= 1),
-- Call for proposals URL
ADD COLUMN series_cfp_url TEXT CHECK (series_cfp_url ~* '^[^:]*:\/\/(?:[^\/:]*:[^\/@]*@)?(?:[^\/:.]*\.)+([^:\/]+)');

ALTER TYPE publication_type ADD VALUE IF NOT EXISTS 'AZW3';
ALTER TYPE publication_type ADD VALUE IF NOT EXISTS 'DOCX';
ALTER TYPE publication_type ADD VALUE IF NOT EXISTS 'FictionBook';
14 changes: 12 additions & 2 deletions thoth-api/src/graphql/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ impl QueryRoot {
offset(default = 0, description = "The number of items to skip"),
filter(
default = "".to_string(),
description = "A query string to search. This argument is a test, do not rely on it. At present it simply searches for case insensitive literals on series_name, issn_print, issn_digital and series_url"
description = "A query string to search. This argument is a test, do not rely on it. At present it simply searches for case insensitive literals on series_name, issn_print, issn_digital, series_url and series_description"
),
order(
default = SeriesOrderBy::default(),
Expand Down Expand Up @@ -794,7 +794,7 @@ impl QueryRoot {
arguments(
filter(
default = "".to_string(),
description = "A query string to search. This argument is a test, do not rely on it. At present it simply searches for case insensitive literals on series_name, issn_print, issn_digital and series_url",
description = "A query string to search. This argument is a test, do not rely on it. At present it simply searches for case insensitive literals on series_name, issn_print, issn_digital, series_url and series_description",
),
publishers(
default = vec![],
Expand Down Expand Up @@ -2921,10 +2921,20 @@ impl Series {
&self.issn_digital
}

#[graphql(description = "URL of the series' landing page")]
pub fn series_url(&self) -> Option<&String> {
self.series_url.as_ref()
}

pub fn series_description(&self) -> Option<&String> {
self.series_description.as_ref()
}

#[graphql(description = "URL of the series' call for proposals page")]
pub fn series_cfp_url(&self) -> Option<&String> {
self.series_cfp_url.as_ref()
}

pub fn imprint_id(&self) -> Uuid {
self.imprint_id
}
Expand Down
25 changes: 25 additions & 0 deletions thoth-api/src/model/publication/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ pub enum PublicationType {
Epub,
#[cfg_attr(feature = "backend", db_rename = "Mobi")]
Mobi,
#[cfg_attr(feature = "backend", db_rename = "AZW3")]
#[strum(serialize = "AZW3")]
Azw3,
#[cfg_attr(feature = "backend", db_rename = "DOCX")]
#[strum(serialize = "DOCX")]
Docx,
#[cfg_attr(feature = "backend", db_rename = "FictionBook")]
FictionBook,
}

#[cfg_attr(
Expand Down Expand Up @@ -171,6 +179,9 @@ fn test_publicationtype_display() {
assert_eq!(format!("{}", PublicationType::Xml), "XML");
assert_eq!(format!("{}", PublicationType::Epub), "Epub");
assert_eq!(format!("{}", PublicationType::Mobi), "Mobi");
assert_eq!(format!("{}", PublicationType::Azw3), "AZW3");
assert_eq!(format!("{}", PublicationType::Docx), "DOCX");
assert_eq!(format!("{}", PublicationType::FictionBook), "FictionBook");
}

#[test]
Expand Down Expand Up @@ -214,9 +225,23 @@ fn test_publicationtype_fromstr() {
PublicationType::from_str("Mobi").unwrap(),
PublicationType::Mobi
);
assert_eq!(
PublicationType::from_str("AZW3").unwrap(),
PublicationType::Azw3
);
assert_eq!(
PublicationType::from_str("DOCX").unwrap(),
PublicationType::Docx
);
assert_eq!(
PublicationType::from_str("FictionBook").unwrap(),
PublicationType::FictionBook
);

assert!(PublicationType::from_str("PNG").is_err());
assert!(PublicationType::from_str("Latex").is_err());
assert!(PublicationType::from_str("azw3").is_err());
assert!(PublicationType::from_str("Fiction Book").is_err());
}

#[test]
Expand Down
16 changes: 14 additions & 2 deletions thoth-api/src/model/series/crud.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ impl Crud for Series {
imprint_id,
created_at,
updated_at,
series_description,
series_cfp_url,
))
.into_boxed();

Expand Down Expand Up @@ -78,6 +80,14 @@ impl Crud for Series {
Direction::Asc => query = query.order(series_url.asc()),
Direction::Desc => query = query.order(series_url.desc()),
},
SeriesField::SeriesDescription => match order.direction {
Direction::Asc => query = query.order(series_description.asc()),
Direction::Desc => query = query.order(series_description.desc()),
},
SeriesField::SeriesCfpUrl => match order.direction {
Direction::Asc => query = query.order(series_cfp_url.asc()),
Direction::Desc => query = query.order(series_cfp_url.desc()),
},
SeriesField::CreatedAt => match order.direction {
Direction::Asc => query = query.order(created_at.asc()),
Direction::Desc => query = query.order(created_at.desc()),
Expand All @@ -99,7 +109,8 @@ impl Crud for Series {
.ilike(format!("%{}%", filter))
.or(issn_print.ilike(format!("%{}%", filter)))
.or(issn_digital.ilike(format!("%{}%", filter)))
.or(series_url.ilike(format!("%{}%", filter))),
.or(series_url.ilike(format!("%{}%", filter)))
.or(series_description.ilike(format!("%{}%", filter))),
);
}
match query
Expand Down Expand Up @@ -136,7 +147,8 @@ impl Crud for Series {
.ilike(format!("%{}%", filter))
.or(issn_print.ilike(format!("%{}%", filter)))
.or(issn_digital.ilike(format!("%{}%", filter)))
.or(series_url.ilike(format!("%{}%", filter))),
.or(series_url.ilike(format!("%{}%", filter)))
.or(series_description.ilike(format!("%{}%", filter))),
);
}

Expand Down
Loading

0 comments on commit 06c1bad

Please sign in to comment.