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
eb9d33d1
Commit
eb9d33d1
authored
Oct 27, 2023
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support simple for get app
parent
6add9e4c
Pipeline
#23854
passed with stages
in 4 minutes and 27 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
console-api/src/app.controller.ts
console-api/src/app.controller.ts
+3
-2
console-api/src/app.service.ts
console-api/src/app.service.ts
+8
-6
No files found.
console-api/src/app.controller.ts
View file @
eb9d33d1
...
...
@@ -36,9 +36,10 @@ export class AppController {
description
:
'
管理员可以查询全部的,其他用户可以查属于自己的
'
,
})
@
ApiQuery
({
name
:
'
id
'
,
description
:
'
app 的 id,没有就是查全部
'
})
@
ApiQuery
({
name
:
'
simple
'
,
description
:
'
只获取 apps.json 的内容
'
})
@
ApiOkResponse
({
type
:
GetAppReturnMessageDto
})
getApp
(@
FetchMyCardUser
()
user
:
MyCardUser
,
@
Query
(
'
id
'
)
id
?:
string
)
{
return
this
.
appService
.
getApp
(
user
,
id
);
getApp
(@
FetchMyCardUser
()
user
:
MyCardUser
,
@
Query
(
'
id
'
)
id
?:
string
,
@
Query
(
'
simple
'
)
simple
?:
string
)
{
return
this
.
appService
.
getApp
(
user
,
id
,
simple
);
}
@
Post
(
'
app
'
)
...
...
console-api/src/app.service.ts
View file @
eb9d33d1
...
...
@@ -81,7 +81,7 @@ export class AppService extends ConsoleLogger {
},
201
);
}
async
getApp
(
user
:
MyCardUser
,
id
?:
string
)
{
async
getApp
(
user
:
MyCardUser
,
id
?:
string
,
simple
?:
string
)
{
if
(
!
user
)
{
throw
new
BlankReturnMessageDto
(
401
,
'
Needs login
'
).
toException
();
}
...
...
@@ -92,11 +92,13 @@ export class AppService extends ConsoleLogger {
if
(
id
)
{
query
.
andWhere
(
'
app.id = :id
'
,
{
id
});
}
if
(
!
simple
)
{
query
.
leftJoinAndSelect
(
'
app.history
'
,
'
history
'
)
.
leftJoinAndSelect
(
'
app.depots
'
,
'
depot
'
)
.
leftJoin
(
'
depot.builds
'
,
'
build
'
)
.
addSelect
([
'
build.id
'
,
'
build.version
'
]);
}
return
new
ReturnMessageDto
(
200
,
'
success
'
,
await
query
.
getMany
());
}
...
...
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