feat: 更新依赖版本,优化用户模型构造函数和域名管理路由
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@kevisual/code-center",
|
"name": "@kevisual/code-center",
|
||||||
"version": "0.0.12",
|
"version": "0.0.13",
|
||||||
"description": "code center",
|
"description": "code center",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
"@types/busboy": "^1.5.4",
|
"@types/busboy": "^1.5.4",
|
||||||
"@types/send": "^1.2.1",
|
"@types/send": "^1.2.1",
|
||||||
"@types/ws": "^8.18.1",
|
"@types/ws": "^8.18.1",
|
||||||
"bullmq": "^5.69.3",
|
"bullmq": "^5.70.1",
|
||||||
"busboy": "^1.6.0",
|
"busboy": "^1.6.0",
|
||||||
"drizzle-kit": "^0.31.9",
|
"drizzle-kit": "^0.31.9",
|
||||||
"drizzle-orm": "^0.45.1",
|
"drizzle-orm": "^0.45.1",
|
||||||
@@ -59,14 +59,14 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@aws-sdk/client-s3": "^3.995.0",
|
"@aws-sdk/client-s3": "^3.995.0",
|
||||||
"@kevisual/api": "^0.0.57",
|
"@kevisual/api": "^0.0.59",
|
||||||
"@kevisual/cnb": "^0.0.28",
|
"@kevisual/cnb": "^0.0.28",
|
||||||
"@kevisual/context": "^0.0.8",
|
"@kevisual/context": "^0.0.8",
|
||||||
"@kevisual/local-app-manager": "0.1.32",
|
"@kevisual/local-app-manager": "0.1.32",
|
||||||
"@kevisual/logger": "^0.0.4",
|
"@kevisual/logger": "^0.0.4",
|
||||||
"@kevisual/oss": "0.0.19",
|
"@kevisual/oss": "0.0.19",
|
||||||
"@kevisual/permission": "^0.0.4",
|
"@kevisual/permission": "^0.0.4",
|
||||||
"@kevisual/router": "0.0.83",
|
"@kevisual/router": "0.0.84",
|
||||||
"@kevisual/types": "^0.0.12",
|
"@kevisual/types": "^0.0.12",
|
||||||
"@kevisual/use-config": "^1.0.30",
|
"@kevisual/use-config": "^1.0.30",
|
||||||
"@types/archiver": "^7.0.0",
|
"@types/archiver": "^7.0.0",
|
||||||
|
|||||||
30
pnpm-lock.yaml
generated
30
pnpm-lock.yaml
generated
@@ -35,8 +35,8 @@ importers:
|
|||||||
specifier: ^8.18.1
|
specifier: ^8.18.1
|
||||||
version: 8.18.1
|
version: 8.18.1
|
||||||
bullmq:
|
bullmq:
|
||||||
specifier: ^5.69.3
|
specifier: ^5.70.1
|
||||||
version: 5.69.3
|
version: 5.70.1
|
||||||
busboy:
|
busboy:
|
||||||
specifier: ^1.6.0
|
specifier: ^1.6.0
|
||||||
version: 1.6.0
|
version: 1.6.0
|
||||||
@@ -66,8 +66,8 @@ importers:
|
|||||||
specifier: ^3.995.0
|
specifier: ^3.995.0
|
||||||
version: 3.995.0
|
version: 3.995.0
|
||||||
'@kevisual/api':
|
'@kevisual/api':
|
||||||
specifier: ^0.0.57
|
specifier: ^0.0.59
|
||||||
version: 0.0.57(react-dom@19.2.4(react@19.2.4))(react@19.2.4)
|
version: 0.0.59(react-dom@19.2.4(react@19.2.4))(react@19.2.4)
|
||||||
'@kevisual/cnb':
|
'@kevisual/cnb':
|
||||||
specifier: ^0.0.28
|
specifier: ^0.0.28
|
||||||
version: 0.0.28(dotenv@17.3.1)(ioredis@5.9.3)
|
version: 0.0.28(dotenv@17.3.1)(ioredis@5.9.3)
|
||||||
@@ -87,8 +87,8 @@ importers:
|
|||||||
specifier: ^0.0.4
|
specifier: ^0.0.4
|
||||||
version: 0.0.4
|
version: 0.0.4
|
||||||
'@kevisual/router':
|
'@kevisual/router':
|
||||||
specifier: 0.0.83
|
specifier: 0.0.84
|
||||||
version: 0.0.83
|
version: 0.0.84
|
||||||
'@kevisual/types':
|
'@kevisual/types':
|
||||||
specifier: ^0.0.12
|
specifier: ^0.0.12
|
||||||
version: 0.0.12
|
version: 0.0.12
|
||||||
@@ -665,8 +665,8 @@ packages:
|
|||||||
'@kevisual/ai@0.0.24':
|
'@kevisual/ai@0.0.24':
|
||||||
resolution: {integrity: sha512-7jvZk1/L//VIClK7usuNgN4ZA9Etgbooka1Sj5quE/0UywR+NNnwqXVZ89Y1fBhI1TkhauDsdJBAtcQ7r/vbVw==}
|
resolution: {integrity: sha512-7jvZk1/L//VIClK7usuNgN4ZA9Etgbooka1Sj5quE/0UywR+NNnwqXVZ89Y1fBhI1TkhauDsdJBAtcQ7r/vbVw==}
|
||||||
|
|
||||||
'@kevisual/api@0.0.57':
|
'@kevisual/api@0.0.59':
|
||||||
resolution: {integrity: sha512-U2nz+ckWZ4XGASC08xJT6WKQajhFQDd1iDb9tU1dHZECsvNvIzpHLG7RHFN1vahG1MdbQtppPmHgVTF2Zw7RWg==}
|
resolution: {integrity: sha512-2w6GBG2mS92dz8afB0hLfjTw8lBGD5oXU5bw/QglFugHHp24fISZkEW1Hc+jP/jOiYlMzphws2/31DIXdDoGkg==}
|
||||||
|
|
||||||
'@kevisual/auth@2.0.3':
|
'@kevisual/auth@2.0.3':
|
||||||
resolution: {integrity: sha512-4xpijaIhlCTr/DlJaV/gmkCQeg45EO1yxWpRvUX+1jCdVbuxSR0wZrF0SD9oybnjmKWMKDNPLsXyduFjMGcItA==}
|
resolution: {integrity: sha512-4xpijaIhlCTr/DlJaV/gmkCQeg45EO1yxWpRvUX+1jCdVbuxSR0wZrF0SD9oybnjmKWMKDNPLsXyduFjMGcItA==}
|
||||||
@@ -716,8 +716,8 @@ packages:
|
|||||||
'@kevisual/router@0.0.80':
|
'@kevisual/router@0.0.80':
|
||||||
resolution: {integrity: sha512-rVwi6Yf411bnNm2x94lMm+s4Csw0Yb7u/aj+VJJ59iouAYhjLuL7Rs1EcARhnQf47cegBJi6zozfGHgLsLHN2w==}
|
resolution: {integrity: sha512-rVwi6Yf411bnNm2x94lMm+s4Csw0Yb7u/aj+VJJ59iouAYhjLuL7Rs1EcARhnQf47cegBJi6zozfGHgLsLHN2w==}
|
||||||
|
|
||||||
'@kevisual/router@0.0.83':
|
'@kevisual/router@0.0.84':
|
||||||
resolution: {integrity: sha512-CVazzM1rXVyvU7QcMQr0/EuqacRNEGalThDDLGQcvKEVHyduJ9yWddn6kezgWFCpNlPKhzSCKkIFuZVixNVxDQ==}
|
resolution: {integrity: sha512-l/TUFuqTJegB/S3FZQRBMUoz0Spvg8EzV3C/kBi/VO9KKCzjqZDVvhZJJbTQh9879CBY6vUy1ajo9WcLYnwbNA==}
|
||||||
|
|
||||||
'@kevisual/types@0.0.12':
|
'@kevisual/types@0.0.12':
|
||||||
resolution: {integrity: sha512-zJXH2dosir3jVrQ6QG4i0+iLQeT9gJ3H+cKXs8ReWboxBSYzUZO78XssVeVrFPsJ33iaAqo4q3DWbSS1dWGn7Q==}
|
resolution: {integrity: sha512-zJXH2dosir3jVrQ6QG4i0+iLQeT9gJ3H+cKXs8ReWboxBSYzUZO78XssVeVrFPsJ33iaAqo4q3DWbSS1dWGn7Q==}
|
||||||
@@ -1182,8 +1182,8 @@ packages:
|
|||||||
buffer@6.0.3:
|
buffer@6.0.3:
|
||||||
resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==}
|
resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==}
|
||||||
|
|
||||||
bullmq@5.69.3:
|
bullmq@5.70.1:
|
||||||
resolution: {integrity: sha512-P9uLsR7fDvejH/1m6uur6j7U9mqY6nNt+XvhlhStOUe7jdwbZoP/c2oWNtE+8ljOlubw4pRUKymtRqkyvloc4A==}
|
resolution: {integrity: sha512-HjfGHfICkAClrFL0Y07qNbWcmiOCv1l+nusupXUjrvTPuDEyPEJ23MP0lUwUs/QEy1a3pWt/P/sCsSZ1RjRK+w==}
|
||||||
|
|
||||||
bun-types@1.3.9:
|
bun-types@1.3.9:
|
||||||
resolution: {integrity: sha512-+UBWWOakIP4Tswh0Bt0QD0alpTY8cb5hvgiYeWCMet9YukHbzuruIEeXC2D7nMJPB12kbh8C7XJykSexEqGKJg==}
|
resolution: {integrity: sha512-+UBWWOakIP4Tswh0Bt0QD0alpTY8cb5hvgiYeWCMet9YukHbzuruIEeXC2D7nMJPB12kbh8C7XJykSexEqGKJg==}
|
||||||
@@ -3128,7 +3128,7 @@ snapshots:
|
|||||||
'@kevisual/permission': 0.0.3
|
'@kevisual/permission': 0.0.3
|
||||||
'@kevisual/query': 0.0.38
|
'@kevisual/query': 0.0.38
|
||||||
|
|
||||||
'@kevisual/api@0.0.57(react-dom@19.2.4(react@19.2.4))(react@19.2.4)':
|
'@kevisual/api@0.0.59(react-dom@19.2.4(react@19.2.4))(react@19.2.4)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@kevisual/context': 0.0.8
|
'@kevisual/context': 0.0.8
|
||||||
'@kevisual/js-filter': 0.0.5
|
'@kevisual/js-filter': 0.0.5
|
||||||
@@ -3227,7 +3227,7 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
es-toolkit: 1.44.0
|
es-toolkit: 1.44.0
|
||||||
|
|
||||||
'@kevisual/router@0.0.83':
|
'@kevisual/router@0.0.84':
|
||||||
dependencies:
|
dependencies:
|
||||||
es-toolkit: 1.44.0
|
es-toolkit: 1.44.0
|
||||||
|
|
||||||
@@ -3845,7 +3845,7 @@ snapshots:
|
|||||||
base64-js: 1.5.1
|
base64-js: 1.5.1
|
||||||
ieee754: 1.2.1
|
ieee754: 1.2.1
|
||||||
|
|
||||||
bullmq@5.69.3:
|
bullmq@5.70.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
cron-parser: 4.9.0
|
cron-parser: 4.9.0
|
||||||
ioredis: 5.9.3
|
ioredis: 5.9.3
|
||||||
|
|||||||
@@ -67,9 +67,11 @@ export class User {
|
|||||||
avatar: string;
|
avatar: string;
|
||||||
tokenUser: any;
|
tokenUser: any;
|
||||||
|
|
||||||
constructor(data: UserSelect) {
|
constructor(data?: UserSelect) {
|
||||||
|
if (data) {
|
||||||
Object.assign(this, data);
|
Object.assign(this, data);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setTokenUser(tokenUser: any) {
|
setTokenUser(tokenUser: any) {
|
||||||
this.tokenUser = tokenUser;
|
this.tokenUser = tokenUser;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ app
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.define(async (ctx) => {
|
.define(async (ctx) => {
|
||||||
const { domain } = ctx.query.data;
|
const { domain } = ctx.args.data;
|
||||||
const domainInfos = await db.select().from(schema.kvAppDomain).where(eq(schema.kvAppDomain.domain, domain)).limit(1);
|
const domainInfos = await db.select().from(schema.kvAppDomain).where(eq(schema.kvAppDomain.domain, domain)).limit(1);
|
||||||
const domainInfo = domainInfos[0];
|
const domainInfo = domainInfos[0];
|
||||||
if (!domainInfo || !domainInfo.appId) {
|
if (!domainInfo || !domainInfo.appId) {
|
||||||
@@ -38,11 +38,20 @@ app
|
|||||||
path: 'app-domain',
|
path: 'app-domain',
|
||||||
key: 'create',
|
key: 'create',
|
||||||
middleware: ['auth'],
|
middleware: ['auth'],
|
||||||
|
description: '创建应用域名绑定',
|
||||||
|
metadata: {
|
||||||
|
args: {
|
||||||
|
data: z.object({
|
||||||
|
domain: z.string().describe('域名'),
|
||||||
|
appId: z.string().describe('应用ID'),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.define(async (ctx) => {
|
.define(async (ctx) => {
|
||||||
const tokenUser = ctx.state.tokenUser;
|
const tokenUser = ctx.state.tokenUser;
|
||||||
const uid = tokenUser.uid;
|
const uid = tokenUser.uid;
|
||||||
const { domain, appId } = ctx.query.data || {};
|
const { domain, appId } = ctx.args.data || {};
|
||||||
if (!domain || !appId) {
|
if (!domain || !appId) {
|
||||||
ctx.throw(400, 'domain and appId are required');
|
ctx.throw(400, 'domain and appId are required');
|
||||||
}
|
}
|
||||||
@@ -58,11 +67,21 @@ app
|
|||||||
path: 'app-domain',
|
path: 'app-domain',
|
||||||
key: 'update',
|
key: 'update',
|
||||||
middleware: ['auth'],
|
middleware: ['auth'],
|
||||||
|
metadata: {
|
||||||
|
args: {
|
||||||
|
data: z.object({
|
||||||
|
id: z.string().optional().describe('域名ID'),
|
||||||
|
domain: z.string().optional().describe('域名'),
|
||||||
|
appId: z.string().optional().describe('应用ID'),
|
||||||
|
status: z.string().describe('状态'),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.define(async (ctx) => {
|
.define(async (ctx) => {
|
||||||
const tokenUser = ctx.state.tokenUser;
|
const tokenUser = ctx.state.tokenUser;
|
||||||
const uid = tokenUser.uid;
|
const uid = tokenUser.uid;
|
||||||
const { id, domain, appId, status } = ctx.query.data || {};
|
const { id, domain, appId, status } = ctx.args.data || {};
|
||||||
if (!domain && !id) {
|
if (!domain && !id) {
|
||||||
ctx.throw(400, 'domain and id are required at least one');
|
ctx.throw(400, 'domain and id are required at least one');
|
||||||
}
|
}
|
||||||
@@ -87,7 +106,7 @@ app
|
|||||||
if (domainInfo.uid !== uid) {
|
if (domainInfo.uid !== uid) {
|
||||||
ctx.throw(403, 'domain must be owned by the user');
|
ctx.throw(403, 'domain must be owned by the user');
|
||||||
}
|
}
|
||||||
if (!AppDomainHelper.checkCanUpdateStatus(domainInfo.status!, status)) {
|
if (!AppDomainHelper.checkCanUpdateStatus(domainInfo.status!, status as any)) {
|
||||||
ctx.throw(400, 'domain status can not be updated');
|
ctx.throw(400, 'domain status can not be updated');
|
||||||
}
|
}
|
||||||
const updateData: any = {};
|
const updateData: any = {};
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { eq, desc, and, like, or } from 'drizzle-orm';
|
import { eq, desc, and, like, or } from 'drizzle-orm';
|
||||||
import { app, db, schema } from '../../app.ts';
|
import { app, db, schema } from '../../app.ts';
|
||||||
import { CustomError } from '@kevisual/router';
|
|
||||||
import { filter } from '@kevisual/js-filter'
|
import { filter } from '@kevisual/js-filter'
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
app
|
app
|
||||||
@@ -77,7 +76,7 @@ app
|
|||||||
const tokenUser = ctx.state.tokenUser;
|
const tokenUser = ctx.state.tokenUser;
|
||||||
const id = ctx.query.id;
|
const id = ctx.query.id;
|
||||||
if (!id) {
|
if (!id) {
|
||||||
throw new CustomError('id is required');
|
ctx.throw(400, 'id is required');
|
||||||
}
|
}
|
||||||
const result = await db
|
const result = await db
|
||||||
.select()
|
.select()
|
||||||
|
|||||||
Reference in New Issue
Block a user