relate session to npub

This commit is contained in:
counterweight 2025-02-10 01:38:06 +01:00
parent 36dba606de
commit 79f02f70cc
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
2 changed files with 20 additions and 11 deletions

View file

@ -1,4 +1,7 @@
const uuid = require("uuid");
const Session = require('../models/Session');
const SessionNpubbed = require('../models/SessionNpubbed');
async function createSession(sessionUuid) {
await Session.create({
@ -7,5 +10,14 @@ async function createSession(sessionUuid) {
});
}
exports.createSession = createSession;
async function relateSessionToNpub(sessionUuid, npub) {
await SessionNpubbed.create({
session_npubbed_uuid: uuid.v7(),
session_uuid: sessionUuid,
npub,
created_at: new Date().toISOString()
});
}
exports.createSession = createSession;
exports.relateSessionToNpub = relateSessionToNpub;