Skip to content

Commit

Permalink
Merge pull request #608 from ELEVATE-Project/issue#1247
Browse files Browse the repository at this point in the history
fix for undefined in get signed url
  • Loading branch information
rakeshSgr authored Feb 19, 2024
2 parents fd701b7 + bf7de8c commit b1a8f01
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/controllers/v1/cloud-services.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = class CloudServices {
try {
const signedUrlResponse = await filesService.getSignedUrl(
req.query.fileName,
req.decodedToken._id,
req.decodedToken.id,
req.query.dynamicPath ? req.query.dynamicPath : ''
)
return signedUrlResponse
Expand Down
4 changes: 2 additions & 2 deletions src/services/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ const utils = require('@generics/utils')
const responses = require('@helpers/responses')

module.exports = class FilesHelper {
static async getSignedUrl(fileName, _id, dynamicPath) {
static async getSignedUrl(fileName, id, dynamicPath) {
try {
let destFilePath
if (dynamicPath != '') {
destFilePath = dynamicPath + '/' + fileName
} else {
destFilePath = `session/${_id}-${new Date().getTime()}-${fileName}`
destFilePath = `session/${id}-${new Date().getTime()}-${fileName}`
}
let response
if (process.env.CLOUD_STORAGE === 'GCP') {
Expand Down
8 changes: 8 additions & 0 deletions src/services/sessions.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,14 @@ module.exports = class SessionsHelper {

// Create session
const data = await sessionQueries.create(bodyData)
if (!data?.id) {
return responses.failureResponse({
message: 'SESSION_CREATION_FAILED',
statusCode: httpStatusCode.bad_request,
responseCode: 'CLIENT_ERROR',
result: res.errors,
})
}
// If menteeIds are provided in the req body enroll them
if (menteeIdsToEnroll.length > 0) {
await this.addMentees(data.id, menteeIdsToEnroll, bodyData.time_zone)
Expand Down

0 comments on commit b1a8f01

Please sign in to comment.