Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions src/functions/project/file/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import projectService from 'services/project'
import authorize from 'middlewares/authorize'
import config from 'infrastructure/config'

import head from './head'

export default authorize([
config.apps.WEBAPP,
config.apps.JOB_LOOP,
Expand All @@ -16,7 +14,21 @@ export default authorize([
])(resource('FILE')(
async (req) => {
if (req.httpMethod === 'HEAD') {
return await head.logic(req)
const { projectIdentifier, fileIdentifier } = req.pathParameters
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Không nên viết thế này, mà nên sửa code base để có thể import logic của handler khác, như thế sẽ ko bị duplicate code

const result = await projectService.file.head(
projectIdentifier,
decodeURIComponent(fileIdentifier)
)

if (!result) {
throw {
statusCode: NOT_FOUND
}
}

return {
statusCode: OK
}
}

const { projectIdentifier, fileIdentifier } = req.pathParameters
Expand Down