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:32:44 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
5f9b27d7b31e6f1436663522f2bf22a651f15484
5f9b27d7
2 parents
79d5843b
2b87f32b
Merge branch 'backend-docker' into 'master'
[Add] image Admin 추가 See merge request
!12
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
backend/controllers/dockerController.js
backend/controllers/dockerController.js
View file @
5f9b27d
...
...
@@ -196,12 +196,53 @@ exports.adminDeleteDockerfile = async (req, res) => {
return
sendError
(
res
,
500
,
error
.
message
)
}
}
exports
.
adminListImage
=
async
(
req
,
res
)
=>
{
try
{
let
images
=
await
Image
.
findAndCountAll
({
order
:
[
[
'createdAt'
,
'desc'
]
]
})
const
result
=
{
count
:
images
.
count
,
data
:
images
.
rows
}
return
sendResponse
(
res
,
result
,
200
)
}
catch
(
error
)
{
logging
(
'image'
,
'error'
,
{
code
:
500
,
message
:
error
.
message
},
req
)
return
sendError
(
res
,
500
,
error
.
message
)
}
}
exports
.
adminDeleteImage
=
async
(
req
,
res
)
=>
{
const
requiredKey
=
[
'id'
]
const
required
=
checkRequiredExist
(
req
.
body
,
requiredKey
)
if
(
required
)
{
logging
(
'image'
,
'error'
,
{
code
:
400
,
message
:
'missingKey:${required}'
},
req
)
return
sendError
(
res
,
400
,
`missingKey:
${
required
}
`
)
}
try
{
const
imageId
=
req
.
body
.
id
let
image
=
await
Image
.
findByPk
(
imageId
)
if
(
!
image
)
{
logging
(
'image'
,
'error'
,
{
code
:
404
,
message
:
'NoImageFound'
},
req
)
return
sendError
(
res
,
404
,
'NoImageFound'
)
}
await
Image
.
destroy
({
where
:
{
id
:
image
.
id
}
})
logging
(
'image'
,
'delete'
,
null
,
req
)
return
sendResponse
(
res
,
true
,
201
)
}
catch
(
error
)
{
logging
(
'image'
,
'error'
,
{
code
:
500
,
message
:
error
.
message
},
req
)
return
sendError
(
res
,
500
,
error
.
message
)
}
}
exports
.
adminListContainer
=
async
(
req
,
res
)
=>
{
}
...
...
Please
register
or
login
to post a comment