Refactor user storage and update
Rename accounts to users to be consistent with the new naming scheme where account only referes to the logged in user of the session and implement live updates of users via a user store which listens for updates from the event stream.
This commit is contained in:
parent
6336ccdb96
commit
3be7f8be05
24 changed files with 331 additions and 182 deletions
|
@ -1,14 +1,10 @@
|
|||
import { pipeline } from "node:stream";
|
||||
import { addStream, deleteStream } from "~/server/streams";
|
||||
import { readAccounts } from "~/server/database";
|
||||
import { readUsers } from "~/server/database";
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const session = await getServerSession(event);
|
||||
let accountId: number | undefined;
|
||||
if (session) {
|
||||
const accounts = await readAccounts()
|
||||
accountId = accounts.find(account => account.id === session.accountId)?.id;
|
||||
}
|
||||
const accountId = session?.account.id;
|
||||
|
||||
const encoder = new TextEncoder();
|
||||
const source = event.headers.get("x-forwarded-for");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue