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:
2026-02-07 01:26:16 +08:00
parent d62a75842f
commit 7dfa96d165
40 changed files with 1066 additions and 1171 deletions

View File

@@ -51,7 +51,7 @@ export const appsTrades = pgTable("apps_trades", {
]);
export const cfOrgs = pgTable("cf_orgs", {
id: uuid().primaryKey().notNull(),
id: uuid().primaryKey().notNull().defaultRandom(),
username: varchar({ length: 255 }).notNull(),
users: jsonb().default([]),
createdAt: timestamp({ withTimezone: true, mode: 'string' }).notNull().defaultNow(),
@@ -81,7 +81,7 @@ export const cfRouterCode = pgTable("cf_router_code", {
});
export const cfUser = pgTable("cf_user", {
id: uuid().primaryKey().notNull(),
id: uuid().primaryKey().notNull().defaultRandom(),
username: varchar({ length: 255 }).notNull(),
password: varchar({ length: 255 }),
salt: varchar({ length: 255 }),
@@ -102,7 +102,7 @@ export const cfUser = pgTable("cf_user", {
]);
export const cfUserSecrets = pgTable("cf_user_secrets", {
id: uuid().primaryKey().notNull(),
id: uuid().primaryKey().notNull().defaultRandom(),
description: text(),
status: varchar({ length: 255 }).default('active'),
title: text(),