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-core.ts
[add] typescript logic
Christian Fraß
commited
9815a42
at 2021-03-03 00:27:18
concept-core.ts
Blame
History
Raw
namespace repositories { export var concept_core : helpers.repository_sqltable = { "setup": function () { return helpers.database.query_do_named("concept.setup-core"); }, "teardown": function () { throw (new Error("not implemented")); }, "create": function (row) { return helpers.database.query_put_free ( "INSERT INTO concepts(type_id, description) VALUES (:type_id, :description);", { "type_id": row["type_id"], "description": row["description"], } ); }, "update": function (concept_id, row) { return helpers.database.query_do_free ( "UPDATE concepts SET type_id = :type_id, description = :description WHERE (id = :id)", { "id": concept_id, "type_id": row["type_id"], "description": row["description"], } ); }, "delete": function (concept_id) { return helpers.database.query_do_free ( "DELETE FROM concepts WHERE (id = :id)", { "id": concept_id, } ); }, "read": function (concept_id) { return ( helpers.database.query_get_free ( "SELECT type_id,description FROM concepts WHERE (id = :id)", { "id": concept_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) { throw (new Error("not implemented")); }, "take": async function (column, value) { throw (new Error("not implemented")); }, }; }