|
@@ -23,6 +23,24 @@ import { MerchantMt } from '@d8d/merchant-module-mt'
|
|
|
import { OrderMt, OrderGoodsMt, OrderRefundMt } from '@d8d/orders-module-mt'
|
|
import { OrderMt, OrderGoodsMt, OrderRefundMt } from '@d8d/orders-module-mt'
|
|
|
import { SupplierMt } from '@d8d/supplier-module-mt'
|
|
import { SupplierMt } from '@d8d/supplier-module-mt'
|
|
|
|
|
|
|
|
|
|
+initializeDataSource([
|
|
|
|
|
+ // 已实现的包实体
|
|
|
|
|
+ UserEntityMt, RoleMt, FileMt,
|
|
|
|
|
+ TenantEntityMt,
|
|
|
|
|
+ AreaEntityMt, PaymentMtEntity,
|
|
|
|
|
+ Advertisement, AdvertisementType,
|
|
|
|
|
+ DeliveryAddressMt,
|
|
|
|
|
+ GoodsMt, GoodsCategoryMt,
|
|
|
|
|
+ MerchantMt,
|
|
|
|
|
+ OrderMt, OrderGoodsMt, OrderRefundMt,
|
|
|
|
|
+ SupplierMt, SystemConfigMt
|
|
|
|
|
+])
|
|
|
|
|
+
|
|
|
|
|
+if(!AppDataSource || !AppDataSource.isInitialized) {
|
|
|
|
|
+ await AppDataSource.initialize();
|
|
|
|
|
+ console.log('数据库初始化完成')
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const app = new Hono();
|
|
const app = new Hono();
|
|
|
const api = new OpenAPIHono<AuthContext>()
|
|
const api = new OpenAPIHono<AuthContext>()
|
|
|
|
|
|
|
@@ -36,22 +54,6 @@ api.use('/api/v1/*', async (_, next) => {
|
|
|
|
|
|
|
|
// 数据库初始化中间件
|
|
// 数据库初始化中间件
|
|
|
api.use('/api/v1/*', async (c, next) => {
|
|
api.use('/api/v1/*', async (c, next) => {
|
|
|
- if(!AppDataSource || !AppDataSource.isInitialized) {
|
|
|
|
|
- initializeDataSource([
|
|
|
|
|
- // 已实现的包实体
|
|
|
|
|
- UserEntityMt, RoleMt, FileMt,
|
|
|
|
|
- TenantEntityMt,
|
|
|
|
|
- AreaEntityMt, PaymentMtEntity,
|
|
|
|
|
- Advertisement, AdvertisementType,
|
|
|
|
|
- DeliveryAddressMt,
|
|
|
|
|
- GoodsMt, GoodsCategoryMt,
|
|
|
|
|
- MerchantMt,
|
|
|
|
|
- OrderMt, OrderGoodsMt, OrderRefundMt,
|
|
|
|
|
- SupplierMt, SystemConfigMt
|
|
|
|
|
- ])
|
|
|
|
|
- await AppDataSource.initialize();
|
|
|
|
|
- console.log('数据库初始化完成')
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
await next();
|
|
await next();
|
|
|
})
|
|
})
|