Refactor code structure for improved readability and maintainability

This commit is contained in:
2026-02-18 12:59:51 +08:00
parent 9cc48821b1
commit 577b6bfaa4
7 changed files with 1217 additions and 24 deletions

View File

@@ -1,5 +1,4 @@
import { app, db, schema } from '@/app.ts';
import { randomUUID } from 'crypto';
import { oss } from '@/app.ts';
import { User } from '@/models/user.ts';
import { customAlphabet } from 'nanoid';
@@ -10,9 +9,7 @@ const number = '0123456789';
const randomId = customAlphabet(letter + number, 16);
const getShareUser = async () => {
const shareUser = await User.findOne({
where: {
username: 'share',
},
username: 'share',
});
return shareUser?.id || '';
};
@@ -64,7 +61,6 @@ app
},
];
const appModels = await db.insert(schema.kvApp).values({
id: randomUUID(),
title,
description,
version,
@@ -82,7 +78,6 @@ app
}).returning();
const appModel = appModels[0];
const appVersionModels = await db.insert(schema.kvAppList).values({
id: randomUUID(),
data: {
files: files,
},