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
eaabbdb4
Commit
eaabbdb4
authored
Aug 24, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimize
parent
b224a62c
Pipeline
#4937
failed with stages
in 1 minute and 26 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
console-api/src/update/update.service.ts
console-api/src/update/update.service.ts
+14
-6
No files found.
console-api/src/update/update.service.ts
View file @
eaabbdb4
...
...
@@ -25,7 +25,9 @@ export class UpdateService extends ConsoleLogger {
}
async
getAppsJson
()
{
return
(
await
this
.
db
.
getRepository
(
App
).
find
({
where
:
{
appData
:
Not
(
IsNull
()),
isDeleted
:
false
}
})).
map
((
a
)
=>
a
.
displayData
);
return
(
await
this
.
db
.
getRepository
(
App
).
find
({
where
:
{
appData
:
Not
(
IsNull
()),
isDeleted
:
false
},
select
:
[
'
appData
'
]
})).
map
(
(
a
)
=>
a
.
displayData
);
}
private
async
getBuild
(
...
...
@@ -82,7 +84,7 @@ export class UpdateService extends ConsoleLogger {
}
async
getChecksum
(
id
:
string
,
depotDto
:
DepotDto
,
version
:
string
)
{
const
build
=
await
this
.
getBuild
(
id
,
depotDto
,
version
);
const
build
=
await
this
.
getBuild
(
id
,
depotDto
,
version
,
(
qb
)
=>
qb
.
select
(
'
build.checksum
'
)
);
return
{
files
:
Object
.
entries
(
build
.
checksum
)
// .filter(([name, hash]) => file.length && hash !== null)
...
...
@@ -92,7 +94,7 @@ export class UpdateService extends ConsoleLogger {
async
getFullPackageMetalink
(
id
:
string
,
depotDto
:
DepotDto
,
version
:
string
)
{
const
archives
=
await
this
.
getArchives
(
id
,
depotDto
,
version
,
(
qb
)
=>
qb
.
andWhere
(
'
archive.role = :fullRole
'
,
{
fullRole
:
ArchiveType
.
Full
})
qb
.
select
([
'
archive.hash
'
,
'
archive.path
'
,
'
archive.size
'
]).
andWhere
(
'
archive.role = :fullRole
'
,
{
fullRole
:
ArchiveType
.
Full
})
);
return
{
cdnUrl
:
this
.
cdnUrl
,
...
...
@@ -138,7 +140,12 @@ export class UpdateService extends ConsoleLogger {
}
async
getPartPackageMetalink
(
id
:
string
,
depotDto
:
DepotDto
,
version
:
string
,
requestedFiles
:
string
[])
{
const
build
=
await
this
.
getBuild
(
id
,
depotDto
,
version
,
(
qb
)
=>
qb
.
select
(
'
build.id
'
));
const
build
=
await
this
.
getBuild
(
id
,
depotDto
,
version
,
(
qb
)
=>
qb
.
select
([
'
build.id
'
,
'
archive.id
'
])
.
leftJoin
(
'
build.archives
'
,
'
archive
'
,
'
archive.role = :partRole
'
,
{
partRole
:
ArchiveType
.
Part
})
);
console
.
log
(
build
.
archives
);
//let clock = moment();
//this.log('part 1');
const
tryExactArchiveQuery
=
this
.
db
...
...
@@ -159,7 +166,7 @@ export class UpdateService extends ConsoleLogger {
.
subQuery
()
.
select
(
'
file.path
'
)
.
from
(
ArchiveFile
,
'
file
'
)
.
w
here
(
'
file.archiveId = archive.id
'
)
.
andW
here
(
'
file.archiveId = archive.id
'
)
.
getQuery
()}
)`
,
{
requestedFiles
:
requestedFiles
}
)
...
...
@@ -202,7 +209,8 @@ export class UpdateService extends ConsoleLogger {
.
subQuery
()
.
select
(
'
distinct(file.archiveId)
'
)
.
from
(
ArchiveFile
,
'
file
'
)
.
where
(
'
file.path = any(:requestedFiles)
'
,
{
requestedFiles
:
requestedFiles
})
.
where
(
'
file.archiveId = any(:possibleArchiveIds)
'
,
{
possibleArchiveIds
:
build
.
archives
.
map
((
a
)
=>
a
.
id
)
})
.
andWhere
(
'
file.path = any(:requestedFiles)
'
,
{
requestedFiles
:
requestedFiles
})
.
getQuery
()}
)`
);
...
...
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