Refactor app management to use Drizzle ORM
- Replaced Sequelize models with Drizzle ORM for app and app list management. - Updated routes in app-manager to utilize new database queries. - Removed obsolete Sequelize model files for app, app list, and app domain. - Introduced new helper functions for app and app domain management. - Enhanced user app management with improved file handling and user migration. - Adjusted public API routes to align with new database structure. - Implemented caching mechanisms for domain management.
This commit is contained in:
@@ -1,42 +0,0 @@
|
||||
import { pgTable, serial, text, varchar, uuid, boolean, jsonb, timestamp } from "drizzle-orm/pg-core";
|
||||
import { InferSelectModel, InferInsertModel } from "drizzle-orm";
|
||||
|
||||
export const users = pgTable('cf_user', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
username: text('username').notNull().unique(),
|
||||
nickname: text('nickname'),
|
||||
password: text('password'),
|
||||
email: text('email'),
|
||||
avatar: text('avatar'),
|
||||
salt: text('salt'),
|
||||
description: text('description'),
|
||||
type: text('type').notNull().default('user'),
|
||||
owner: uuid('owner'),
|
||||
orgId: uuid('orgId'),
|
||||
needChangePassword: boolean('needChangePassword').notNull().default(false),
|
||||
data: jsonb('data').notNull().default({}),
|
||||
createdAt: timestamp('createdAt').notNull().defaultNow(),
|
||||
updatedAt: timestamp('updatedAt').notNull().defaultNow(),
|
||||
deletedAt: timestamp('deletedAt'),
|
||||
});
|
||||
|
||||
// 类型推断
|
||||
export type User = InferSelectModel<typeof users>;
|
||||
export type NewUser = InferInsertModel<typeof users>;
|
||||
|
||||
// 用户数据类型
|
||||
export type UserData = {
|
||||
orgs?: string[];
|
||||
wxUnionId?: string;
|
||||
phone?: string;
|
||||
};
|
||||
|
||||
// 用户类型枚举
|
||||
export enum UserTypes {
|
||||
user = 'user',
|
||||
org = 'org',
|
||||
visitor = 'visitor',
|
||||
}
|
||||
// export class User {
|
||||
|
||||
// }
|
||||
Reference in New Issue
Block a user