Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -7,7 +7,6 @@ import { setExpire } from './revoke.ts';
|
||||
import { User } from '@/models/user.ts';
|
||||
import { callDetectAppVersion } from './export.ts';
|
||||
import { eq, and, desc } from 'drizzle-orm';
|
||||
import { randomUUID } from 'crypto';
|
||||
import { z } from 'zod';
|
||||
app
|
||||
.route({
|
||||
@@ -70,7 +69,6 @@ app
|
||||
}
|
||||
if (!appListModel && create) {
|
||||
const newApps = await db.insert(schema.kvAppList).values({
|
||||
id: randomUUID(),
|
||||
key,
|
||||
version,
|
||||
uid: tokenUser.id,
|
||||
@@ -84,7 +82,6 @@ app
|
||||
const appModel = appModels[0];
|
||||
if (!appModel) {
|
||||
await db.insert(schema.kvApp).values({
|
||||
id: randomUUID(),
|
||||
key,
|
||||
uid: tokenUser.id,
|
||||
user: tokenUser.username,
|
||||
@@ -145,7 +142,7 @@ app
|
||||
if (!rest.key) {
|
||||
ctx.throw('key is required');
|
||||
}
|
||||
const newApps = await db.insert(schema.kvAppList).values({ id: randomUUID(), data, ...rest, uid: tokenUser.id }).returning();
|
||||
const newApps = await db.insert(schema.kvAppList).values({ data, ...rest, uid: tokenUser.id }).returning();
|
||||
ctx.body = newApps[0];
|
||||
return ctx;
|
||||
})
|
||||
@@ -233,7 +230,6 @@ app
|
||||
if (!am) {
|
||||
appIsNew = true;
|
||||
const newAms = await db.insert(schema.kvApp).values({
|
||||
id: randomUUID(),
|
||||
user: userPrefix,
|
||||
key: appKey,
|
||||
uid,
|
||||
@@ -255,7 +251,6 @@ app
|
||||
let app = apps[0];
|
||||
if (!app) {
|
||||
const newApps = await db.insert(schema.kvAppList).values({
|
||||
id: randomUUID(),
|
||||
key: appKey,
|
||||
version,
|
||||
uid: uid,
|
||||
@@ -436,7 +431,6 @@ app
|
||||
let appList = appLists[0];
|
||||
if (!appList) {
|
||||
const newAppLists = await db.insert(schema.kvAppList).values({
|
||||
id: randomUUID(),
|
||||
key: appKey,
|
||||
version,
|
||||
uid,
|
||||
|
||||
Reference in New Issue
Block a user