Skip to content

resume data added with contentType#126

Merged
rushi-tekdi merged 1 commit into
tekdi:AI-assessmentfrom
rushi-tekdi:AI-Assessment
Jun 8, 2026
Merged

resume data added with contentType#126
rushi-tekdi merged 1 commit into
tekdi:AI-assessmentfrom
rushi-tekdi:AI-Assessment

Conversation

@rushi-tekdi

Copy link
Copy Markdown
Collaborator

No description provided.

@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bf726b9d-c367-4751-baee-e522971fcdab

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@rushi-tekdi
rushi-tekdi merged commit 0b7b8f3 into tekdi:AI-assessment Jun 8, 2026
1 check passed
@sonarqubecloud

sonarqubecloud Bot commented Jun 8, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request changes the type of resumeData from number to string in both the DTO and the entity, and introduces logic in TrackingContentService to parse resumeData from contentType when it contains a pipe delimiter. The review highlights two critical issues: first, a type mismatch between the TypeScript entity property (string) and the database column (double precision), which could lead to runtime errors or database failures; second, the parsing logic is only executed during updates and is skipped for new records, which will result in raw unparsed content types being saved. It is recommended to keep resumeData as a number, parse the string values appropriately, and move the parsing logic to the beginning of the method to cover both creation and update paths.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

nullable: true,
})
resumeData: number;
resumeData: string;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The database column type is defined as double precision (line 49), but the TypeScript property type has been changed to string.\n\nThis mismatch can lead to:\n1. Type Pollution: When TypeORM fetches records from the database, it will return a number for resumeData, but TypeScript will treat it as a string at compile-time, potentially causing runtime errors if string methods are called on it.\n2. Database Errors: Attempting to insert a non-numeric string into a double precision column will cause database insert/update failures.\n\nRecommendation: Keep resumeData typed as number in the entity. Any string values from the DTO or parsed from contentType should be converted to a number (e.g., using parseFloat) before saving to the database.

Suggested change
resumeData: string;
resumeData: number;

Comment on lines +243 to +261
try{
let temp_contentType=createContentTrackingDto.contentType;
if(temp_contentType.includes("|")){
const parts = temp_contentType.split('|');
createContentTrackingDto.contentType=parts[0];
if(parts.length>1)
{
createContentTrackingDto.resumeData=parts[1];
}
else{
createContentTrackingDto.resumeData="0";
}
}
else{
createContentTrackingDto.resumeData="0";
}
}
catch(e){
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The parsing of contentType and extraction of resumeData is currently placed inside the if (result_content.length > 0) block (which handles updates). For new tracking records (the else block), this parsing is completely skipped. This means the raw contentType containing the | character (e.g., 'video/mp4|120.5') will be saved directly to the database, and resumeData will not be extracted.\n\nAdditionally, if createContentTrackingDto.contentType is undefined or null, calling .includes() will throw a TypeError. The empty catch(e) {} block silently swallows errors, making debugging difficult.\n\nRecommendation:\nMove this parsing logic to the beginning of the createContentTracking method (before the result_content query around line 229) so that it applies to both new and existing records. Once moved, you can simplify this block to just parse the resumeData as a float.\n\nExample parsing logic to place before line 229:\ntypescript\nconst contentType = createContentTrackingDto.contentType;\nif (typeof contentType === 'string' && contentType.includes('|')) {\n const [cleanType, resumeStr] = contentType.split('|');\n createContentTrackingDto.contentType = cleanType;\n createContentTrackingDto.resumeData = resumeStr || '0';\n}\n

        // Parsing logic moved before line 229 to support both new and existing records

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant