Implement most of status system (still kinda bootycheeks at checking if
you're connected), fionally fix prettierrc
This commit is contained in:
parent
126acf52f3
commit
e64910d895
29 changed files with 2001 additions and 879 deletions
|
|
@ -1,14 +1,16 @@
|
|||
import { Status } from '../../index.ts';
|
||||
import { sqliteTable, integer, text } from 'drizzle-orm/sqlite-core';
|
||||
|
||||
export const user = sqliteTable('user', {
|
||||
id: text('id').primaryKey(),
|
||||
username: text('username').notNull().unique(),
|
||||
email: text('email').notNull().unique(),
|
||||
passwordHash: text('password_hash').notNull(),
|
||||
friends: text('friends', { mode: "json"}).default([]).notNull(),
|
||||
id: text('id').primaryKey(),
|
||||
username: text('username').notNull().unique(),
|
||||
email: text('email').notNull().unique(),
|
||||
passwordHash: text('password_hash').notNull(),
|
||||
statusOverwrite: integer('status_overwrite').default(Status.ONLINE).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
|
||||
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', {
|
||||
|
|
@ -19,39 +21,66 @@ export const session = sqliteTable('session', {
|
|||
expiresAt: integer('expires_at', { mode: 'timestamp' }).notNull()
|
||||
});
|
||||
|
||||
export const server = sqliteTable("server", {
|
||||
export const server = sqliteTable('server', {
|
||||
id: text('id').primaryKey(),
|
||||
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(), // string[] of ChannelIDs
|
||||
})
|
||||
owner: text('owner')
|
||||
.notNull()
|
||||
.references(() => user.id),
|
||||
members: text('members', { mode: 'json' }).default([]).notNull(),
|
||||
channels: text('channels', { mode: 'json' }).default([]).notNull() // string[] of ChannelIDs
|
||||
});
|
||||
|
||||
export const group = sqliteTable("group", {
|
||||
export const group = sqliteTable('group', {
|
||||
id: text('id').primaryKey(),
|
||||
name: text('name').notNull(),
|
||||
owner: text('owner').notNull().references(() => user.id),
|
||||
members: text('members', { mode: "json"}).default([]).notNull(),
|
||||
})
|
||||
owner: text('owner')
|
||||
.notNull()
|
||||
.references(() => user.id),
|
||||
members: text('members', { mode: 'json' }).default([]).notNull()
|
||||
});
|
||||
|
||||
export const channel = sqliteTable("channel", {
|
||||
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(),
|
||||
})
|
||||
serverId: text('server_id')
|
||||
.notNull()
|
||||
.references(() => server.id),
|
||||
messages: text('messages', { mode: 'json' }).default([]).notNull()
|
||||
});
|
||||
|
||||
export const friendRequest = sqliteTable("friendRequest", {
|
||||
export const directMessage = sqliteTable('directMessage', {
|
||||
id: text('id').primaryKey(),
|
||||
fromUser: text('from_user').notNull().references(() => user.id),
|
||||
toUser: text('to_user').notNull().references(() => user.id),
|
||||
})
|
||||
name: text('name').notNull(),
|
||||
serverId: text('server_id')
|
||||
.notNull()
|
||||
.references(() => server.id),
|
||||
messages: text('messages', { mode: 'json' }).default([]).notNull()
|
||||
});
|
||||
|
||||
export const invite = sqliteTable("invite", {
|
||||
export const friendRequest = sqliteTable('friendRequest', {
|
||||
id: text('id').primaryKey(),
|
||||
serverId: text('server_id').notNull().references(() => server.id),
|
||||
code: text('code').notNull(),
|
||||
})
|
||||
fromUser: text('from_user')
|
||||
.notNull()
|
||||
.references(() => user.id),
|
||||
fromUsername: text('from_username')
|
||||
.notNull()
|
||||
.references(() => user.id),
|
||||
toUsername: text('to_username')
|
||||
.notNull()
|
||||
.references(() => user.id),
|
||||
toUser: text('to_user')
|
||||
.notNull()
|
||||
.references(() => user.id)
|
||||
});
|
||||
|
||||
export const invite = sqliteTable('invite', {
|
||||
id: text('id').primaryKey(),
|
||||
serverId: text('server_id')
|
||||
.notNull()
|
||||
.references(() => server.id),
|
||||
code: text('code').notNull()
|
||||
});
|
||||
export type Session = typeof session.$inferSelect;
|
||||
export type User = typeof user.$inferSelect;
|
||||
export type Group = typeof group.$inferSelect;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue