This commit is contained in:
熊潇 2025-02-27 02:05:22 +08:00
parent 2b90bbab6f
commit bb571631d6
4 changed files with 14 additions and 8 deletions

View File

@ -52,6 +52,7 @@
"strip-ansi": "^7.1.0", "strip-ansi": "^7.1.0",
"tar": "^7.4.3", "tar": "^7.4.3",
"uuid": "^11.1.0", "uuid": "^11.1.0",
"pm2": "^5.4.3",
"zod": "^3.24.2" "zod": "^3.24.2"
}, },
"devDependencies": { "devDependencies": {
@ -73,7 +74,6 @@
"concurrently": "^9.1.2", "concurrently": "^9.1.2",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"nodemon": "^3.1.9", "nodemon": "^3.1.9",
"pm2": "^5.4.3",
"rimraf": "^6.0.1", "rimraf": "^6.0.1",
"rollup": "^4.34.8", "rollup": "^4.34.8",
"rollup-plugin-copy": "^3.5.0", "rollup-plugin-copy": "^3.5.0",

View File

@ -1,6 +1,6 @@
import { sequelize } from '../modules/sequelize.ts'; import { DataTypes, Model, Sequelize } from 'sequelize';
import { DataTypes, Model } from 'sequelize'; import { useContextKey } from '@kevisual/use-config/context';
const sequelize = useContextKey<Sequelize>('sequelize');
export class Org extends Model { export class Org extends Model {
declare id: string; declare id: string;
declare username: string; declare username: string;
@ -40,3 +40,5 @@ Org.init(
Org.sync({ alter: true, logging: false }).catch((e) => { Org.sync({ alter: true, logging: false }).catch((e) => {
console.error('Org sync', e); console.error('Org sync', e);
}); });
useContextKey('OrgModel', () => Org);

View File

@ -1,13 +1,15 @@
import { useConfig } from '@kevisual/use-config'; import { useConfig } from '@kevisual/use-config';
import { sequelize } from '@/modules/sequelize.ts'; import { DataTypes, Model, Op, Sequelize } from 'sequelize';
import { DataTypes, Model, Op } from 'sequelize';
import { createToken, checkToken } from '@kevisual/auth'; import { createToken, checkToken } from '@kevisual/auth';
import { cryptPwd } from '@kevisual/auth'; import { cryptPwd } from '@kevisual/auth';
import { customRandom, nanoid, customAlphabet } from 'nanoid'; import { customRandom, nanoid, customAlphabet } from 'nanoid';
import { CustomError } from '@kevisual/router'; import { CustomError } from '@kevisual/router';
import { Org } from './org.ts'; import { Org } from './org.ts';
import { redis } from '@/app.ts';
import { useContextKey } from '@kevisual/use-config/context';
import { Redis } from 'ioredis';
export const redis = useContextKey<Redis>('redis');
const sequelize = useContextKey<Sequelize>('sequelize');
const config = useConfig<{ tokenSecret: string }>(); const config = useConfig<{ tokenSecret: string }>();
type UserData = { type UserData = {
@ -281,3 +283,5 @@ export class UserServices extends User {
static initializeUser = initializeUser; static initializeUser = initializeUser;
static createDemoUser = createDemoUser; static createDemoUser = createDemoUser;
} }
useContextKey('UserModel', () => UserServices);

View File

@ -10,7 +10,7 @@
"baseUrl": "./", "baseUrl": "./",
"typeRoots": [ "typeRoots": [
"node_modules/@types", "node_modules/@types",
"node_modules/@kevisual/types" "//node_modules/@kevisual/types"
], ],
"declaration": true, "declaration": true,
"noEmit": false, "noEmit": false,