From c5d6bc0694e2ff6dcf479d09810b53b538d68ad9 Mon Sep 17 00:00:00 2001 From: maslow Date: Tue, 31 Aug 2021 19:56:25 +0800 Subject: [PATCH] feat(system-server): impl application & account apis; --- .vscode/settings.json | 4 +- packages/system-server/http/account.http | 41 +++++++ packages/system-server/http/application.http | 30 +++++ packages/system-server/init/index.js | 104 ++---------------- packages/system-server/src/api/application.ts | 24 ++-- packages/system-server/src/constants/index.ts | 2 +- packages/system-server/src/index.ts | 2 +- .../system-server/src/router/account/edit.ts | 29 +---- .../src/router/account/profile.ts | 16 +-- .../src/router/account/signin.ts | 38 ++----- .../src/router/account/signup.ts | 44 +------- .../src/router/application/create.ts | 49 +++++++++ .../src/router/application/index.ts | 15 ++- .../src/router/application/my.ts | 18 ++- packages/system-server/src/router/common.ts | 16 +++ .../src/router/deploy/create-token.ts | 2 +- .../src/router/deploy/incoming.ts | 2 +- .../system-server/src/{lib => }/utils/hash.ts | 2 +- .../system-server/src/{lib => }/utils/lang.ts | 0 .../src/{lib => }/utils/token.ts | 2 +- 20 files changed, 216 insertions(+), 224 deletions(-) create mode 100644 packages/system-server/http/account.http create mode 100644 packages/system-server/http/application.http create mode 100644 packages/system-server/src/router/application/create.ts create mode 100644 packages/system-server/src/router/common.ts rename packages/system-server/src/{lib => }/utils/hash.ts (89%) rename packages/system-server/src/{lib => }/utils/lang.ts (100%) rename packages/system-server/src/{lib => }/utils/token.ts (96%) diff --git a/.vscode/settings.json b/.vscode/settings.json index de1ca422ba..478da289e3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -56,8 +56,8 @@ "$shared": {}, "test": { "base_url": "http://127.0.0.1:9000", - "sys_admin": "laf-sys", - "sys_password": "laf-sys" + "user": "test", + "passwd": "test" } }, "cSpell.words": [ diff --git a/packages/system-server/http/account.http b/packages/system-server/http/account.http new file mode 100644 index 0000000000..e1f2f3ce96 --- /dev/null +++ b/packages/system-server/http/account.http @@ -0,0 +1,41 @@ + +@token={{login.response.body.$.data.access_token}} + +### 注册 + +POST {{base_url}}/account/signup HTTP/1.1 +Content-Type: application/json + +{ + "username": "{{user}}", + "password": "{{passwd}}" +} + + +### 登陆 +# @name login + +POST {{base_url}}/account/login HTTP/1.1 +Content-Type: application/json + +{ + "username": "{{user}}", + "password": "{{passwd}}" +} + +### 管理员信息 + +GET {{base_url}}/account/profile +Authorization: Bearer {{token}} + + +### 编辑管理员 + +POST {{base_url}}/account/edit HTTP/1.1 +Content-Type: application/json +Authorization: Bearer {{token}} + +{ + "name": "Maslow", + "avatar": "https://work.zhuo-zhuo.com/file/data/23ttprpxmavkkuf6nttc/PHID-FILE-vzv6dyqo3ev2tmngx7mu/logoL)" +} diff --git a/packages/system-server/http/application.http b/packages/system-server/http/application.http new file mode 100644 index 0000000000..ca5375ed75 --- /dev/null +++ b/packages/system-server/http/application.http @@ -0,0 +1,30 @@ + +@token={{login.response.body.$.data.access_token}} + +### Login +# @name login + +POST {{base_url}}/account/login HTTP/1.1 +Content-Type: application/json + +{ + "username": "{{user}}", + "password": "{{passwd}}" +} + + +### Create an application + +POST {{base_url}}/apps/create +Content-Type: application/json +Authorization: Bearer {{token}} + +{ + "name": "test app" +} + + +### Get my applications + +GET {{base_url}}/apps/my +Authorization: Bearer {{token}} diff --git a/packages/system-server/init/index.js b/packages/system-server/init/index.js index 64395ba83e..8021d07a26 100644 --- a/packages/system-server/init/index.js +++ b/packages/system-server/init/index.js @@ -3,13 +3,9 @@ const Config = require('../dist/config').default const { hashPassword } = require('../dist/lib/utils/hash') const assert = require('assert') -const { permissions } = require('./sys-permissions') const { FunctionLoader } = require('./func-loader') const { Constants } = require('../dist/constants') const { DatabaseAgent } = require('../dist/lib/db-agent') -const { publishFunctions } = require('../dist/api/function') -const { publishAccessPolicy } = require('../dist/api/rules') -const { publishTriggers } = require('../dist/api/trigger') const appAdminRules = require('./policies/app-admin.json') const appUserRules = require('./policies/app-user.json') @@ -18,17 +14,8 @@ const sys_accessor = DatabaseAgent.sys_accessor const db = DatabaseAgent.sys_db -const app_accessor = DatabaseAgent.app_accessor - async function main() { await sys_accessor.ready - await app_accessor.ready - - // init permission - await createInitialPermissions() - - // init first role - await createFirstRole() // create first admin await createFirstAdmin() @@ -39,17 +26,7 @@ async function main() { // create built-in functions await createBuiltinFunctions() - // publish policies - await publishAccessPolicy().then(() => console.log('policy deployed')) - - // publish functions - await publishFunctions().then(() => console.log('functions deployed')) - - // publish triggers - await publishTriggers().then(() => console.log('triggers deployed')) - sys_accessor.close() - app_accessor.close() } main() @@ -61,24 +38,23 @@ main() */ async function createFirstAdmin() { try { - const username = Config.SYS_ADMIN - const password = hashPassword(Config.SYS_ADMIN_PASSWORD) + const username = Config.SYS_ADMIN || 'root' + const password = hashPassword(Config.SYS_ADMIN_PASSWORD || 'kissme') - const { total } = await db.collection(Constants.cn.admins).count() + const { total } = await db.collection(Constants.cn.accounts).count() if (total > 0) { console.log('admin already exists') return } - await sys_accessor.db.collection(Constants.cn.admins).createIndex('username', { unique: true }) + await sys_accessor.db.collection(Constants.cn.accounts).createIndex('username', { unique: true }) - const { data } = await db.collection(Constants.cn.roles).get() - const roles = data.map(it => it.name) + const roles = Object.keys(Constants.roles) - const r_add = await db.collection(Constants.cn.admins).add({ + const r_add = await db.collection(Constants.cn.accounts).add({ username, avatar: "https://static.dingtalk.com/media/lALPDe7szaMXyv3NAr3NApw_668_701.png", - name: 'Admin', + name: 'InitAccount', roles, created_at: Date.now(), updated_at: Date.now() @@ -99,72 +75,6 @@ async function createFirstAdmin() { } } -/** - * Create the first role - * @returns - */ -async function createFirstRole() { - try { - - await sys_accessor.db.collection(Constants.cn.roles).createIndex('name', { unique: true }) - - const r_perm = await db.collection(Constants.cn.permissions).get() - assert(r_perm.ok, 'get permissions failed') - - const permissions = r_perm.data.map(it => it.name) - - const r_add = await db.collection(Constants.cn.roles).add({ - name: 'superadmin', - label: 'Super Admin', - description: 'init role', - permissions, - created_at: Date.now(), - updated_at: Date.now() - }) - - assert(r_add.ok, 'add role occurs error') - - return r_add.id - } catch (error) { - if (error.code == 11000) { - return console.log('permissions already exists') - } - - console.error(error.message) - } -} - -/** - * Create initial permissions - * @returns - */ -async function createInitialPermissions() { - - // create unique index in permission collection - await sys_accessor.db.collection(Constants.cn.permissions).createIndex('name', { unique: true }) - - for (const perm of permissions) { - try { - const data = { - ...perm, - created_at: Date.now(), - updated_at: Date.now() - } - await db.collection(Constants.cn.permissions).add(data) - console.log('permissions added: ' + perm.name) - - } catch (error) { - if (error.code == 11000) { - console.log('permissions already exists: ' + perm.name) - continue - } - console.error(error.message) - } - } - - return true -} - /** * Create initial policies * @param {string} name policy name diff --git a/packages/system-server/src/api/application.ts b/packages/system-server/src/api/application.ts index 581ba7830d..4b12d3c975 100644 --- a/packages/system-server/src/api/application.ts +++ b/packages/system-server/src/api/application.ts @@ -1,7 +1,7 @@ /* * @Author: Maslow * @Date: 2021-08-28 22:00:45 - * @LastEditTime: 2021-08-30 17:32:14 + * @LastEditTime: 2021-08-31 15:47:43 * @Description: Application APIs */ @@ -9,6 +9,7 @@ import { Constants } from "../constants" import { DatabaseAgent } from "../lib/db-agent" import * as assert from 'assert' import { MongoAccessor } from "less-api/dist" +import * as crypto from 'crypto' /** * The application structure in db @@ -25,7 +26,7 @@ export interface ApplicationStruct { db_max_pool_size: number server_secret_salt: string file_system_driver?: string - file_system_enable_unauthorized_upload: string + file_system_enable_unauthorized_upload?: string file_system_http_cache_control?: string log_level?: string enable_cloud_function_log?: string @@ -57,16 +58,14 @@ export async function getApplicationById(appid: string) { /** * Get application created by account_id * @param account_id - * @returns + * @returns applications' data array */ export async function getMyApplications(account_id: string) { assert.ok(account_id, 'empty account_id got') const db = DatabaseAgent.sys_db const ret = await db.collection(Constants.cn.applications) - .where({ - 'collaborators.uid': account_id - }) + .where({ created_by: account_id }) .get() assert.ok(ret.ok, `getMyApplications() got error: ${account_id}`) @@ -83,7 +82,9 @@ export async function getMyJoinedApplications(account_id: string) { const db = DatabaseAgent.sys_db const ret = await db.collection(Constants.cn.applications) - .where({ created_by: account_id }) + .where({ + 'collaborators.uid': account_id + }) .get() assert.ok(ret.ok, `getMyApplications() got error: ${account_id}`) @@ -106,4 +107,13 @@ export async function getApplicationDbAccessor(app: ApplicationStruct) { await accessor.init() return accessor +} + +/** + * Generate application secret string + * @returns + */ +export async function generateApplicationSecret() { + const buf = crypto.randomBytes(64) + return buf.toString('base64') } \ No newline at end of file diff --git a/packages/system-server/src/constants/index.ts b/packages/system-server/src/constants/index.ts index 0aa1e27d1a..425230ed4d 100644 --- a/packages/system-server/src/constants/index.ts +++ b/packages/system-server/src/constants/index.ts @@ -5,7 +5,7 @@ * @Description: */ -import { deepFreeze } from "../lib/utils/lang" +import { deepFreeze } from "../utils/lang" import { permissions } from "./permissions" import { roles } from "./roles" diff --git a/packages/system-server/src/index.ts b/packages/system-server/src/index.ts index 9b4b9f1bfd..d85b3b265e 100644 --- a/packages/system-server/src/index.ts +++ b/packages/system-server/src/index.ts @@ -6,7 +6,7 @@ */ import * as express from 'express' -import { parseToken, splitBearerToken } from './lib/utils/token' +import { parseToken, splitBearerToken } from './utils/token' import { v4 as uuidv4 } from 'uuid' import Config from './config' import { router } from './router/index' diff --git a/packages/system-server/src/router/account/edit.ts b/packages/system-server/src/router/account/edit.ts index 6717ad78f5..ad6429877a 100644 --- a/packages/system-server/src/router/account/edit.ts +++ b/packages/system-server/src/router/account/edit.ts @@ -1,12 +1,11 @@ /* * @Author: Maslow * @Date: 2021-07-30 10:30:29 - * @LastEditTime: 2021-08-28 22:53:24 + * @LastEditTime: 2021-08-31 15:35:11 * @Description: */ import { Request, Response } from 'express' -import { hashPassword } from '../../lib/utils/hash' import { DatabaseAgent } from '../../lib/db-agent' import { Constants } from '../../constants' @@ -19,10 +18,9 @@ export async function handleEdit(req: Request, res: Response) { const db = DatabaseAgent.sys_db // check if params valid - const { password, avatar, name, roles } = req.body - if (!uid) { - return res.status(401) - } + const { avatar, name } = req.body + if (!uid) + return res.status(401).send() // check if uid valid const { data: account } = await db.collection(Constants.cn.accounts) @@ -33,25 +31,11 @@ export async function handleEdit(req: Request, res: Response) { return res.status(422).send('account not found') } - // check if roles are valid - const { total: valid_count } = await db.collection(Constants.cn.roles) - .where({ name: db.command.in(roles) }) - .count() - - if (valid_count !== roles.length) { - return res.status(422).send('invalid roles') - } - // update account const data = { updated_at: Date.now() } - // update password if provided - if (password) { - data['password'] = hashPassword(password) - } - // update avatar if provided if (avatar && avatar != account.avatar) { data['avatar'] = avatar @@ -62,11 +46,6 @@ export async function handleEdit(req: Request, res: Response) { data['name'] = name } - // update roles if provided - if (roles) { - data['roles'] = roles - } - const r = await db.collection(Constants.cn.accounts) .where({ _id: uid }) .update(data) diff --git a/packages/system-server/src/router/account/profile.ts b/packages/system-server/src/router/account/profile.ts index 168d2b863e..519913c15c 100644 --- a/packages/system-server/src/router/account/profile.ts +++ b/packages/system-server/src/router/account/profile.ts @@ -1,12 +1,11 @@ /* * @Author: Maslow * @Date: 2021-07-30 10:30:29 - * @LastEditTime: 2021-08-28 22:52:21 + * @LastEditTime: 2021-08-31 15:35:22 * @Description: */ import { Request, Response } from 'express' -import { getPermissionsByAccountId } from '../../api/permission' import { DatabaseAgent } from '../../lib/db-agent' import { Constants } from '../../constants' @@ -15,9 +14,8 @@ import { Constants } from '../../constants' */ export async function handleProfile(req: Request, res: Response) { const uid = req['auth']?.uid - if (!uid) { - return res.status(401) - } + if (!uid) + return res.status(401).send() const db = DatabaseAgent.sys_db @@ -29,13 +27,9 @@ export async function handleProfile(req: Request, res: Response) { return res.status(422).send('account not found') } - const { permissions } = await getPermissionsByAccountId(account._id) - + delete account.password return res.send({ code: 0, - data: { - ...account, - permissions - } + data: account }) } \ No newline at end of file diff --git a/packages/system-server/src/router/account/signin.ts b/packages/system-server/src/router/account/signin.ts index e335b6ab61..c13b6f5749 100644 --- a/packages/system-server/src/router/account/signin.ts +++ b/packages/system-server/src/router/account/signin.ts @@ -1,52 +1,34 @@ /* * @Author: Maslow * @Date: 2021-07-30 10:30:29 - * @LastEditTime: 2021-08-30 15:25:39 + * @LastEditTime: 2021-08-31 17:44:11 * @Description: */ import { Request, Response } from 'express' -import { getToken } from '../../lib/utils/token' -import { hashPassword } from '../../lib/utils/hash' +import { getToken } from '../../utils/token' +import { hashPassword } from '../../utils/hash' import { DatabaseAgent } from '../../lib/db-agent' import Config from '../../config' import { Constants } from '../../constants' -import * as assert from 'assert' /** * The handler of sign in */ export async function handleSignIn(req: Request, res: Response) { const { username, password } = req.body - - const login_failed_error = { - code: 1, - error: 'invalid username or password' - } - if (!username || !password) { - return res.send(login_failed_error) + return res.send({ error: 'username and password are required' }) } - const db = DatabaseAgent.sys_db - const ret = await db.collection(Constants.cn.accounts) - .withOne({ - query: db - .collection(Constants.cn.password) - .where({ password: hashPassword(password), type: 'login' }), - localField: '_id', - foreignField: 'uid' - }) - .where({ username }) - .merge({ intersection: true }) - assert.ok(ret.ok) + const db = DatabaseAgent.sys_db + const { data: account } = await db.collection(Constants.cn.accounts) + .where({ username, password: hashPassword(password) }) + .getOne() - if (!ret.data.length) { - return res.send(login_failed_error) + if (!account) { + return res.send({ error: 'invalid username or password' }) } - - const account = ret.data[0] - const expire = Math.floor(Date.now() / 1000) + 60 * 60 * Config.TOKEN_EXPIRED_TIME const payload = { uid: account._id, diff --git a/packages/system-server/src/router/account/signup.ts b/packages/system-server/src/router/account/signup.ts index 0f31d2ced4..668948fbda 100644 --- a/packages/system-server/src/router/account/signup.ts +++ b/packages/system-server/src/router/account/signup.ts @@ -1,12 +1,12 @@ /* * @Author: Maslow * @Date: 2021-07-30 10:30:29 - * @LastEditTime: 2021-08-28 23:00:50 + * @LastEditTime: 2021-08-31 14:37:26 * @Description: */ import { Request, Response } from 'express' -import { hashPassword } from '../../lib/utils/hash' +import { hashPassword } from '../../utils/hash' import { DatabaseAgent } from '../../lib/db-agent' import { Constants } from '../../constants' @@ -18,53 +18,22 @@ export async function handleSignUp(req: Request, res: Response) { const db = DatabaseAgent.sys_db - const { username, password, avatar, name, roles } = req.body + const { username, password } = req.body if (!username || !password) { - return res.send({ - code: 1, - error: 'username or password cannot be empty' - }) + return res.send({ error: 'username or password cannot be empty' }) } // check if account exists const { total } = await db.collection(Constants.cn.accounts).where({ username }).count() if (total > 0) { - return res.send({ - code: 1, - error: 'account already exists' - }) - } - - // check if roles are valid - const { total: valid_count } = await db.collection(Constants.cn.roles) - .where({ - name: db.command.in(roles) - }).count() - - if (valid_count !== roles.length) { - return res.send({ - code: 1, - error: 'invalid roles' - }) + return res.send({ error: 'account already exists' }) } - // add admin + // add account const r = await db.collection(Constants.cn.accounts) .add({ username, - name: name ?? null, - avatar: avatar ?? null, - roles: roles ?? [], - created_at: Date.now(), - updated_at: Date.now() - }) - - // add admin password - await db.collection(Constants.cn.password) - .add({ - uid: r.id, password: hashPassword(password), - type: 'login', created_at: Date.now(), updated_at: Date.now() }) @@ -72,7 +41,6 @@ export async function handleSignUp(req: Request, res: Response) { return res.send({ code: 0, data: { - ...r, uid: r.id } }) diff --git a/packages/system-server/src/router/application/create.ts b/packages/system-server/src/router/application/create.ts new file mode 100644 index 0000000000..4ad5aaa881 --- /dev/null +++ b/packages/system-server/src/router/application/create.ts @@ -0,0 +1,49 @@ +/* + * @Author: Maslow + * @Date: 2021-08-31 15:00:04 + * @LastEditTime: 2021-08-31 15:46:15 + * @Description: + */ + +import { Request, Response } from 'express' +import { ApplicationStruct, generateApplicationSecret } from '../../api/application' +import { Constants } from '../../constants' +import { DatabaseAgent } from '../../lib/db-agent' + +/** + * The handler of creating application + */ +export async function handleCreateApplication(req: Request, res: Response) { + const uid = req['auth']?.uid + if (!uid) + return res.status(401).send() + + const app_name = req.body?.name ?? 'default' + + const db = DatabaseAgent.sys_db + + const app_secret = await generateApplicationSecret() + const now = Date.now() + const data: ApplicationStruct = { + name: app_name, + created_by: uid, + app_secret: app_secret, + status: 'created', + collaborators: [], + config: { + db_name: null, + db_uri: null, + db_max_pool_size: 10, + server_secret_salt: app_secret, + }, + created_at: now, + updated_at: now + } + + const ret = await db.collection(Constants.cn.applications) + .add(data) + + return res.send({ + data: ret + }) +} \ No newline at end of file diff --git a/packages/system-server/src/router/application/index.ts b/packages/system-server/src/router/application/index.ts index 5566e88139..7f49ef3d5b 100644 --- a/packages/system-server/src/router/application/index.ts +++ b/packages/system-server/src/router/application/index.ts @@ -1,35 +1,38 @@ /* * @Author: Maslow * @Date: 2021-08-29 11:35:11 - * @LastEditTime: 2021-08-30 17:05:02 + * @LastEditTime: 2021-08-31 15:56:38 * @Description: */ import { Router } from 'express' +import { handleNotImplemented } from '../common' +import { handleCreateApplication } from './create' +import { handleMyApplications } from './my' export const ApplicationRouter = Router() /** * Get my applications */ -ApplicationRouter.get('/my') +ApplicationRouter.get('/my', handleMyApplications) /** * Create an application */ -ApplicationRouter.post('/') +ApplicationRouter.post('/create', handleCreateApplication) /** * Update an application by appid */ -ApplicationRouter.post('/:appid') +ApplicationRouter.post('/:appid', handleNotImplemented) /** * Remove an application by appid */ -ApplicationRouter.delete('/:appid') +ApplicationRouter.delete('/:appid', handleNotImplemented) /** * Invite an collaborator into application */ -ApplicationRouter.post('/:appid/invite') \ No newline at end of file +ApplicationRouter.post('/:appid/invite', handleNotImplemented) \ No newline at end of file diff --git a/packages/system-server/src/router/application/my.ts b/packages/system-server/src/router/application/my.ts index e41fa50ffc..57fb6a2ddd 100644 --- a/packages/system-server/src/router/application/my.ts +++ b/packages/system-server/src/router/application/my.ts @@ -1,18 +1,28 @@ /* * @Author: Maslow * @Date: 2021-08-30 15:22:34 - * @LastEditTime: 2021-08-30 15:24:23 + * @LastEditTime: 2021-08-31 15:44:33 * @Description: */ import { Request, Response } from 'express' +import { getMyApplications, getMyJoinedApplications } from '../../api/application' /** * The handler of getting profile */ export async function handleMyApplications(req: Request, res: Response) { const uid = req['auth']?.uid - if (!uid) { - return res.status(401) - } + if (!uid) + return res.status(401).send() + + const created = await getMyApplications(uid) + const joined = await getMyJoinedApplications(uid) + + return res.send({ + data: { + created, + joined + } + }) } \ No newline at end of file diff --git a/packages/system-server/src/router/common.ts b/packages/system-server/src/router/common.ts new file mode 100644 index 0000000000..655c6807f8 --- /dev/null +++ b/packages/system-server/src/router/common.ts @@ -0,0 +1,16 @@ +/* + * @Author: Maslow + * @Date: 2021-08-31 15:53:31 + * @LastEditTime: 2021-08-31 15:55:55 + * @Description: + */ + + +import { Request, Response } from 'express' + +/** + * The handler of not implemented + */ +export async function handleNotImplemented(_req: Request, res: Response) { + return res.status(501).send('Not Implemented') +} \ No newline at end of file diff --git a/packages/system-server/src/router/deploy/create-token.ts b/packages/system-server/src/router/deploy/create-token.ts index 79fd2429a3..f31ffc1daf 100644 --- a/packages/system-server/src/router/deploy/create-token.ts +++ b/packages/system-server/src/router/deploy/create-token.ts @@ -7,7 +7,7 @@ import { Request, Response } from 'express' import { checkPermission } from '../../api/permission' -import { getToken } from '../../lib/utils/token' +import { getToken } from '../../utils/token' import { Constants } from '../../constants' import { getApplicationById } from '../../api/application' diff --git a/packages/system-server/src/router/deploy/incoming.ts b/packages/system-server/src/router/deploy/incoming.ts index 398ba6025c..ff4052de9e 100644 --- a/packages/system-server/src/router/deploy/incoming.ts +++ b/packages/system-server/src/router/deploy/incoming.ts @@ -10,7 +10,7 @@ import { Constants } from '../../constants' import { getApplicationById } from '../../api/application' import { DatabaseAgent } from '../../lib/db-agent' import { logger } from '../../lib/logger' -import { parseToken } from '../../lib/utils/token' +import { parseToken } from '../../utils/token' /** diff --git a/packages/system-server/src/lib/utils/hash.ts b/packages/system-server/src/utils/hash.ts similarity index 89% rename from packages/system-server/src/lib/utils/hash.ts rename to packages/system-server/src/utils/hash.ts index b51cd381c0..e7b4c04276 100644 --- a/packages/system-server/src/lib/utils/hash.ts +++ b/packages/system-server/src/utils/hash.ts @@ -1,7 +1,7 @@ /* * @Author: Maslow * @Date: 2021-07-30 10:30:29 - * @LastEditTime: 2021-08-17 16:46:01 + * @LastEditTime: 2021-08-31 15:06:33 * @Description: */ diff --git a/packages/system-server/src/lib/utils/lang.ts b/packages/system-server/src/utils/lang.ts similarity index 100% rename from packages/system-server/src/lib/utils/lang.ts rename to packages/system-server/src/utils/lang.ts diff --git a/packages/system-server/src/lib/utils/token.ts b/packages/system-server/src/utils/token.ts similarity index 96% rename from packages/system-server/src/lib/utils/token.ts rename to packages/system-server/src/utils/token.ts index e35f0d56b8..50d47fd2c7 100644 --- a/packages/system-server/src/lib/utils/token.ts +++ b/packages/system-server/src/utils/token.ts @@ -5,7 +5,7 @@ * @Description: */ -import Config from '../../config' +import Config from '../config' import * as jwt from 'jsonwebtoken' const DEFAULT_SALT = Config.SYS_SERVER_SECRET_SALT