@@ -3,7 +3,7 @@ import { AppService } from './app.service';
33import { Response } from 'express' ;
44import { AbstractController } from '~/_common/abstracts/abstract.controller' ;
55import { Public } from './_common/decorators/public.decorator' ;
6- import { ApiBearerAuth , ApiOperation , ApiResponse } from '@nestjs/swagger' ;
6+ import { ApiBearerAuth , ApiOperation , ApiQuery , ApiResponse } from '@nestjs/swagger' ;
77
88interface GithubUpdate {
99 name ?: string ;
@@ -34,19 +34,20 @@ export class AppController extends AbstractController {
3434 } ) ;
3535 }
3636
37+ @ApiQuery ( { name : 'current' , required : false } )
3738 @Get ( '/get-update/:project(sesame-orchestrator|sesame-daemon|sesame-app-manager)' )
3839 public async update (
3940 @Res ( ) res : Response ,
40- @Param ( 'project' ) project : string ,
41- @Query ( 'current' ) current : string ,
41+ @Param ( 'project' ) project ? : string ,
42+ @Query ( 'current' ) current ? : string ,
4243 ) : Promise < Response > {
4344 const update = await fetch ( `https://api.github.com/repos/Libertech-FR/${ project } /tags` )
4445 const data : GithubUpdate = await update . json ( )
4546 const lastVersion = data [ 0 ] . name . replace ( / ^ v / , '' )
4647 const pkgInfo = this . appService . getInfo ( )
4748 const currentVersion = current || pkgInfo . version
4849
49- if ( project !== pkgInfo . name ) {
50+ if ( project !== pkgInfo . name || current ) {
5051 if ( ! / [ 0 - 9 ] + \. [ 0 - 9 ] + \. [ 0 - 9 ] + / . test ( current ) ) {
5152 throw new BadRequestException ( 'Invalid version for current parameter' )
5253 }
0 commit comments