actually start implementing the backend slowly

This commit is contained in:
Soph :3 2026-01-04 15:49:32 +02:00
parent 37ae49b66e
commit 342fd30d62
19 changed files with 977 additions and 136 deletions

View file

@ -6,6 +6,9 @@ export const user = sqliteTable('user', {
email: text('email').notNull().unique(),
passwordHash: text('password_hash').notNull(),
friends: text('friends', { mode: "json"}).default([]).notNull(),
servers: text('servers', { mode: "json"}).default([]).notNull(), // string[] of ServerIDs
groups: text('groups', { mode: "json"}).default([]).notNull(), // string[] of GroupIDs
});
export const session = sqliteTable('session', {
@ -21,7 +24,7 @@ export const server = sqliteTable("server", {
name: text('name').notNull(),
owner: text('owner').notNull().references(() => user.id),
members: text('members', { mode: "json"}).default([]).notNull(),
channels: text('channels', { mode: "json"}).default([]).notNull(),
channels: text('channels', { mode: "json"}).default([]).notNull(), // string[] of ChannelIDs
})
export const group = sqliteTable("group", {
@ -31,6 +34,13 @@ export const group = sqliteTable("group", {
members: text('members', { mode: "json"}).default([]).notNull(),
})
export const channel = sqliteTable("channel", {
id: text('id').primaryKey(),
name: text('name').notNull(),
serverId: text('server_id').notNull().references(() => server.id),
messages: text('messages', { mode: "json"}).default([]).notNull(),
})
export type Session = typeof session.$inferSelect;
export type User = typeof user.$inferSelect;
export type Group = typeof group.$inferSelect;