Add saveProcessDataToDb
This commit is contained in:
parent
d6de96910a
commit
208da9b819
@ -655,6 +655,7 @@ export default class Services {
|
|||||||
// Save process to db
|
// Save process to db
|
||||||
try {
|
try {
|
||||||
await this.saveProcessToDb(processId, updatedProcess.current_process);
|
await this.saveProcessToDb(processId, updatedProcess.current_process);
|
||||||
|
await this.saveProcessDataToDb(updatedProcess.current_process);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
@ -863,6 +864,25 @@ export default class Services {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async saveProcessDataToDb(process: Process) {
|
||||||
|
for (const state of process.states) {
|
||||||
|
if (state.state_id === "") continue
|
||||||
|
for (const field of Object.keys(state.pcd_commitment)) {
|
||||||
|
try {
|
||||||
|
const hash = state.pcd_commitment[field];
|
||||||
|
const encrypted = state.encrypted_pcd[field];
|
||||||
|
console.log(hash);
|
||||||
|
console.log(encrypted);
|
||||||
|
const blob = new Blob([encrypted], { type: 'text/plain' });
|
||||||
|
console.log(blob);
|
||||||
|
await this.saveBlobToDb(hash, blob);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async saveProcessToDb(processId: string, process: Process) {
|
public async saveProcessToDb(processId: string, process: Process) {
|
||||||
const db = await Database.getInstance();
|
const db = await Database.getInstance();
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user