mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-27 07:16:19 +09:00
feat: improve api
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { pgTable, timestamp, uuid, jsonb, text } from 'drizzle-orm/pg-core'
|
||||
import { pgTable, timestamp, uuid, jsonb } from 'drizzle-orm/pg-core'
|
||||
import { users } from './users'
|
||||
|
||||
export const history = pgTable(
|
||||
'history',
|
||||
@@ -6,6 +7,6 @@ export const history = pgTable(
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
messages: jsonb('messages').notNull(),
|
||||
timestamp: timestamp('timestamp').notNull(),
|
||||
user: text('user').notNull(),
|
||||
user: uuid('user').notNull().references(() => users.id),
|
||||
}
|
||||
)
|
||||
@@ -1,8 +1,9 @@
|
||||
import { pgTable, text, uuid, integer } from 'drizzle-orm/pg-core'
|
||||
import { model } from './model'
|
||||
import { users } from './users'
|
||||
|
||||
export const settings = pgTable('settings', {
|
||||
userId: text('user_id').primaryKey(),
|
||||
userId: uuid('user_id').primaryKey().references(() => users.id),
|
||||
defaultChatModel: uuid('default_chat_model').references(() => model.id),
|
||||
defaultEmbeddingModel: uuid('default_embedding_model').references(() => model.id),
|
||||
defaultSummaryModel: uuid('default_summary_model').references(() => model.id),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { pgTable, pgEnum, text, timestamp, uuid } from 'drizzle-orm/pg-core'
|
||||
import { pgTable, pgEnum, text, timestamp, uuid, boolean } from 'drizzle-orm/pg-core'
|
||||
|
||||
// 定义用户角色枚举
|
||||
export const userRoleEnum = pgEnum('user_role', ['admin', 'member'])
|
||||
@@ -27,7 +27,7 @@ export const users = pgTable('users', {
|
||||
avatarUrl: text('avatar_url'),
|
||||
|
||||
// 账户状态(是否激活)
|
||||
isActive: text('is_active').notNull().default('true'),
|
||||
isActive: boolean('is_active').notNull().default(true),
|
||||
|
||||
// 创建时间
|
||||
createdAt: timestamp('created_at').notNull().defaultNow(),
|
||||
|
||||
Reference in New Issue
Block a user