implement channels fully, implement servers fully, make dms impossible

to send if no longer friends, update overview information on
invalidation (form response recieved, friends update)
This commit is contained in:
Soph :3 2026-01-11 13:47:46 +02:00
parent 92a95cb365
commit 7af96ca084
8 changed files with 245 additions and 104 deletions

View file

@ -84,16 +84,38 @@ export async function validateSessionToken(token: string) {
})
);
const servers = (user.servers as string[]).length
let servers = (user.servers as string[]).length
? await db
.select({
id: table.server.id,
name: table.server.name,
ownerId: table.server.owner
ownerId: table.server.owner,
channels: table.server.channels
})
.from(table.server)
.where(inArray(table.server.id, user.servers as string[]))
: [];
servers = await Promise.all(
servers.map(async (z) => {
return {
...z,
channels: (
await Promise.all(
(z.channels as string[]).map(async (m) => {
const channel = await db.select().from(table.channel).where(eq(table.channel.id, m));
if (!channel || channel.length == 0) return;
return {
name: channel[0].name,
id: channel[0].id
};
})
)
).filter(Boolean)
};
})
);
const groups = (user.groups as string[]).length
? await db
.select({