This commit is contained in:
Carl-Gerhard Lindesvärd
2024-02-04 13:23:21 +01:00
parent 30af9cab2f
commit ccd1a1456f
135 changed files with 5588 additions and 1758 deletions

View File

@@ -0,0 +1,22 @@
import { generateSalt } from '@mixan/common';
import { db, getCurrentSalt } from '@mixan/db';
export async function salt() {
const oldSalt = await getCurrentSalt();
const newSalt = await db.salt.create({
data: {
salt: generateSalt(),
},
});
// Delete rest of the salts
await db.salt.deleteMany({
where: {
salt: {
notIn: [newSalt.salt, oldSalt],
},
},
});
return newSalt;
}