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:39 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
1cf179532906c9f72f4627aadefe65c3bb3fb667
1cf17953
2 parents
5f9b27d7
9a08b13f
Merge branch 'backend-docker' into 'master'
[Add] container Admin 추가 See merge request
!13
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 @
1cf1795
...
...
@@ -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