git.schokokeks.org
Repositories
Help
Report an Issue
fs-words.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
9815a42
Branches
Tags
develop-client_server
master
typescript
fs-words.git
source
repositories
concept-translations.ts
[add] typescript logic
Christian Fraß
commited
9815a42
at 2021-03-03 00:27:18
concept-translations.ts
Blame
History
Raw
namespace repositories { /** */ export var concept_translations : helpers.repository_sqltable = { "setup": function () { return helpers.database.query_do_named("concept.setup-translations"); }, "teardown": function () { throw (new Error("not implemented")); }, "create": function (row) { return helpers.database.query_put_free ( "INSERT INTO concept_translations(concept_id, language_id, value) VALUES (:concept_id, :language_id, :value);", { "concept_id": row["concept_id"], "language_id": row["language_id"], "value": row["value"], } ); }, "update": function (concept_translation_id, row) { return helpers.database.query_do_free ( "UPDATE concept_translations SET concept_id = :concept_id, language_id = :language_id, value = :value WHERE (id = :id)", { "id": concept_translation_id, "concept_id": row["concept_id"], "language_id": row["language_id"], "value": row["value"], } ); }, "delete": function (concept_translation_id) { return helpers.database.query_do_free ( "DELETE FROM concept_translations WHERE (id = :id)", { "id": concept_translation_id, } ); }, "read": async function (concept_translation_id) { return ( helpers.database.query_get_free ( "SELECT concept_id,language_id,value FROM concept_translations WHERE (id = :id)", { "id": concept_translation_id, } ) .then ( (rows) => ( (rows.length === 1) ? Promise.resolve<type_row>(rows[0]) : Promise.reject<type_row>(new Error("not found")) ) ) ); }, "purge": async function (column, value) { return helpers.database.query_do_free ( "DELETE FROM concept_translations WHERE (" + column + " = :value)", { "value": value, } ); }, "take": async function (column, value) { return await helpers.database.query_get_free ( "SELECT concept_id,language_id,value FROM concept_translations WHERE (" + column + " = :value)", { "value": value, } ); }, }; }