Skip to content

Commit

Permalink
Merge pull request #670 from akashgp09/series-identifiers
Browse files Browse the repository at this point in the history
feat(series): add identifiers
  • Loading branch information
MonkeyDo committed Jul 29, 2021
2 parents 27c5cca + 952b89a commit f3897bd
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sql/migrations/series-identifiers/down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
BEGIN;

DELETE FROM bookbrainz.identifier_type WHERE id BETWEEN 30 and 34;

COMMIT;
11 changes: 11 additions & 0 deletions sql/migrations/series-identifiers/up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
BEGIN;

INSERT INTO bookbrainz.identifier_type ( id, label, description, detection_regex, validation_regex, display_template, entity_type, parent_id, child_order, deprecated )
VALUES
( 30, 'Wikidata ID', 'The ID for the Wikidata page corresponding to a BookBrainz Series.', 'wikidata\.org/wiki/(?:Special:\w*\/)?(Q\d+)', '^Q\d+$', 'Placeholder Template', 'Series', NULL, 0, false),
( 31, 'VIAF', 'The VIAF ID corresponding to a BookBrainz Series', 'viaf\.org/viaf/(\d+)', '^(\d+)$', 'Placeholder Template', 'Series', NULL, 0, false),
( 32, 'MusicBrainz Series ID', 'The ID for the MusicBrainz Series corresponding to a BookBrainz Series.', 'musicbrainz\.org/series/([a-f0-9]{8}-?[a-f0-9]{4}-?[a-f0-9]{4}-?[a-f0-9]{4}-?[a-f0-9]{12})', '^[a-f0-9]{8}-?[a-f0-9]{4}-?[a-f0-9]{4}-?[a-f0-9]{4}-?[a-f0-9]{12}$', 'Placeholder Template', 'Series', NULL, 0, false),
( 33, 'Goodreads Series ID', 'Goodreads series ID that corresponds to a BookBrainz Series', 'goodreads\.com\/series\/(\d+)(?:[-.]\S+)?', '^[1-9]\d*$', 'Placeholder Template', 'Series', NULL, 0, false),
( 34, 'IMDB List ID', 'The ID for a list from IMDB', 'imdb\.com/list/(ls\d+)', '^(ls\d+)$', 'Placeholder Template', 'Series', NULL, 0, false);

COMMIT;
11 changes: 11 additions & 0 deletions src/client/components/pages/entities/identifiers-links.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ function IdentifierLink({typeId, value}) {
break;
case 12: // @VIAF: The VIAF ID corresponding to a BookBrainz Author.
case 29: // @VIAF: The VIAF ID corresponding to a BookBrainz Publisher.
case 31: // @VIAF: The VIAF ID corresponding to a BookBrainz Series.
link = `https://viaf.org/viaf/${value}`;
break;
case 13: // @ISNI: The ISNI ID corresponding to a BookBrainz Author.
Expand All @@ -79,6 +80,7 @@ function IdentifierLink({typeId, value}) {
case 19: // @Wikidata ID: The ID for the Wikidata page corresponding to a BookBrainz EditionGroup.
case 20: // @Wikidata ID: The ID for the Wikidata page corresponding to a BookBrainz Publisher.
case 21: // @Wikidata ID: The ID for the Wikidata page corresponding to a BookBrainz Work.
case 30: // @Wikidata ID: The ID for the Wikidata page corresponding to a BookBrainz Series.
link = `https://www.wikidata.org/wiki/${value}`;
break;
case 22:
Expand All @@ -102,6 +104,15 @@ function IdentifierLink({typeId, value}) {
case 28:
link = `https://www.goodreads.com/book/show/${value}`;
break;
case 32: // @MusicBrainz Series ID: The ID for the MusicBrainz Series corresponding to a BookBrainz Series.
link = `https://musicbrainz.org/series/${value}`;
break;
case 33: // @Goodreads Series ID: The ID for the Goodreads Series page corresponding to a BookBrainz Series.
link = `https://www.goodreads.com/series/${value}`;
break;
case 34: // @IMDB List ID: The ID for a list from IMDB
link = `https://www.imdb.com/list/${value}`;
break;
default:
return value;
}
Expand Down

0 comments on commit f3897bd

Please sign in to comment.