Toggle navigation
Toggle navigation
This project
Loading...
Sign in
정민우
/
vps_service
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
정민우
2021-06-11 03:35:20 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9a08b13f5f81923ccb1ed5fa6fe76c7a897d6454
9a08b13f
1 parent
2b87f32b
[Add] container Admin 추가
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
backend/controllers/dockerController.js
backend/controllers/dockerController.js
View file @
9a08b13
...
...
@@ -244,8 +244,47 @@ exports.adminDeleteImage = async (req, res) => {
}
exports
.
adminListContainer
=
async
(
req
,
res
)
=>
{
try
{
let
containers
=
await
Container
.
findAndCountAll
({
order
:
[
[
'createdAt'
,
'desc'
]
]
})
const
result
=
{
count
:
containers
.
count
,
data
:
containers
.
rows
}
return
sendResponse
(
res
,
result
,
200
)
}
catch
(
error
)
{
logging
(
'container'
,
'error'
,
{
code
:
500
,
message
:
error
.
message
},
req
)
return
sendError
(
res
,
500
,
error
.
message
)
}
}
exports
.
adminDeleteContainer
=
async
(
req
,
res
)
=>
{
const
requiredKey
=
[
'id'
]
const
required
=
checkRequiredExist
(
req
.
body
,
requiredKey
)
if
(
required
)
{
logging
(
'container'
,
'error'
,
{
code
:
400
,
message
:
'missingKey:${required}'
},
req
)
return
sendError
(
res
,
400
,
`missingKey:
${
required
}
`
)
}
try
{
const
containerId
=
req
.
body
.
id
let
container
=
await
Image
.
findByPk
(
containerId
)
if
(
!
container
)
{
logging
(
'container'
,
'error'
,
{
code
:
404
,
message
:
'NoContainerFound'
},
req
)
return
sendError
(
res
,
404
,
'NoContainerFound'
)
}
await
Container
.
destroy
({
where
:
{
id
:
container
.
id
}
})
logging
(
'container'
,
'delete'
,
null
,
req
)
return
sendResponse
(
res
,
true
,
201
)
}
catch
(
error
)
{
logging
(
'container'
,
'error'
,
{
code
:
500
,
message
:
error
.
message
},
req
)
return
sendError
(
res
,
500
,
error
.
message
)
}
}
...
...
Please
register
or
login
to post a comment