78 lines
1.3 KiB
TypeScript
78 lines
1.3 KiB
TypeScript
![]() |
|
||
|
namespace _zeitbild.repository.auth_internal
|
||
|
{
|
||
|
|
||
|
/**
|
||
|
*/
|
||
|
var _chest : (
|
||
|
null
|
||
|
|
|
||
|
lib_plankton.storage.type_chest<
|
||
|
Array<string>,
|
||
|
Record<string, any>,
|
||
|
lib_plankton.database.type_description_create_table,
|
||
|
lib_plankton.storage.sql_table_common.type_sql_table_common_search_term,
|
||
|
Record<string, any>
|
||
|
>
|
||
|
) = null;
|
||
|
|
||
|
|
||
|
/**
|
||
|
*/
|
||
|
function get_chest(
|
||
|
) : lib_plankton.storage.type_chest<
|
||
|
Array<string>,
|
||
|
Record<string, any>,
|
||
|
lib_plankton.database.type_description_create_table,
|
||
|
lib_plankton.storage.sql_table_common.type_sql_table_common_search_term,
|
||
|
Record<string, any>
|
||
|
>
|
||
|
{
|
||
|
if (_chest === null) {
|
||
|
_chest = lib_plankton.storage.sql_table_common.chest(
|
||
|
{
|
||
|
"database_implementation": _zeitbild.database.get_implementation(),
|
||
|
"table_name": "auth_internal",
|
||
|
"key_names": ["name"],
|
||
|
}
|
||
|
);
|
||
|
}
|
||
|
else {
|
||
|
// do nothing
|
||
|
}
|
||
|
return _chest;
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
*/
|
||
|
export function read(
|
||
|
name : string
|
||
|
) : Promise<string>
|
||
|
{
|
||
|
return (
|
||
|
get_chest().read([name])
|
||
|
.then(
|
||
|
(row) => Promise.resolve<string>(row["password_image"])
|
||
|
)
|
||
|
);
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
*/
|
||
|
export function write(
|
||
|
name : string,
|
||
|
password_image : string
|
||
|
) : Promise<void>
|
||
|
{
|
||
|
return (
|
||
|
get_chest().write([name], {"password_image": password_image})
|
||
|
.then(
|
||
|
() => Promise.resolve<void>(undefined)
|
||
|
)
|
||
|
);
|
||
|
}
|
||
|
|
||
|
}
|