Merge branch 'backend-docker' into 'master'
[Add] dockerfile Admin 추가 See merge request !11
Showing
2 changed files
with
24 additions
and
9 deletions
... | @@ -170,7 +170,31 @@ exports.adminListDockerfile = async (req, res) => { | ... | @@ -170,7 +170,31 @@ exports.adminListDockerfile = async (req, res) => { |
170 | } | 170 | } |
171 | } | 171 | } |
172 | exports.adminDeleteDockerfile = async (req, res) => { | 172 | exports.adminDeleteDockerfile = async (req, res) => { |
173 | + const requiredKey = ['id'] | ||
174 | + const required = checkRequiredExist(req.body, requiredKey) | ||
175 | + if (required) { | ||
176 | + logging('dockerfile', 'error', { code: 400, message: 'missingKey:${required}' }, req) | ||
177 | + return sendError(res, 400, `missingKey:${required}`) | ||
178 | + } | ||
179 | + try { | ||
180 | + const dockerfileId = req.body.id | ||
181 | + let dockerfile = await Dockerfile.findByPk(dockerfileId) | ||
182 | + if (!dockerfile) { | ||
183 | + logging('dockerfile', 'error', { code: 404, message: 'NoDockerfileFound' }, req) | ||
184 | + return sendError(res, 404, 'NoDockerfileFound') | ||
185 | + } | ||
173 | 186 | ||
187 | + await Dockerfile.destroy({ | ||
188 | + where: { | ||
189 | + id: dockerfile.id | ||
190 | + } | ||
191 | + }) | ||
192 | + logging('dockerfile', 'delete', null, req) | ||
193 | + return sendResponse(res, true, 201) | ||
194 | + } catch (error) { | ||
195 | + logging('dockerfile', 'error', { code: 500, message: error.message }, req) | ||
196 | + return sendError(res, 500, error.message) | ||
197 | + } | ||
174 | } | 198 | } |
175 | exports.adminListImage = async (req, res) => { | 199 | exports.adminListImage = async (req, res) => { |
176 | 200 | ... | ... |
backend/test/dockertest.js
deleted
100644 → 0
-
Please register or login to post a comment