From 5d27e3909f6d6346cda1ead4a6c0cf6e65636a6d Mon Sep 17 00:00:00 2001 From: Yogini Tayade Date: Fri, 10 Jan 2025 17:09:39 +0530 Subject: [PATCH] assigned points to subject lesson assessment completed --- .../hasura/altLessonTracking.adapter.ts | 273 +++++++++++------- .../hasura/altProgramAssociation.adapter.ts | 213 +++++++------- 2 files changed, 282 insertions(+), 204 deletions(-) diff --git a/src/adapters/hasura/altLessonTracking.adapter.ts b/src/adapters/hasura/altLessonTracking.adapter.ts index ceb46d4..cb86de0 100644 --- a/src/adapters/hasura/altLessonTracking.adapter.ts +++ b/src/adapters/hasura/altLessonTracking.adapter.ts @@ -970,7 +970,6 @@ export class ALTLessonTrackingService { break; } } - console.log("questionIdFlag->>>>>>>>>>>>.", questionIdFlag, courseId); if (!courseId) { return response.status(422).json( @@ -1042,52 +1041,67 @@ export class ALTLessonTrackingService { // false // ); } - //ASSIGNING REWARD POINTS FOR ASSESSMENT OR LESSON COMPLETION + //ASSIGNING REWARD POINTS FOR ASSESSMENT OR LESSON COMPLETION OR SUBJECT COMPLETION let assignRewardPoints; //if the current do_id is the questionSetId if (!questionIdFlag) { assignRewardPoints = await this.altProgramAssociationService.addUserPoints(request, { identifier: "lesson_completion", - description: "Student has completed lesson and earned", // Points will be added automatically + description: "Student has completed lesson and earned", + earning_context: { + contentId: altLessonTrackingDto.lessonId, + programId: altLessonTrackingDto.programId, + subject: subject, + }, }); } else { //assign points for the first attempt of completion assignRewardPoints = await this.altProgramAssociationService.addUserPoints(request, { identifier: "assesment_completion", - description: "Student has completed assessment and earned", // Points will be added automatically + description: "Student has completed assessment and earned", + earning_context: { + contentId: altLessonTrackingDto.lessonId, + programId: altLessonTrackingDto.programId, + subject: subject, + }, }); } + /* - CHECK IF THE EVERY CONTENT OF THE RULES OBJECT HAS BEEN COMPLETED + CHECK IF EVERY CONTENT OF THE RULES OBJECT HAS BEEN COMPLETED IF ALL CONTENT(LESSON AND QUESTION SET) HAS BEEN WATCHED -> ASSIGN SUBJECT COMPLETION POINTS FOR THE FIRST ATTEMPT ONLY */ const assignSubjectPoints = await this.checkContentCompletion( request, programRules, - altLessonTrackingDto.userId, altLessonTrackingDto.programId, - - ); - console.log( - "assignSubjectPoints->>>>>>>>>>>>>", - assignSubjectPoints + subject ); - - const rewardPoints = { - user_id: assignRewardPoints.data?.insert_UserPoints_one?.user_id, - points: assignRewardPoints.data?.insert_UserPoints_one?.points, - description: - assignRewardPoints.data?.insert_UserPoints_one?.description, - }; + if (assignSubjectPoints) { + assignRewardPoints = + await this.altProgramAssociationService.addUserPoints(request, { + identifier: "subject_completion", + description: "Student has completed subject and has earned", + earning_context: { + programId: altLessonTrackingDto.programId, + subject: subject, + }, + }); + } + const rewardPoints = assignSubjectPoints + ? { + subjectCompletionPoints: assignSubjectPoints, + contentCompletionPoints: assignRewardPoints, + } + : assignRewardPoints; // Log progress tracking after insertion const loggedAttempt = await this.logLessonAttemptProgressTracking( request, altLessonTrackingDto, lessonProgressId ); - return response.status(200).json({ lessonTrack: lessonTrack, assignRewardPoints: rewardPoints, @@ -1146,51 +1160,70 @@ export class ALTLessonTrackingService { } //ASSIGNING REWARD POINTS FOR ASSESSMENT OR LESSON COMPLETION let assignRewardPoints; - //if content is a questionSetId + //if content is a lesson if (!questionIdFlag) { assignRewardPoints = await this.altProgramAssociationService.addUserPoints( request, { identifier: "lesson_completion", - description: "Student has completed lesson and earned", // Points will be added automatically + description: "Student has completed lesson and earned", + earning_context: { + contentId: altLessonTrackingDto.lessonId, + programId: altLessonTrackingDto.programId, + subject: subject, + }, } ); } else { - //if content is a lesson + //if content is a assessment assignRewardPoints = await this.altProgramAssociationService.addUserPoints( request, { identifier: "assesment_completion", description: - "Student has completed assessment and earned", // Points will be added automatically + "Student has completed assessment and earned", + earning_context: { + contentId: altLessonTrackingDto.lessonId, + programId: altLessonTrackingDto.programId, + subject: subject, + }, } ); } + /* - CHECK IF THE EVERY CONTENT OF THE RULES OBJECT HAS BEEN MATCHED + CHECK IF EVERY CONTENT OF THE RULES OBJECT HAS BEEN MATCHED IF ALL CONTENT(LESSON AND QUESTION SET) HAS BEEN WATCHED -> ASSIGN SUBJECT COMPLETION POINTS FOR THE FIRST ATTEMPT ONLY */ const assignSubjectPoints = await this.checkContentCompletion( request, programRules, - altLessonTrackingDto.userId, altLessonTrackingDto.programId, - - ); - console.log( - "assignSubjectPoints->>>>>>>>>>>>>", - assignSubjectPoints + subject ); - const rewardPoints = { - user_id: - assignRewardPoints.data?.insert_UserPoints_one?.user_id, - points: assignRewardPoints.data?.insert_UserPoints_one?.points, - description: - assignRewardPoints.data?.insert_UserPoints_one?.description, - }; - + if (assignSubjectPoints) { + assignRewardPoints = + await this.altProgramAssociationService.addUserPoints( + request, + { + identifier: "subject_completion", + description: + "Student has completed subject and has earned", + earning_context: { + programId: altLessonTrackingDto.programId, + subject: subject, + }, + } + ); + } + const rewardPoints = assignSubjectPoints + ? { + subjectCompletionPoints: assignSubjectPoints, + contentCompletionPoints: assignRewardPoints, + } + : assignRewardPoints; // Log progress tracking after insertion const loggedAttempt = await this.logLessonAttemptProgressTracking( request, @@ -1313,10 +1346,10 @@ export class ALTLessonTrackingService { url: `${currentUrl}/api/course/v1/hierarchy/${altLessonTrackingDto.courseId?.courseId}?orgdetails=orgName,email&licenseDetails=name,description,url`, }; - // console.log("axiosherer-->>>", config.url); + // console.log("axiosherer-->>>", config.url); const courseHierarchy = await this.axios(config); const data = courseHierarchy?.data.result.content; - // console.log("axiosData-->>", data); + // console.log("axiosData-->>", data); let moduleId = null; @@ -1428,85 +1461,129 @@ export class ALTLessonTrackingService { // } // Add this function to check content completion using counts - public async checkContentCompletion( request, programRules, - userId, - programId - ) { - // Get unique content IDs from rules using Set for deduplication - const allContentIds = [ - ...new Set( - programRules.prog.flatMap((rule) => - [rule.contentId, rule.lesson_questionset].filter(Boolean) - ) - ), - ]; - - // Query to get completed content count - const completionQuery = { - query: ` - query MyQuery($userId: uuid, $programId: uuid, $contentIds: [String!]) { - LessonProgressTracking_aggregate( - where: { - userId: {_eq: $userId}, - programId: {_eq: $programId}, - lessonId: {_in: $contentIds}, - status: {_eq: "completed"} + programId, + subject + ): Promise { + try { + // Decode userId from request headers + const decoded: any = jwt_decode(request.headers.authorization); + const userId = + decoded["https://hasura.io/jwt/claims"]["x-hasura-user-id"]; + + // Check if the same userId, programId, and subject already exist in UserPoints table + const checkExistingPointsQuery = { + query: ` + query CheckExistingPoints($userId: uuid!, $programId: uuid!, $subject: String!) { + UserPoints( + where: { + user_id: { _eq: $userId }, + identifier: { _eq: "subject_completion" }, + earning_context: { + _contains: { + programId: $programId, + subject: $subject + } + } + } + ) { + user_id + points + earning_context } - ) { - aggregate { + } + `, + variables: { + userId: userId, + programId: programId, + subject: subject, + }, + }; + const config = { + method: "post", + url: process.env.ALTHASURA, + headers: { + Authorization: request.headers.authorization, + "Content-Type": "application/json", + }, + data: checkExistingPointsQuery, + }; + const existingPointsResponse = await this.axios(config); + + if (existingPointsResponse.data.data.UserPoints.length > 0) { + console.log("Points already assigned for this user and program"); + return false; + } + // Extract both contentIds and lesson_questionset IDs from programRules.prog + const lessonIdsToCheck = programRules.prog + .flatMap((rule) => [rule.contentId, rule.lesson_questionset]) + .filter(Boolean); // Remove any null/undefined values + + if (lessonIdsToCheck.length === 0) { + return false; + } + + // Query to check completed lessons + const completedLessonsQuery = { + query: ` + query GetCompletedLessons($userId: uuid!, $lessonIds: [String!]!, $programId: uuid!) { + LessonProgressTracking_aggregate( + where: { + userId: { _eq: $userId }, + lessonId: { _in: $lessonIds }, + status: { _eq: completed }, + programId: { _eq: $programId } + } + ) { + aggregate{ count + } } } - } - `, - variables: { - contentIds: allContentIds, - userId: userId, - programId: programId, - }, - }; + `, + variables: { + userId: userId, + lessonIds: lessonIdsToCheck, + programId: programId, + }, + }; - try { - const response = await this.axios({ + const configData = { method: "post", url: process.env.ALTHASURA, headers: { Authorization: request.headers.authorization, "Content-Type": "application/json", }, - data: completionQuery, - }); - - console.log(JSON.stringify(response.data)); - - const completedCount = response.data.LessonProgressTracking_aggregate.aggregate.count; - const totalContent = allContentIds.length; + data: completedLessonsQuery, + }; - console.log({ - totalContent, - completedCount, - allContentIds - }); + const response = await this.axios(configData); - // Return true only if all content is completed - const isComplete = completedCount === totalContent; + if (response?.data?.errors) { + console.log(response?.data?.errors); - if (isComplete) { - // If all content is completed, assign subject completion points - await this.altProgramAssociationService.addUserPoints(request, { - identifier: "subject_completion", - description: "Student has completed all content in subject and earned" - }); + return false; } - return isComplete; + + // Compare the number of completed lessons with the total required lessons + const completedLessonsCount = + response.data.data.LessonProgressTracking_aggregate.aggregate.count; + const requiredLessonsCount = lessonIdsToCheck.length; + console.log( + "completedLessonsCount === requiredLessonsCount->>>>>>.", + completedLessonsCount, + requiredLessonsCount + ); + + return completedLessonsCount === requiredLessonsCount; } catch (error) { - console.error("Error checking content completion:", error); + console.error("Error checking lesson completion:", error); throw new ErrorResponse({ errorCode: "500", - errorMessage: "Failed to check content completion status", + errorMessage: "Failed to check lesson completion status", }); } } diff --git a/src/adapters/hasura/altProgramAssociation.adapter.ts b/src/adapters/hasura/altProgramAssociation.adapter.ts index bc0b22c..ee3ca20 100644 --- a/src/adapters/hasura/altProgramAssociation.adapter.ts +++ b/src/adapters/hasura/altProgramAssociation.adapter.ts @@ -586,20 +586,20 @@ export class ALTProgramAssociationService { criteria: item.criteria, contentSource: item.contentSource, lesson_questionset: item.lesson_questionset, - thumbnailUrl: item.thumbnailUrl + thumbnailUrl: item.thumbnailUrl, }); }); } else { return new ErrorResponse({ errorCode: "500", errorMessage: `Invalid 'prog' format for programId: ${rule.programId}`, - }) + }); } } else { return new ErrorResponse({ errorCode: "500", errorMessage: `Missing 'rules' for programId: ${rule.programId}`, - }) + }); } }); const pageNumber = parseInt(body.pageNumber, 10) || 1; @@ -669,7 +669,6 @@ export class ALTProgramAssociationService { // } - // async likeContent(request, data: { // programId: string; // subject: string; @@ -713,8 +712,6 @@ export class ALTProgramAssociationService { // }, // }; - - // console.log('GraphQL Mutation:', graphqlMutation.query); // const config_data = { @@ -755,13 +752,15 @@ export class ALTProgramAssociationService { // } // Like content - async likeContent(request, data: { - programId: string; - subject: string; - contentId: string; - like: boolean; - }) { - + async likeContent( + request, + data: { + programId: string; + subject: string; + contentId: string; + like: boolean; + } + ) { const decoded: any = jwt_decode(request.headers.authorization); const altUserId = decoded["https://hasura.io/jwt/claims"]["x-hasura-user-id"]; @@ -792,11 +791,11 @@ export class ALTProgramAssociationService { }; const config_data = { - method: 'post', + method: "post", url: process.env.ALTHASURA, headers: { Authorization: request.headers.authorization, - 'Content-Type': 'application/json', + "Content-Type": "application/json", }, data: checkGraphQLQuery, }; @@ -804,13 +803,13 @@ export class ALTProgramAssociationService { try { // Check if the like entry already exists const checkResponse = await this.axios(config_data); - console.log("checkResponse", checkResponse.data.data) + console.log("checkResponse", checkResponse.data.data); const existingLike = checkResponse?.data?.data?.GlaLikedContents[0]; - console.log("existingLike", existingLike) + console.log("existingLike", existingLike); if (existingLike) { // If entry exists, update the like status - console.log("entry exists") + console.log("entry exists"); const updateGraphQLQuery = { query: ` mutation UpdateLike($contentId: String!, $like: Boolean!, $programId: String!, $subject: String!, $userId: String!) { @@ -850,12 +849,12 @@ export class ALTProgramAssociationService { return new SuccessResponse({ statusCode: 200, - message: 'Content like status updated successfully.', + message: "Content like status updated successfully.", data: updateResponse.data.data, }); } else { // If no entry exists, insert a new one - console.log("no entry exists") + console.log("no entry exists"); const insertGraphQLQuery = { query: ` mutation InsertLike($contentId: String!, $like: Boolean!, $programId: String!, $subject: String!, $userId: String!) { @@ -893,26 +892,27 @@ export class ALTProgramAssociationService { return new SuccessResponse({ statusCode: 200, - message: 'Content like status inserted successfully.', + message: "Content like status inserted successfully.", data: insertResponse.data.data, }); } - } catch (error) { - console.error('Axios Error:', error.message); + console.error("Axios Error:", error.message); throw new ErrorResponse({ - errorCode: 'AXIOS_ERROR', - errorMessage: 'Failed to execute the GraphQL mutation.', + errorCode: "AXIOS_ERROR", + errorMessage: "Failed to execute the GraphQL mutation.", }); } } - async isContentLike(request, data: { - programId: string; - subject: string; - contentId: string; - }) { - + async isContentLike( + request, + data: { + programId: string; + subject: string; + contentId: string; + } + ) { const decoded: any = jwt_decode(request.headers.authorization); const altUserId = decoded["https://hasura.io/jwt/claims"]["x-hasura-user-id"]; @@ -940,16 +940,16 @@ export class ALTProgramAssociationService { variables: { contentId: data.contentId, programId: data.programId, - subject: data.subject + subject: data.subject, }, }; const config_data = { - method: 'post', + method: "post", url: process.env.ALTHASURA, headers: { Authorization: request.headers.authorization, - 'Content-Type': 'application/json', + "Content-Type": "application/json", }, data: checkGraphQLQuery, }; @@ -957,48 +957,47 @@ export class ALTProgramAssociationService { try { // Check if the like entry already exists const checkResponse = await this.axios(config_data); - console.log("checkResponse", checkResponse.data) + console.log("checkResponse", checkResponse.data); const existingLike = checkResponse?.data?.data?.GlaLikedContents[0]; - console.log("existingLike", existingLike) + console.log("existingLike", existingLike); if (existingLike) { // If entry exists, update the like status - return new SuccessResponse({ statusCode: 200, - message: 'Content fetched successfully.', + message: "Content fetched successfully.", data: checkResponse?.data?.data?.GlaLikedContents, }); } else { // If no entry exists, insert a new one - console.log("no entry exists") - + console.log("no entry exists"); return new SuccessResponse({ statusCode: 200, - message: 'Content not exists.', + message: "Content not exists.", data: [], }); } - } catch (error) { - console.error('Axios Error:', error.message); + console.error("Axios Error:", error.message); throw new ErrorResponse({ - errorCode: 'AXIOS_ERROR', - errorMessage: 'Failed to execute the GraphQL mutation.', + errorCode: "AXIOS_ERROR", + errorMessage: "Failed to execute the GraphQL mutation.", }); } } // Rate Quiz - async rateQuiz(request, data: { - programId: string; - subject: string; - contentId: string; - rating: boolean; - }) { - + async rateQuiz( + request, + data: { + programId: string; + subject: string; + contentId: string; + rating: boolean; + } + ) { const decoded: any = jwt_decode(request.headers.authorization); const altUserId = decoded["https://hasura.io/jwt/claims"]["x-hasura-user-id"]; @@ -1029,11 +1028,11 @@ export class ALTProgramAssociationService { }; const config_data = { - method: 'post', + method: "post", url: process.env.ALTHASURA, headers: { Authorization: request.headers.authorization, - 'Content-Type': 'application/json', + "Content-Type": "application/json", }, data: checkGraphQLQuery, }; @@ -1041,13 +1040,13 @@ export class ALTProgramAssociationService { try { // Check if the like entry already exists const checkResponse = await this.axios(config_data); - console.log("checkResponse", checkResponse.data.data) + console.log("checkResponse", checkResponse.data.data); const existingLike = checkResponse?.data?.data?.GlaQuizRating[0]; - console.log("existingLike", existingLike) + console.log("existingLike", existingLike); if (existingLike) { // If entry exists, update the like status - console.log("entry exists") + console.log("entry exists"); const updateGraphQLQuery = { query: ` mutation UpdateLike($contentId: String!, $rating: Int!, $programId: String!, $subject: String!, $userId: String!) { @@ -1087,12 +1086,12 @@ export class ALTProgramAssociationService { return new SuccessResponse({ statusCode: 200, - message: 'Content like status updated successfully.', + message: "Content like status updated successfully.", data: updateResponse.data.data, }); } else { // If no entry exists, insert a new one - console.log("no entry exists") + console.log("no entry exists"); const insertGraphQLQuery = { query: ` mutation InsertLike($contentId: String!, $rating: Int!, $programId: String!, $subject: String!, $userId: String!) { @@ -1130,26 +1129,27 @@ export class ALTProgramAssociationService { return new SuccessResponse({ statusCode: 200, - message: 'Content like status inserted successfully.', + message: "Content like status inserted successfully.", data: insertResponse.data.data, }); } - } catch (error) { - console.error('Axios Error:', error.message); + console.error("Axios Error:", error.message); throw new ErrorResponse({ - errorCode: 'AXIOS_ERROR', - errorMessage: 'Failed to execute the GraphQL mutation.', + errorCode: "AXIOS_ERROR", + errorMessage: "Failed to execute the GraphQL mutation.", }); } } - async isQuizRated(request, data: { - programId: string; - subject: string; - contentId: string; - }) { - + async isQuizRated( + request, + data: { + programId: string; + subject: string; + contentId: string; + } + ) { const decoded: any = jwt_decode(request.headers.authorization); const altUserId = decoded["https://hasura.io/jwt/claims"]["x-hasura-user-id"]; @@ -1177,16 +1177,16 @@ export class ALTProgramAssociationService { variables: { contentId: data.contentId, programId: data.programId, - subject: data.subject + subject: data.subject, }, }; const config_data = { - method: 'post', + method: "post", url: process.env.ALTHASURA, headers: { Authorization: request.headers.authorization, - 'Content-Type': 'application/json', + "Content-Type": "application/json", }, data: checkGraphQLQuery, }; @@ -1194,44 +1194,41 @@ export class ALTProgramAssociationService { try { // Check if the like entry already exists const checkResponse = await this.axios(config_data); - console.log("checkResponse", checkResponse.data) + console.log("checkResponse", checkResponse.data); const existingLike = checkResponse?.data?.data?.GlaQuizRating[0]; - console.log("existingLike", existingLike) + console.log("existingLike", existingLike); if (existingLike) { // If entry exists, update the like status - return new SuccessResponse({ statusCode: 200, - message: 'Content fetched successfully.', + message: "Content fetched successfully.", data: checkResponse?.data?.data?.GlaQuizRating, }); } else { // If no entry exists, insert a new one - console.log("no entry exists") - + console.log("no entry exists"); return new SuccessResponse({ statusCode: 200, - message: 'Content not exists.', + message: "Content not exists.", data: [], }); } - } catch (error) { - console.error('Axios Error:', error.message); + console.error("Axios Error:", error.message); throw new ErrorResponse({ - errorCode: 'AXIOS_ERROR', - errorMessage: 'Failed to execute the GraphQL mutation.', + errorCode: "AXIOS_ERROR", + errorMessage: "Failed to execute the GraphQL mutation.", }); } } - async getUserPoints(request) { const decoded: any = jwt_decode(request.headers.authorization); - const altUserId = decoded["https://hasura.io/jwt/claims"]["x-hasura-user-id"]; + const altUserId = + decoded["https://hasura.io/jwt/claims"]["x-hasura-user-id"]; console.log("altUserId", altUserId); @@ -1259,11 +1256,11 @@ export class ALTProgramAssociationService { }; const config_data = { - method: 'post', + method: "post", url: process.env.ALTHASURA, headers: { Authorization: request.headers.authorization, - 'Content-Type': 'application/json', + "Content-Type": "application/json", }, data: checkGraphQLQuery, }; @@ -1275,31 +1272,32 @@ export class ALTProgramAssociationService { if (checkResponse) { return new SuccessResponse({ statusCode: 200, - message: 'User Points fetched successfully.', + message: "User Points fetched successfully.", data: checkResponse?.data?.data, }); } else { return new SuccessResponse({ statusCode: 200, - message: 'User Points not exists.', + message: "User Points not exists.", data: [], }); } } catch (error) { - console.error('Axios Error:', error.message); + console.error("Axios Error:", error.message); throw new ErrorResponse({ - errorCode: 'AXIOS_ERROR', - errorMessage: 'Failed to execute the GraphQL mutation.', + errorCode: "AXIOS_ERROR", + errorMessage: "Failed to execute the GraphQL mutation.", }); } } async addUserPoints(request, data) { const decoded: any = jwt_decode(request.headers.authorization); - const altUserId = decoded["https://hasura.io/jwt/claims"]["x-hasura-user-id"]; + const altUserId = + decoded["https://hasura.io/jwt/claims"]["x-hasura-user-id"]; console.log("altUserId", altUserId); - console.log("identifier", data.identifier) + console.log("identifier", data.identifier); // get the points to be allocated to the user for a given identifier const checkGraphQLQuery = { @@ -1325,11 +1323,11 @@ export class ALTProgramAssociationService { }; const config_data = { - method: 'post', + method: "post", url: process.env.ALTHASURA, headers: { Authorization: request.headers.authorization, - 'Content-Type': 'application/json', + "Content-Type": "application/json", }, data: checkGraphQLQuery, }; @@ -1337,18 +1335,20 @@ export class ALTProgramAssociationService { const checkResponse = await this.axios(config_data); console.log("checkResponse", checkResponse.data.data); - const points = checkResponse.data.data.PointsConfig[0].points || 0 + const points = checkResponse.data.data.PointsConfig[0].points || 0; - // Add entry into user_points table againt the loggrd in user + // Create description with points value + const description = `${data.description} ${points} points`; const insertGraphQLQuery = { query: ` - mutation InsertUserPoints($userId: String!, $identifier: String!, $points: Int!, $description: String!) { + mutation InsertUserPoints($userId: uuid!, $identifier: String!, $points: Int!, $description: String!, $earning_context: jsonb) { insert_UserPoints_one(object: { user_id: $userId, identifier: $identifier, points: $points, - description: $description + description: $description, + earning_context: $earning_context }) { id identifier @@ -1357,6 +1357,7 @@ export class ALTProgramAssociationService { description created_at updated_at + earning_context } } `, @@ -1364,9 +1365,12 @@ export class ALTProgramAssociationService { userId: altUserId, identifier: data.identifier, points: points, - description: data.description, + description: description, // Use the new description with points + earning_context: data.earning_context, }, }; + console.log(insertGraphQLQuery.query, insertGraphQLQuery.variables); + console.log(); config_data.data = insertGraphQLQuery; @@ -1375,11 +1379,8 @@ export class ALTProgramAssociationService { return new SuccessResponse({ statusCode: 200, - message: 'User points added successfully.', + message: "User points added successfully.", data: insertResponse.data.data, }); - } - - }