- 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.
12 lines
425 B
TypeScript
12 lines
425 B
TypeScript
import { db, schema } from '@/app.ts';
|
|
import { eq } from 'drizzle-orm';
|
|
|
|
export const mvAppFromUserAToUserB = async (userA: string, userB: string) => {
|
|
const appList = await db.select().from(schema.kvApp).where(eq(schema.kvApp.user, userA));
|
|
for (const app of appList) {
|
|
await db.update(schema.kvApp)
|
|
.set({ user: userB, updatedAt: new Date().toISOString() })
|
|
.where(eq(schema.kvApp.id, app.id));
|
|
}
|
|
};
|