Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -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,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user