mirror of
				https://github.com/whyour/qinglong.git
				synced 2025-10-31 17:06:07 +08:00 
			
		
		
		
	修复创建系统应用
This commit is contained in:
		
							parent
							
								
									fa79de3f05
								
							
						
					
					
						commit
						3f775a0e6c
					
				|  | @ -24,7 +24,7 @@ export interface AppToken { | ||||||
|   expiration: number; |   expiration: number; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export type AppScope = 'envs' | 'crons' | 'configs' | 'scripts' | 'logs'; | export type AppScope = 'envs' | 'crons' | 'configs' | 'scripts' | 'logs' | 'system'; | ||||||
| 
 | 
 | ||||||
| export interface AppInstance extends Model<App, App>, App {} | export interface AppInstance extends Model<App, App>, App {} | ||||||
| export const AppModel = sequelize.define<AppInstance>('App', { | export const AppModel = sequelize.define<AppInstance>('App', { | ||||||
|  |  | ||||||
|  | @ -159,9 +159,17 @@ export default class OpenService { | ||||||
|     value: string; |     value: string; | ||||||
|     expiration: number; |     expiration: number; | ||||||
|   }> { |   }> { | ||||||
|     const [systemApp] = await AppModel.findOrCreate({ |     let systemApp = ( | ||||||
|       where: { name: 'system', scopes: ['crons', 'system'] }, |       await AppModel.findOne({ | ||||||
|     }); |         where: { name: 'system' }, | ||||||
|  |       }) | ||||||
|  |     )?.get({ plain: true }); | ||||||
|  |     if (!systemApp) { | ||||||
|  |       systemApp = await this.create({ | ||||||
|  |         name: 'system', | ||||||
|  |         scopes: ['crons', 'system'], | ||||||
|  |       } as App); | ||||||
|  |     } | ||||||
|     const { data } = await this.authToken({ |     const { data } = await this.authToken({ | ||||||
|       client_id: systemApp.client_id, |       client_id: systemApp.client_id, | ||||||
|       client_secret: systemApp.client_secret, |       client_secret: systemApp.client_secret, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 whyour
						whyour