feat(striker-ui-api): add insert or update user to access module

main
Tsu-ba-me 2 years ago
parent 560d60c7e8
commit a16d5160d4
  1. 9
      striker-ui-api/src/lib/accessModule.ts
  2. 6
      striker-ui-api/src/types/AccessModule.d.ts
  3. 11
      striker-ui-api/src/types/InsertOrUpdateUserFunction.d.ts

@ -191,6 +191,14 @@ const insertOrUpdateJob = async ({
return uuid; return uuid;
}; };
const insertOrUpdateUser: InsertOrUpdateUserFunction = async (params) => {
const [uuid]: [string] = await subroutine('insert_or_update_users', {
params: [params],
});
return uuid;
};
const insertOrUpdateVariable: InsertOrUpdateVariableFunction = async ( const insertOrUpdateVariable: InsertOrUpdateVariableFunction = async (
params, params,
) => { ) => {
@ -367,6 +375,7 @@ const getUpsSpec = async () => {
export { export {
insertOrUpdateJob as job, insertOrUpdateJob as job,
insertOrUpdateUser,
insertOrUpdateVariable as variable, insertOrUpdateVariable as variable,
anvilSyncShared, anvilSyncShared,
refreshTimestamp as timestamp, refreshTimestamp as timestamp,

@ -6,7 +6,13 @@ type SubroutineCommonParams = {
debug?: number; debug?: number;
}; };
/**
* @prop file - Source file name
* @prop line - Source file line number
* @prop uuid - Database UUID
*/
type InsertOrUpdateFunctionCommonParams = SubroutineCommonParams & { type InsertOrUpdateFunctionCommonParams = SubroutineCommonParams & {
file: string; file: string;
line?: number; line?: number;
uuid?: string;
}; };

@ -0,0 +1,11 @@
type UserParams = InsertOrUpdateFunctionCommonParams & {
user_algorithm?: string;
user_hash_count?: number;
user_language?: string;
user_name: string;
user_password_hash: string;
user_salt?: string;
user_uuid?: string;
};
type InsertOrUpdateUserFunction = (params: UserParams) => Promise<string>;
Loading…
Cancel
Save