Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
console
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
console
Commits
3dc816e7
Commit
3dc816e7
authored
Aug 26, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add _latest for latest version reference
parent
ac15ab42
Pipeline
#5029
passed with stages
in 1 minute and 21 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
1 deletion
+42
-1
console-api/src/update/update.service.ts
console-api/src/update/update.service.ts
+42
-1
No files found.
console-api/src/update/update.service.ts
View file @
3dc816e7
...
...
@@ -11,6 +11,7 @@ import _ from 'lodash';
import
{
ArchiveFile
}
from
'
../entities/ArchiveFile.entity
'
;
import
*
as
os
from
'
os
'
;
import
moment
from
'
moment
'
;
import
{
AppsJson
}
from
'
../utility/apps-json-type
'
;
@
Injectable
()
export
class
UpdateService
extends
ConsoleLogger
{
...
...
@@ -25,9 +26,49 @@ export class UpdateService extends ConsoleLogger {
}
async
getAppsJson
()
{
return
(
await
this
.
db
.
getRepository
(
App
).
find
({
where
:
{
appData
:
Not
(
IsNull
()),
isDeleted
:
false
},
select
:
[
'
appData
'
]
})).
map
(
const
data
=
(
await
this
.
db
.
getRepository
(
App
).
find
({
where
:
{
appData
:
Not
(
IsNull
()),
isDeleted
:
false
},
select
:
[
'
appData
'
]
})).
map
(
(
a
)
=>
a
.
displayData
);
const
appVersionCacheMap
=
new
Map
<
string
,
string
>
();
for
(
const
_platform
of
Object
.
values
(
AppsJson
.
Platform
))
{
const
platform
=
_platform
as
AppsJson
.
Platform
;
if
(
platform
===
'
generic
'
)
{
continue
;
}
const
depotDto
=
new
DepotDto
();
depotDto
.
locale
=
'
generic
'
;
depotDto
.
arch
=
'
generic
'
;
depotDto
.
platform
=
platform
;
// this.log(platform);
for
(
const
app
of
data
)
{
if
(
app
.
version
&&
app
.
version
[
platform
]
===
'
_latest
'
)
{
// this.log(`Try fetching latest version of ${app.id} ${platform}`);
const
tryCache
=
appVersionCacheMap
.
get
(
app
.
id
);
if
(
tryCache
)
{
app
.
version
[
platform
]
=
tryCache
;
}
const
latestBuild
=
await
this
.
db
.
getRepository
(
Build
)
.
createQueryBuilder
(
'
build
'
)
.
select
([
'
build.version
'
,
'
build.id
'
,
'
depot.platform
'
])
.
innerJoin
(
'
build.depot
'
,
'
depot
'
)
.
where
(
'
depot.appId = :appId
'
,
{
appId
:
app
.
id
})
.
andWhere
(
depotDto
.
getQueryBrackets
())
.
orderBy
(
'
build.id
'
,
'
DESC
'
)
.
take
(
1
)
.
getOne
();
if
(
latestBuild
)
{
const
latestVersion
=
latestBuild
.
version
;
if
(
latestBuild
.
depot
.
platform
===
'
generic
'
)
{
appVersionCacheMap
.
set
(
app
.
id
,
latestVersion
);
}
app
.
version
[
platform
]
=
latestVersion
;
}
}
}
}
return
data
;
}
private
async
getBuild
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment