Skip to content

Commit

Permalink
Added attribution required field
Browse files Browse the repository at this point in the history
  • Loading branch information
jzongker committed Jan 30, 2025
1 parent 55f3568 commit 8cd6b28
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
17 changes: 9 additions & 8 deletions src/helpers/ApiBibleHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { ArrayHelper } from "@churchapps/apihelper";

export class ApiBibleHelper {
static baseUrl: string = "https://api.scripture.api.bible/v1";
/*
static translationCopyrights: { [key: string]: string } = {
"a81b73293d3080c9-01": "Amplified® Bible Copyright © 2015 by The Lockman Foundation, La Habra, CA 90631 All rights reserved. http://www.lockman.org",
"e3f420b9665abaeb-01": "La Biblia de las Américas Copyright © 1986, 1995, 1997 by The Lockman Foundation Derechos Reservados All Rights Reserved",
"a761ca71e0b3ddcf-01": "NEW AMERICAN STANDARD BIBLE® NASB® Copyright © 1960, 1971, 1977,1995, 2020 by The Lockman Foundation A Corporation Not for Profit La Habra, CA All Rights Reserved www.lockman.org",
"b8ee27bcd1cae43a-01": "NEW AMERICAN STANDARD BIBLE® NASB® Copyright © 1960,1962,1963,1968,1971,1972,1973,1975,1977,1995 by The Lockman Foundation A Corporation Not for Profit La Habra, CA All Rights Reserved www.lockman.org",
"ce11b813f9a27e20-01": "Nueva Biblia de las Américas Copyright © 2005 by The Lockman Foundation La Habra, California 90631 Sociedad no comercial Derechos Reservados (All Rights Reserved) http://www.NuevaBiblia.com (Español) http://www.lockman.org (English) Versión de texto 2019 Texto derivado de La Biblia de las Américas © Copyright 1986, 1995, 1997 by The Lockman Foundation"
}*/

static attributionRequired: string[] = [
"a81b73293d3080c9-01", //AMP
"e3f420b9665abaeb-01", //LBLA
"a761ca71e0b3ddcf-01", //NASB2020
"b8ee27bcd1cae43a-01", //NASB95
"ce11b813f9a27e20-01" //NBLA
]

static async getCopyright(translationKey: string) {
const books = await ApiBibleHelper.getBooks(translationKey);
Expand All @@ -30,6 +30,7 @@ export class ApiBibleHelper {

data.data.forEach((d: any) => {
const translation: BibleTranslation = {
attributionRequired: this.attributionRequired.indexOf(d.id) >= 0,
name: d.name,
nameLocal: d.nameLocal,
abbreviation: d.abbreviation,
Expand Down
1 change: 1 addition & 0 deletions src/models/BibleTranslation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ export class BibleTranslation {
public countries?: string;
public countryList?: string[];
public copyright?: string;
public attributionRequired?: boolean;
}
8 changes: 4 additions & 4 deletions src/repositories/BibleTranslationRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ export class BibleTranslationRepository {
private async create(translation: BibleTranslation) {
translation.id = UniqueIdHelper.shortId();

const sql = "INSERT INTO bibleTranslations (id, abbreviation, name, nameLocal, description, source, sourceKey, language, countries, copyright) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);";
const params = [translation.id, translation.abbreviation, translation.name, translation.nameLocal, translation.description, translation.source, translation.sourceKey, translation.language, translation.countries, translation.copyright];
const sql = "INSERT INTO bibleTranslations (id, abbreviation, name, nameLocal, description, source, sourceKey, language, countries, copyright, attributionRequired) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);";
const params = [translation.id, translation.abbreviation, translation.name, translation.nameLocal, translation.description, translation.source, translation.sourceKey, translation.language, translation.countries, translation.copyright, translation.attributionRequired];
await DB.query(sql, params);
return translation;
}

private async update(translation: BibleTranslation) {
const sql = "UPDATE bibleTranslations SET abbreviation=?, name=?, nameLocal=?, description=?, source=?, sourceKey=?, language=?, countries=?, copyright=? WHERE id=?";
const params = [translation.abbreviation, translation.name, translation.nameLocal, translation.description, translation.source, translation.sourceKey, translation.language, translation.countries, translation.copyright, translation.id];
const sql = "UPDATE bibleTranslations SET abbreviation=?, name=?, nameLocal=?, description=?, source=?, sourceKey=?, language=?, countries=?, copyright=?, attributionRequired=? WHERE id=?";
const params = [translation.abbreviation, translation.name, translation.nameLocal, translation.description, translation.source, translation.sourceKey, translation.language, translation.countries, translation.copyright, translation.attributionRequired, translation.id];
await DB.query(sql, params);
return translation;
}
Expand Down

0 comments on commit 8cd6b28

Please sign in to comment.