Skip to content

feat: Add services for creating and retrieving all purchases. - #47

Merged
JahnaviVeera merged 1 commit into
spotmies:masterfrom
JahnaviVeera:master
Mar 11, 2026
Merged

JahnaviVeera merged 1 commit into
spotmies:masterfrom
JahnaviVeera:master

Conversation

@JahnaviVeera

Copy link
Copy Markdown
Collaborator

No description provided.

@JahnaviVeera
JahnaviVeera merged commit 32305b5 into spotmies:master Mar 11, 2026
1 check passed
@github-actions

Copy link
Copy Markdown

🤖 AI Code Review

🤖 AI Code Review

📌 Summary

  • The changes introduce default values for some parameters in the createPurchase function.
  • There are potential issues with maintainability and clarity in the updated code.
  • No high-risk issues were identified.

💬 Inline Comments (File-wise)

src/modules/purchases/purchases.services.ts

  • Line 26: The use of vendorDetails: vendorDetails ?? null is redundant because vendorDetails will already default to null if it is undefined or null.

    • ✅ Suggestion: Simply use vendorDetails without the ?? null operator unless there is a specific reason to enforce null explicitly.
  • Line 28: Similarly, quantity: quantity ?? null is redundant for the same reason as above.

    • ✅ Suggestion: Use quantity directly unless there is a specific need to enforce null.
  • Line 29: The unit: unit ?? null assignment is also redundant.

    • ✅ Suggestion: Use unit directly unless enforcing null is required for downstream logic.
  • Line 27: The assignment dateOfPurchase: dateOfPurchase is unnecessary because the key and value have the same name.

    • ✅ Suggestion: Use shorthand property assignment: dateOfPurchase.

⚠️ High-Risk Issues

No high-risk issues found.


💡 Additional Suggestions

  • Consider adding comments or documentation to explain why null is explicitly assigned (if intentional). This will help future developers understand the reasoning behind these changes.
  • If the goal is to ensure that certain fields are always present in the database (even as null), it might be better to enforce this at the database schema level rather than in the application logic.

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

Development

Successfully merging this pull request may close these issues.

1 participant