Skip to content

feat: handle cleanup of temporary files and folders #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 62 commits into
base: main
Choose a base branch
from

Conversation

osm-Jatin
Copy link

@osm-Jatin osm-Jatin commented Jul 5, 2025

Task Link

REST-1639

Description

  • add function for resource cleanup in PdfDocumentGenerator
  • add function for resource cleanup in WordDocumentGenerator
  • add conditional validation for Base64 images

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced login and token revocation endpoints with JWT authentication and Redis-backed token management.
    • Added support for PDF and Word document generation from templates, including placeholder, table, and image replacement.
    • Integrated Redis for token storage and validation.
    • Added configuration for PDF tool paths and improved environment variable management.
  • Improvements

    • Enhanced error handling and validation for API endpoints.
    • Updated API documentation and Swagger configuration.
    • Improved project structure, naming, and configuration for clarity and maintainability.
  • Bug Fixes

    • Fixed issues with image handling in Word document generation.
    • Improved validation and error messages for user inputs.
  • Documentation

    • Updated documentation and references to reflect project rename from "DocumentService" to "OsmoDoc".
  • Chores

    • Refactored project and solution files, Docker setup, and environment configuration for the new project structure.
    • Added and updated ignore rules for temporary files and Docker volumes.
  • Revert

    • Removed legacy code and models no longer used in the new architecture.

osm-Jatin and others added 30 commits June 15, 2025 14:51
Copy link

coderabbitai bot commented Jul 5, 2025

Walkthrough

This update renames the project from "DocumentService" to "OsmoDoc" throughout the codebase, documentation, and configuration files. It introduces Redis-based JWT token storage and revocation, updates Docker and environment configurations, restructures API request/response models, and refactors PDF and Word document generation logic into new namespaces and files. Supporting documentation and build files are updated accordingly.

Changes

Files/Paths Change Summary
.env.example, docker-compose.yaml, .gitignore Expanded env vars, updated Docker Compose to add Redis and new API service, added ignore for Docker temp volume.
README.md, CONTRIBUTING.md, .github/PULL_REQUEST_TEMPLATE/pull_request_template_api.md Updated project name and URLs from "document-service" to "osmodoc".
OsmoDoc.sln, OsmoDoc.API/OsmoDoc.API.sln, docs/site/*, docs/site/manifest.json, docs/site/xrefmap.yml Renamed projects, namespaces, and documentation references from "DocumentService" to "OsmoDoc".
Dockerfile Switched to Release config, renamed paths and binaries for OsmoDoc, consolidated dependency install steps.
OsmoDoc.API/Program.cs Added Redis integration, JWT revocation, improved config validation, enabled Swagger in all environments.
OsmoDoc.API/Controllers/LoginController.cs New controller for login and token revocation using Redis-backed JWTs.
OsmoDoc.API/Controllers/PdfController.cs, OsmoDoc.API/Controllers/WordController.cs Updated for new namespaces, improved input/config validation, async document generation, and refactored logic.
OsmoDoc.API/Helpers/*, OsmoDoc.API/Models/* Namespaces updated, new/updated DTOs for login, PDF/Word generation, token revocation, improved validation.
OsmoDoc.API/OsmoDoc.API.csproj, OsmoDoc/OsmoDoc.csproj Added Redis package, updated internal project references, created new OsmoDoc library project.
OsmoDoc/Pdf/*, OsmoDoc/Word/*, OsmoDoc/Services/* Re-implemented PDF/Word document generation, added Redis token store service and interfaces, new data models.
DocumentService.API/*, DocumentService/* Deleted old API, models, helpers, and document generation logic.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant LoginController
    participant RedisTokenStoreService
    participant JwtTokenGenerator

    Client->>LoginController: POST /api/login (LoginRequestDTO)
    LoginController->>JwtTokenGenerator: Generate JWT (email)
    JwtTokenGenerator-->>LoginController: JWT token
    LoginController->>RedisTokenStoreService: StoreTokenAsync(token, email)
    RedisTokenStoreService-->>LoginController: (ack)
    LoginController-->>Client: BaseResponse(token, status=Success)

    Client->>LoginController: POST /api/revoke (RevokeTokenRequestDTO)
    LoginController->>RedisTokenStoreService: RevokeTokenAsync(token)
    RedisTokenStoreService-->>LoginController: (ack)
    LoginController-->>Client: BaseResponse(status=Success)
Loading
sequenceDiagram
    participant Client
    participant PdfController
    participant PdfDocumentGenerator

    Client->>PdfController: POST /api/pdf (PdfGenerationRequestDTO)
    PdfController->>PdfDocumentGenerator: GeneratePdf(templatePath, metaData, outputPath, isEjs, json)
    PdfDocumentGenerator-->>PdfController: (PDF generated)
    PdfController-->>Client: BaseResponse(base64 PDF, status=Success)
Loading
sequenceDiagram
    participant Client
    participant WordController
    participant WordDocumentGenerator

    Client->>WordController: POST /api/word (WordGenerationRequestDTO)
    WordController->>WordDocumentGenerator: GenerateDocumentByTemplate(templatePath, documentData, outputPath)
    WordDocumentGenerator-->>WordController: (Word doc generated)
    WordController-->>Client: BaseResponse(base64 doc, status=Success)
Loading

Possibly related issues

Poem

🐇✨
OsmoDoc hops in with a brand new name,
Redis and JWT now join the game.
Docs and Docker freshly aligned,
PDF and Word, robustly redefined.
From template to token, all flows anew—
This bunny’s code brings joy to you!
🥕📄


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7f21e52 and d4c09b3.

📒 Files selected for processing (1)
  • OsmoDoc.API/Controllers/WordController.cs (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc.API/Controllers/WordController.cs:38-60
Timestamp: 2025-06-18T15:05:30.284Z
Learning: osm-Jatin prefers to create separate GitHub issues to track technical debt and improvement suggestions that are out of scope for the current PR, such as temporary file cleanup concerns in the OsmoDoc project.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#52
File: OsmoDoc.API/Controllers/PdfController.cs:27-124
Timestamp: 2025-07-05T11:54:07.620Z
Learning: In the OsmoDoc project, the cleanup scope is intentionally limited to modified/intermediate files created during document generation, not the input template or output files. This is because OsmoDoc is planned to be used as a NuGet package where users will provide and manage their own input and output file paths.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#51
File: OsmoDoc/Pdf/PdfDocumentGenerator.cs:92-102
Timestamp: 2025-07-05T11:36:58.372Z
Learning: osm-Jatin follows through on technical debt by creating tracking issues and then implementing fixes in separate PRs, ensuring proper review and testing of improvements identified during code reviews in the OsmoDoc project.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc.API/Controllers/PdfController.cs:34-46
Timestamp: 2025-06-18T14:34:35.161Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the PdfDocumentGenerator.GeneratePdf method only deletes its internal temporary files (converted HTML, modified HTML, JSON data files) but does not delete the input template files or output PDF files created by the controller, requiring manual cleanup in the controller to prevent disk bloat.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc/Pdf/Models/OsmoDocPdfConfig.cs:3-7
Timestamp: 2025-07-04T03:19:33.211Z
Learning: osm-Jatin prefers to defer non-critical code improvements like thread safety enhancements and validation logic when they are not essential for the current PR scope, preferring to keep changes focused on the main objectives.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Pdf/PdfDocumentGenerator.cs:84-92
Timestamp: 2025-06-18T14:44:46.570Z
Learning: osm-Jatin prefers to document input requirements clearly in the README file rather than adding runtime validation code for scenarios like null/duplicate placeholders in the OsmoDoc PDF generation functionality.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Controllers/PdfController.cs:96-97
Timestamp: 2025-07-04T03:27:39.757Z
Learning: osm-Jatin prefers to defer security-related logging improvements (like removing stack trace logging) when they are not essential for the current PR scope in the OsmoDoc project, choosing to keep existing implementation for now.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#41
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:10-27
Timestamp: 2025-06-19T04:10:32.232Z
Learning: In the OsmoDoc project, they use a hybrid JWT + Redis token management approach: non-expiry JWT tokens are generated and stored in Redis for validation and manual revocation. The system includes RedisTokenService for token storage/validation and dedicated revocation endpoints, allowing stateless JWT benefits while maintaining token lifecycle control.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#42
File: OsmoDoc/Services/RedisTokenStoreService.cs:18-24
Timestamp: 2025-06-20T14:36:49.953Z
Learning: In the OsmoDoc project, the team prefers manual token lifecycle management over automatic TTL expiration in Redis. They deliberately store tokens without expiration to maintain precise control over when tokens become invalid through their dedicated revocation endpoints, rather than relying on automatic expiration.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#42
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:18-24
Timestamp: 2025-06-20T14:37:36.118Z
Learning: In OsmoDoc.API, JWT tokens are intentionally created without expiration because the application uses Redis as the authoritative source for token validity. Tokens are stored in Redis when issued and can be manually revoked by removing them from Redis, providing centralized token management and immediate invalidation capability.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:11-24
Timestamp: 2025-06-22T13:55:51.706Z
Learning: In the OsmoDoc project, JWT tokens are intentionally created without expiration dates. The team has chosen to implement manual token invalidation through Redis storage instead of using JWT expiration claims. Tokens are stored in Redis and can be manually revoked using the /api/revoke endpoint. This design decision was made in PR #42 where the user stated "Not needed, we will make the token inactive manually for now."
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#51
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:10-27
Timestamp: 2025-07-04T14:44:16.407Z
Learning: In the OsmoDoc project, the team has determined that adding issuer and audience claims to JWT tokens is not required for their specific use case. They have a comprehensive token management system with Redis-based revocation that meets their security requirements without needing additional JWT validation features.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#41
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:10-27
Timestamp: 2025-06-19T04:10:32.232Z
Learning: In the OsmoDoc project, non-expiry JWT tokens are used intentionally with manual invalidation mechanisms. The team handles token lifecycle management manually rather than using time-based expiration.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#42
File: OsmoDoc.API/Program.cs:98-112
Timestamp: 2025-06-20T14:36:43.563Z
Learning: In the OsmoDoc project, JWT tokens are intentionally designed to be non-expiring. The custom LifetimeValidator in Program.cs always returns true to prevent token expiration validation, which is by design rather than a bug.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#52
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:13-16
Timestamp: 2025-07-05T11:50:12.072Z
Learning: In the OsmoDoc project, osm-Jatin prefers to keep performance optimizations simple for infrequently used endpoints like the login endpoint, choosing not to implement caching optimizations when the endpoint usage is expected to be rare.
OsmoDoc.API/Controllers/WordController.cs (14)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists with `= new()`, and DTOs are also initialized properly. This pattern ensures that the properties are never null, making additional null checks unnecessary for these specific properties in the WordDocumentGenerator.GenerateDocumentByTemplate method.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc.API/Controllers/PdfController.cs:34-46
Timestamp: 2025-06-18T14:34:35.161Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the PdfDocumentGenerator.GeneratePdf method only deletes its internal temporary files (converted HTML, modified HTML, JSON data files) but does not delete the input template files or output PDF files created by the controller, requiring manual cleanup in the controller to prevent disk bloat.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists by default, and in WordGenerationRequestDTO, the DocumentData property is initialized with `= new();`. This pattern ensures that the properties are never null, though the parameter itself could still be null if explicitly passed as null.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Controllers/PdfController.cs:129-136
Timestamp: 2025-07-04T03:22:57.425Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the user initially thought that request parameter null checks were unnecessary because DocumentData property is initialized with `= new();` in the DTO. However, property initialization only prevents null properties within successfully created DTO objects, while the request parameter itself can still be null due to null request bodies, malformed JSON, or model binding failures.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:298-311
Timestamp: 2025-06-21T17:11:15.672Z
Learning: In the OsmoDoc Word document generation code, when checking mainDocumentPart for null before populating a drawings collection, an additional null check inside the foreach loop is redundant because if mainDocumentPart was null, the drawings collection would remain empty and the loop wouldn't execute.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#52
File: OsmoDoc.API/Controllers/PdfController.cs:27-124
Timestamp: 2025-07-05T11:54:07.620Z
Learning: In the OsmoDoc project, the cleanup scope is intentionally limited to modified/intermediate files created during document generation, not the input template or output files. This is because OsmoDoc is planned to be used as a NuGet package where users will provide and manage their own input and output file paths.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Pdf/PdfDocumentGenerator.cs:84-92
Timestamp: 2025-06-18T14:44:46.570Z
Learning: osm-Jatin prefers to document input requirements clearly in the README file rather than adding runtime validation code for scenarios like null/duplicate placeholders in the OsmoDoc PDF generation functionality.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc.API/Controllers/WordController.cs:38-60
Timestamp: 2025-06-18T15:05:30.284Z
Learning: osm-Jatin prefers to create separate GitHub issues to track technical debt and improvement suggestions that are out of scope for the current PR, such as temporary file cleanup concerns in the OsmoDoc project.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc/Pdf/Models/OsmoDocPdfConfig.cs:3-7
Timestamp: 2025-07-04T03:19:33.211Z
Learning: osm-Jatin prefers to defer non-critical code improvements like thread safety enhancements and validation logic when they are not essential for the current PR scope, preferring to keep changes focused on the main objectives.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#51
File: OsmoDoc/Pdf/PdfDocumentGenerator.cs:92-102
Timestamp: 2025-07-05T11:36:58.372Z
Learning: osm-Jatin follows through on technical debt by creating tracking issues and then implementing fixes in separate PRs, ensuring proper review and testing of improvements identified during code reviews in the OsmoDoc project.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Controllers/PdfController.cs:96-97
Timestamp: 2025-07-04T03:27:39.757Z
Learning: osm-Jatin prefers to defer security-related logging improvements (like removing stack trace logging) when they are not essential for the current PR scope in the OsmoDoc project, choosing to keep existing implementation for now.
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (csharp)
🔇 Additional comments (7)
OsmoDoc.API/Controllers/WordController.cs (7)

1-9: Namespace migration completed successfully.

The namespace and import changes properly reflect the project rebranding from DocumentService to OsmoDoc. All necessary dependencies are correctly imported.


39-47: Excellent input validation with proper null checks.

The null validation for both the request object and DocumentData property is appropriate and handles potential model binding failures. Using BadHttpRequestException with descriptive messages provides clear feedback to API consumers.


49-58: Robust configuration validation with fail-fast approach.

The configuration retrieval with null-coalescing operators and InvalidOperationException provides excellent error handling. This fail-fast approach ensures all required paths are available before processing begins, improving reliability.


86-90: Appropriate validation for Base64 image data.

The validation ensures all images have non-empty Data fields before processing, which is essential for Base64 image handling. The error message clearly indicates the validation requirement.


93-98: Clean data mapping with appropriate use of AutoMapper.

The DocumentData mapping properly separates API models from domain models, using AutoMapper for Placeholders while directly assigning compatible collections. This approach maintains good architectural boundaries.


101-105: Proper async implementation for document generation.

The awaited call to WordDocumentGenerator.GenerateDocumentByTemplate is correctly implemented, providing better performance for I/O-bound document generation operations.


148-172: Excellent implementation of cleanup functionality as requested.

The finally block successfully addresses the cleanup requirements mentioned in the PR objectives and previous review discussions. The implementation properly:

  • Ensures cleanup occurs regardless of operation success/failure
  • Deletes both controller-managed template and output files to prevent disk bloat
  • Includes appropriate error handling for cleanup failures
  • Uses logging to track cleanup issues without masking original exceptions

This aligns perfectly with the cleanup pattern discussed in past reviews and maintains the separation of concerns where the controller handles its temporary files while WordDocumentGenerator handles its internal temporary resources.

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@osm-Jatin osm-Jatin requested a review from sameer-s-b July 5, 2025 11:33
@osm-Jatin osm-Jatin self-assigned this Jul 5, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 8

🧹 Nitpick comments (28)
OsmoDoc.API/DotEnv.cs (1)

12-33: Consider making DotEnv.Load more robust (skip comments, preserve existing vars, avoid leading/trailing spaces).

Although untouched in this PR, a few low-effort tweaks would harden the helper:

  1. Ignore blank lines & lines starting with # or //.
  2. Trim both key and value, but allow = inside quoted values.
  3. Optionally keep existing env vars (don’t overwrite if already set).

Example diff (illustrative only):

-        foreach (string line in File.ReadAllLines(filePath))
+        foreach (var raw in File.ReadAllLines(filePath))
         {
-            // Check if the line contains '='
-            int equalsIndex = line.IndexOf('=');
+            var line = raw.Trim();
+            if (string.IsNullOrWhiteSpace(line) || line.StartsWith('#') || line.StartsWith("//"))
+                continue;
+
+            int equalsIndex = line.IndexOf('=');
             if (equalsIndex == -1)
                 continue; // Skip lines without '='
@@
-            Environment.SetEnvironmentVariable(key, value);
+            if (Environment.GetEnvironmentVariable(key) is null)
+                Environment.SetEnvironmentVariable(key, value);
         }

Given past feedback, feel free to spin this into a separate issue if out of scope.

.gitignore (2)

40-42: Potentially redundant ignore rules

**/wwwroot/Temp already ignores Temp sub-folders under wwwroot.
The new top-level Temp/ rule is fine, but if all temp files live below wwwroot/Temp the extra rule can be dropped to keep the file lean.


355-357: Nit: keep comment style consistent

Every other section header starts with a single # comment line. Consider matching that style:

-# Docker mount volumes
-Temp/
+# Docker mount volumes
+Temp/
.env.example (2)

1-1: Strengthen placeholder guidance for JWT key

Consider clarifying entropy requirements and recommending quoting if the key contains special chars:

-JWT_KEY=PLACEHOLDER_REPLACE_WITH_STRONG_KEY_MIN_32_CHARS_BEFORE_USE
+JWT_KEY="REPLACE_WITH_MIN_32_CHAR_RANDOM_STRING"

3-7: Duplicate Redis connection info

Both REDIS_URL and the REDIS_HOST/REDIS_PORT pair convey the same data. Unless you support both styles at runtime, choose one to prevent configuration drift.

OsmoDoc.API/Helpers/Base64StringHelper.cs (1)

5-17: Handle malformed Base64 input and large payloads gracefully

Convert.FromBase64String throws FormatException for invalid input, which bubbles up as 500. Catch and convert to BadHttpRequestException with a clear message; also consider streaming large files instead of holding them fully in memory.

-byte[] data = Convert.FromBase64String(base64String);
+byte[] data;
+try
+{
+    data = Convert.FromBase64String(base64String);
+}
+catch (FormatException)
+{
+    throw new BadHttpRequestException("Invalid Base64 string supplied.");
+}

Optional: use a temp file + FileStream to avoid doubling memory usage for large uploads.

OsmoDoc/Pdf/Models/DocumentData.cs (3)

1-4: Remove unused using directive to keep the file tidy

System.Text isn’t referenced anywhere in this file – dropping it avoids a pointless import.

-using System.Text;

7-10: Minor style polish: prefer target-typed new() for brevity

C# 9+ allows = new();, which is idiomatic and keeps the type name from repeating.

-    public List<ContentMetaData> Placeholders { get; set; } = new List<ContentMetaData>();
+    public List<ContentMetaData> Placeholders { get; set; } = new();

7-10: Consider sharing this model with Word module to avoid duplication

A very similar DocumentData already exists under OsmoDoc.Word.Models. Duplicating the class in the PDF namespace risks the two drifting apart. Moving the type to a common project (e.g., OsmoDoc.Models) and referencing it from both generators will reduce maintenance overhead.

OsmoDoc/Pdf/Models/ContentMetaData.cs (2)

3-7: Leverage C# records for simple DTOs

ContentMetaData is a pure data holder. Declaring it as an immutable record simplifies equality, deconstruction, and with-expressions:

-public class ContentMetaData
-{
-    public string Placeholder { get; set; } = string.Empty;
-    public string Content  { get; set; } = string.Empty;
-}
+public readonly record struct ContentMetaData(string Placeholder, string Content);

If mutability is required, record class works as well.


3-7: Add XML documentation comments for public API surface

These models are part of the public contract consumed by controllers/generators. Adding <summary> XML docs now will surface useful IntelliSense and auto-populate DocFX pages without extra effort.

OsmoDoc.API/Helpers/AuthenticationHelper.cs (1)

18-26: Optional: add standard JWT metadata

Design notes indicate non-expiring tokens are intentional, but consider adding sub, iat, or iss claims (even static) for easier downstream audit/debug. No change requested if out-of-scope.

README.md (2)

1-2: Typo – duplicated project title

# OsmoDoc OsmoDoc is... repeats the name. Remove the second occurrence for clarity.

-# OsmoDoc
-OsmoDoc is a library with the following functions
+# OsmoDoc
+OsmoDoc is a library with the following functions

102-107: Clarify tooling directory wording

“Go to the location to the bin files of your project where the OsmoDoc DLL is located.” reads awkwardly & omits Pdf tool path differences on Linux. Consider rephrasing:

Navigate to your build output folder (where OsmoDoc.dll resides), create a Tools sub-folder and copy wkhtmltopdf.exe (or the Linux binary) into it.

Pure docs change – no code impact.

CONTRIBUTING.md (1)

68-71: Replace garbled Unicode bullets

The replacement character slipped into the checklist items. Use proper markdown bullets:

- - <strong style="color:black">�</strong> **If we suggest changes, then:**
-   - � Make the required updates.
-   - � Ensure that your changes do not break existing functionality or introduce new issues.
-   - � Rebase your branch and force push to your GitHub repository. This will update your Pull Request.
+* **If we suggest changes, then:**
+  * Make the required updates.
+  * Ensure that your changes do not break existing functionality or introduce new issues.
+  * Rebase your branch and force-push; the PR will update automatically.
OsmoDoc/Word/Models/Enums.cs (2)

7-13: Consider expanding ContentType enum for future extensibility.

The ContentType enum currently only supports Text = 0. Based on the AI summary, a previous version included an Image member. Consider whether image content type support might be needed for future requirements.


28-29: Fix formatting inconsistency.

There's inconsistent spacing around the Table = 1 declaration.

-    /// <summary>
-    /// The placeholder belongs to a table.
-    /// </summary>
-
-    Table = 1
+    /// <summary>
+    /// The placeholder belongs to a table.
+    /// </summary>
+    Table = 1
OsmoDoc/Word/Models/DocumentData.cs (1)

1-4: Remove unused using statements.

The System, System.Collections.Generic, and System.Text using statements appear to be unused in this file.

-using System;
-using System.Collections.Generic;
-using System.Text;
-
 namespace OsmoDoc.Word.Models;
OsmoDoc.API/Models/WordGenerationRequestDTO.cs (1)

6-6: Remove unnecessary empty line after namespace declaration.

This empty line is not needed and doesn't follow typical C# formatting conventions.

-namespace OsmoDoc.API.Models;
-
+namespace OsmoDoc.API.Models;
OsmoDoc/Pdf/PdfDocumentGenerator.cs (4)

23-23: Use conventional method signature order: static async instead of async static.

While both work, the conventional order in C# is to place static before async.

-public async static Task GeneratePdf(string templatePath, List<ContentMetaData> metaDataList, string outputFilePath, bool isEjsTemplate, string? serializedEjsDataJson)
+public static async Task GeneratePdf(string templatePath, List<ContentMetaData> metaDataList, string outputFilePath, bool isEjsTemplate, string? serializedEjsDataJson)

164-164: Use conventional method signature order.

-private async static Task<string> ConvertEjsToHTML(string ejsFilePath, string outputFilePath, string? ejsDataJson)
+private static async Task<string> ConvertEjsToHTML(string ejsFilePath, string outputFilePath, string? ejsDataJson)

108-108: Use conventional method signature order.

-private async static Task ConvertHtmlToPdf(string? wkhtmltopdfPath, string modifiedHtmlFilePath, string outputFilePath)
+private static async Task ConvertHtmlToPdf(string? wkhtmltopdfPath, string modifiedHtmlFilePath, string outputFilePath)

257-286: Well-implemented cleanup method with proper error handling!

The cleanup implementation correctly:

  • Handles both file and directory cleanup
  • Catches exceptions to avoid masking original errors
  • Checks for null/empty paths before attempting deletion

Consider using a proper logging mechanism instead of Console.WriteLine for better integration with consuming applications.

Consider accepting an optional ILogger parameter or using a logging abstraction instead of Console.WriteLine for better observability in production environments.

docker-compose.yaml (1)

32-32: Add newline at end of file.

YAML files should end with a newline character.

-    driver: bridge
+    driver: bridge
+
OsmoDoc/Word/WordDocumentGenerator.cs (2)

33-33: Use conventional method signature order: static async instead of async static.

-public async static Task GenerateDocumentByTemplate(string templateFilePath, DocumentData documentData, string outputFilePath)
+public static async Task GenerateDocumentByTemplate(string templateFilePath, DocumentData documentData, string outputFilePath)

130-130: Use conventional method signature order.

-private async static Task<XWPFDocument> GetXWPFDocument(string docFilePath)
+private static async Task<XWPFDocument> GetXWPFDocument(string docFilePath)
OsmoDoc.API/Program.cs (1)

40-43: Consider safer null handling for configuration value.

The use of the null-forgiving operator (!) on line 43 could throw a NullReferenceException if the configuration value is missing. Consider using the null-coalescing operator with a meaningful exception instead.

 OsmoDocPdfConfig.WkhtmltopdfPath = Path.Combine(
     builder.Environment.WebRootPath,
-    builder.Configuration.GetSection("STATIC_FILE_PATHS:HTML_TO_PDF_TOOL").Value!
+    builder.Configuration.GetSection("STATIC_FILE_PATHS:HTML_TO_PDF_TOOL").Value
+        ?? throw new InvalidOperationException("Configuration STATIC_FILE_PATHS:HTML_TO_PDF_TOOL is missing.")
 );
OsmoDoc.API/Controllers/PdfController.cs (1)

27-225: Significant code duplication between PDF generation methods.

Both GeneratePdf and GeneratePdfUsingEjs methods share ~90% of their code. The only differences are the file extensions and the parameters passed to PdfDocumentGenerator.GeneratePdf.

Consider extracting the common logic into a private method:

private async Task<ActionResult<BaseResponse>> GeneratePdfInternal(
    PdfGenerationRequestDTO request,
    string templateExtension,
    string templateSubPath,
    bool isEjsTemplate)
{
    // Common implementation here
}

[HttpPost]
[Authorize]
[Route("pdf/GeneratePdfUsingHtml")]
public async Task<ActionResult<BaseResponse>> GeneratePdf(PdfGenerationRequestDTO request)
{
    return await GeneratePdfInternal(request, "html", "HTML", false);
}

[HttpPost]
[Authorize]
[Route("pdf/GeneratePdfUsingEjs")]
public async Task<ActionResult<BaseResponse>> GeneratePdfUsingEjs(PdfGenerationRequestDTO request)
{
    return await GeneratePdfInternal(request, "ejs", "EJS", true);
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 10ba019 and ea8787d.

⛔ Files ignored due to path filters (1)
  • OsmoDoc.API/wwwroot/Tools/wkhtmltopdf.exe is excluded by !**/*.exe
📒 Files selected for processing (60)
  • .env.example (1 hunks)
  • .github/PULL_REQUEST_TEMPLATE/pull_request_template_api.md (1 hunks)
  • .gitignore (1 hunks)
  • CONTRIBUTING.md (7 hunks)
  • Dockerfile (1 hunks)
  • DocumentService.API/Helpers/AutoMappingProfile.cs (0 hunks)
  • DocumentService.API/Models/PdfGenerationRequestDTO.cs (0 hunks)
  • DocumentService.API/Models/WordGenerationRequestDTO.cs (0 hunks)
  • DocumentService/DocumentService.csproj (0 hunks)
  • DocumentService/Pdf/Models/ContentMetaData.cs (0 hunks)
  • DocumentService/Pdf/Models/DocumentData.cs (0 hunks)
  • DocumentService/Pdf/PdfDocumentGenerator.cs (0 hunks)
  • DocumentService/Word/Models/ContentData.cs (0 hunks)
  • DocumentService/Word/Models/DocumentData.cs (0 hunks)
  • DocumentService/Word/Models/Enums.cs (0 hunks)
  • DocumentService/Word/Models/TableData.cs (0 hunks)
  • DocumentService/Word/WordDocumentGenerator.cs (0 hunks)
  • OsmoDoc.API/Controllers/LoginController.cs (1 hunks)
  • OsmoDoc.API/Controllers/PdfController.cs (1 hunks)
  • OsmoDoc.API/Controllers/WordController.cs (1 hunks)
  • OsmoDoc.API/DotEnv.cs (1 hunks)
  • OsmoDoc.API/Helpers/AuthenticationHelper.cs (1 hunks)
  • OsmoDoc.API/Helpers/AutoMappingProfile.cs (1 hunks)
  • OsmoDoc.API/Helpers/Base64StringHelper.cs (1 hunks)
  • OsmoDoc.API/Helpers/CommonMethodsHelper.cs (1 hunks)
  • OsmoDoc.API/Models/BaseResponse.cs (1 hunks)
  • OsmoDoc.API/Models/LoginRequestDTO.cs (1 hunks)
  • OsmoDoc.API/Models/PdfGenerationRequestDTO.cs (1 hunks)
  • OsmoDoc.API/Models/RevokeTokenRequestDTO.cs (1 hunks)
  • OsmoDoc.API/Models/WordGenerationRequestDTO.cs (1 hunks)
  • OsmoDoc.API/OsmoDoc.API.csproj (1 hunks)
  • OsmoDoc.API/OsmoDoc.API.sln (1 hunks)
  • OsmoDoc.API/Program.cs (1 hunks)
  • OsmoDoc.sln (1 hunks)
  • OsmoDoc/OsmoDoc.csproj (1 hunks)
  • OsmoDoc/Pdf/Models/ContentMetaData.cs (1 hunks)
  • OsmoDoc/Pdf/Models/DocumentData.cs (1 hunks)
  • OsmoDoc/Pdf/Models/OsmoDocPdfConfig.cs (1 hunks)
  • OsmoDoc/Pdf/PdfDocumentGenerator.cs (1 hunks)
  • OsmoDoc/Services/Interfaces/IRedisTokenStoreService.cs (1 hunks)
  • OsmoDoc/Services/RedisTokenStoreService.cs (1 hunks)
  • OsmoDoc/Word/Models/ContentData.cs (1 hunks)
  • OsmoDoc/Word/Models/DocumentData.cs (1 hunks)
  • OsmoDoc/Word/Models/Enums.cs (1 hunks)
  • OsmoDoc/Word/Models/ImageData.cs (1 hunks)
  • OsmoDoc/Word/Models/TableData.cs (1 hunks)
  • OsmoDoc/Word/WordDocumentGenerator.cs (1 hunks)
  • README.md (6 hunks)
  • docker-compose.yaml (1 hunks)
  • docs/site/10.0.2/api/OsmoDoc.Word.Models.ContentData.html (5 hunks)
  • docs/site/10.0.2/api/OsmoDoc.Word.Models.ContentType.html (2 hunks)
  • docs/site/10.0.2/api/OsmoDoc.Word.Models.DocumentData.html (4 hunks)
  • docs/site/10.0.2/api/OsmoDoc.Word.Models.ParentBody.html (2 hunks)
  • docs/site/10.0.2/api/OsmoDoc.Word.Models.TableData.html (3 hunks)
  • docs/site/10.0.2/api/OsmoDoc.Word.Models.html (2 hunks)
  • docs/site/10.0.2/api/OsmoDoc.Word.WordDocumentGenerator.html (3 hunks)
  • docs/site/10.0.2/api/OsmoDocWord.html (2 hunks)
  • docs/site/10.0.2/api/toc.html (1 hunks)
  • docs/site/manifest.json (1 hunks)
  • docs/site/xrefmap.yml (1 hunks)
💤 Files with no reviewable changes (12)
  • DocumentService/Pdf/Models/ContentMetaData.cs
  • DocumentService/Pdf/Models/DocumentData.cs
  • DocumentService/Word/Models/TableData.cs
  • DocumentService.API/Helpers/AutoMappingProfile.cs
  • DocumentService/Word/Models/DocumentData.cs
  • DocumentService/Word/Models/Enums.cs
  • DocumentService.API/Models/PdfGenerationRequestDTO.cs
  • DocumentService/Word/Models/ContentData.cs
  • DocumentService/DocumentService.csproj
  • DocumentService.API/Models/WordGenerationRequestDTO.cs
  • DocumentService/Pdf/PdfDocumentGenerator.cs
  • DocumentService/Word/WordDocumentGenerator.cs
🧰 Additional context used
🧠 Learnings (44)
📓 Common learnings
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc.API/Controllers/WordController.cs:38-60
Timestamp: 2025-06-18T15:05:30.284Z
Learning: osm-Jatin prefers to create separate GitHub issues to track technical debt and improvement suggestions that are out of scope for the current PR, such as temporary file cleanup concerns in the OsmoDoc project.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc.API/Controllers/PdfController.cs:34-46
Timestamp: 2025-06-18T14:34:35.161Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the PdfDocumentGenerator.GeneratePdf method only deletes its internal temporary files (converted HTML, modified HTML, JSON data files) but does not delete the input template files or output PDF files created by the controller, requiring manual cleanup in the controller to prevent disk bloat.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc/Pdf/Models/OsmoDocPdfConfig.cs:3-7
Timestamp: 2025-07-04T03:19:33.211Z
Learning: osm-Jatin prefers to defer non-critical code improvements like thread safety enhancements and validation logic when they are not essential for the current PR scope, preferring to keep changes focused on the main objectives.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Controllers/PdfController.cs:96-97
Timestamp: 2025-07-04T03:27:39.757Z
Learning: osm-Jatin prefers to defer security-related logging improvements (like removing stack trace logging) when they are not essential for the current PR scope in the OsmoDoc project, choosing to keep existing implementation for now.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Pdf/PdfDocumentGenerator.cs:84-92
Timestamp: 2025-06-18T14:44:46.570Z
Learning: osm-Jatin prefers to document input requirements clearly in the README file rather than adding runtime validation code for scenarios like null/duplicate placeholders in the OsmoDoc PDF generation functionality.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#41
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:10-27
Timestamp: 2025-06-19T04:10:32.232Z
Learning: In the OsmoDoc project, they use a hybrid JWT + Redis token management approach: non-expiry JWT tokens are generated and stored in Redis for validation and manual revocation. The system includes RedisTokenService for token storage/validation and dedicated revocation endpoints, allowing stateless JWT benefits while maintaining token lifecycle control.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#42
File: OsmoDoc/Services/RedisTokenStoreService.cs:18-24
Timestamp: 2025-06-20T14:36:49.953Z
Learning: In the OsmoDoc project, the team prefers manual token lifecycle management over automatic TTL expiration in Redis. They deliberately store tokens without expiration to maintain precise control over when tokens become invalid through their dedicated revocation endpoints, rather than relying on automatic expiration.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#42
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:18-24
Timestamp: 2025-06-20T14:37:36.118Z
Learning: In OsmoDoc.API, JWT tokens are intentionally created without expiration because the application uses Redis as the authoritative source for token validity. Tokens are stored in Redis when issued and can be manually revoked by removing them from Redis, providing centralized token management and immediate invalidation capability.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:11-24
Timestamp: 2025-06-22T13:55:51.706Z
Learning: In the OsmoDoc project, JWT tokens are intentionally created without expiration dates. The team has chosen to implement manual token invalidation through Redis storage instead of using JWT expiration claims. Tokens are stored in Redis and can be manually revoked using the /api/revoke endpoint. This design decision was made in PR #42 where the user stated "Not needed, we will make the token inactive manually for now."
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#51
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:10-27
Timestamp: 2025-07-04T14:44:16.407Z
Learning: In the OsmoDoc project, the team has determined that adding issuer and audience claims to JWT tokens is not required for their specific use case. They have a comprehensive token management system with Redis-based revocation that meets their security requirements without needing additional JWT validation features.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#41
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:10-27
Timestamp: 2025-06-19T04:10:32.232Z
Learning: In the OsmoDoc project, non-expiry JWT tokens are used intentionally with manual invalidation mechanisms. The team handles token lifecycle management manually rather than using time-based expiration.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#42
File: OsmoDoc.API/Program.cs:98-112
Timestamp: 2025-06-20T14:36:43.563Z
Learning: In the OsmoDoc project, JWT tokens are intentionally designed to be non-expiring. The custom LifetimeValidator in Program.cs always returns true to prevent token expiration validation, which is by design rather than a bug.
OsmoDoc.API/Helpers/Base64StringHelper.cs (3)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
OsmoDoc.API/OsmoDoc.API.sln (4)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Helpers/AutoMappingProfile.cs:9-11
Timestamp: 2025-07-04T03:10:35.518Z
Learning: osm-Jatin indicated that AutoMapper mapping configurations are not needed in the empty AutoMappingProfile constructor in the OsmoDoc project, suggesting they may not be using AutoMapper for certain mappings or have alternative approaches.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
OsmoDoc.API/OsmoDoc.API.csproj (4)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Helpers/AutoMappingProfile.cs:9-11
Timestamp: 2025-07-04T03:10:35.518Z
Learning: osm-Jatin indicated that AutoMapper mapping configurations are not needed in the empty AutoMappingProfile constructor in the OsmoDoc project, suggesting they may not be using AutoMapper for certain mappings or have alternative approaches.
docs/site/10.0.2/api/OsmoDoc.Word.Models.html (8)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:298-311
Timestamp: 2025-06-21T17:11:15.672Z
Learning: In the OsmoDoc Word document generation code, when checking mainDocumentPart for null before populating a drawings collection, an additional null check inside the foreach loop is redundant because if mainDocumentPart was null, the drawings collection would remain empty and the loop wouldn't execute.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists with `= new()`, and DTOs are also initialized properly. This pattern ensures that the properties are never null, making additional null checks unnecessary for these specific properties in the WordDocumentGenerator.GenerateDocumentByTemplate method.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists by default, and in WordGenerationRequestDTO, the DocumentData property is initialized with `= new();`. This pattern ensures that the properties are never null, though the parameter itself could still be null if explicitly passed as null.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc/Word/WordDocumentGenerator.cs:33-44
Timestamp: 2025-07-04T03:15:02.254Z
Learning: In the OsmoDoc project, empty DocumentData collections (Placeholders, TablesData, Images) are valid scenarios when users want to generate documents without any placeholder replacements, table data, or images. The DocumentData parameter is always initialized at the controller level, but null checks are still added for defensive programming.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:46-47
Timestamp: 2025-06-21T16:48:17.115Z
Learning: In the OsmoDoc project, the DocumentData class properties Placeholders and TablesData are initialized with empty lists using `= new()`, which means they are never null and don't require null-coalescing operators when accessed.
docs/site/10.0.2/api/OsmoDoc.Word.Models.ContentType.html (3)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc/Word/WordDocumentGenerator.cs:33-44
Timestamp: 2025-07-04T03:15:02.254Z
Learning: In the OsmoDoc project, empty DocumentData collections (Placeholders, TablesData, Images) are valid scenarios when users want to generate documents without any placeholder replacements, table data, or images. The DocumentData parameter is always initialized at the controller level, but null checks are still added for defensive programming.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists with `= new()`, and DTOs are also initialized properly. This pattern ensures that the properties are never null, making additional null checks unnecessary for these specific properties in the WordDocumentGenerator.GenerateDocumentByTemplate method.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists by default, and in WordGenerationRequestDTO, the DocumentData property is initialized with `= new();`. This pattern ensures that the properties are never null, though the parameter itself could still be null if explicitly passed as null.
docs/site/10.0.2/api/OsmoDoc.Word.Models.TableData.html (4)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc/Word/WordDocumentGenerator.cs:33-44
Timestamp: 2025-07-04T03:15:02.254Z
Learning: In the OsmoDoc project, empty DocumentData collections (Placeholders, TablesData, Images) are valid scenarios when users want to generate documents without any placeholder replacements, table data, or images. The DocumentData parameter is always initialized at the controller level, but null checks are still added for defensive programming.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists with `= new()`, and DTOs are also initialized properly. This pattern ensures that the properties are never null, making additional null checks unnecessary for these specific properties in the WordDocumentGenerator.GenerateDocumentByTemplate method.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists by default, and in WordGenerationRequestDTO, the DocumentData property is initialized with `= new();`. This pattern ensures that the properties are never null, though the parameter itself could still be null if explicitly passed as null.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:46-47
Timestamp: 2025-06-21T16:48:17.115Z
Learning: In the OsmoDoc project, the DocumentData class properties Placeholders and TablesData are initialized with empty lists using `= new()`, which means they are never null and don't require null-coalescing operators when accessed.
OsmoDoc/Pdf/Models/ContentMetaData.cs (6)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Pdf/PdfDocumentGenerator.cs:24-37
Timestamp: 2025-06-18T14:03:39.731Z
Learning: In OsmoDoc PdfDocumentGenerator.GeneratePdf method, an empty metaDataList is a valid scenario when users want to convert HTML/EJS templates to PDF without any placeholder replacements. Only null metaDataList should be validated, not empty ones.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:46-47
Timestamp: 2025-06-21T16:48:17.115Z
Learning: In the OsmoDoc project, the DocumentData class properties Placeholders and TablesData are initialized with empty lists using `= new()`, which means they are never null and don't require null-coalescing operators when accessed.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists by default, and in WordGenerationRequestDTO, the DocumentData property is initialized with `= new();`. This pattern ensures that the properties are never null, though the parameter itself could still be null if explicitly passed as null.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists with `= new()`, and DTOs are also initialized properly. This pattern ensures that the properties are never null, making additional null checks unnecessary for these specific properties in the WordDocumentGenerator.GenerateDocumentByTemplate method.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc/Word/WordDocumentGenerator.cs:33-44
Timestamp: 2025-07-04T03:15:02.254Z
Learning: In the OsmoDoc project, empty DocumentData collections (Placeholders, TablesData, Images) are valid scenarios when users want to generate documents without any placeholder replacements, table data, or images. The DocumentData parameter is always initialized at the controller level, but null checks are still added for defensive programming.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Pdf/PdfDocumentGenerator.cs:84-92
Timestamp: 2025-06-18T14:44:46.570Z
Learning: osm-Jatin prefers to document input requirements clearly in the README file rather than adding runtime validation code for scenarios like null/duplicate placeholders in the OsmoDoc PDF generation functionality.
.github/PULL_REQUEST_TEMPLATE/pull_request_template_api.md (3)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Pdf/PdfDocumentGenerator.cs:84-92
Timestamp: 2025-06-18T14:44:46.570Z
Learning: osm-Jatin prefers to document input requirements clearly in the README file rather than adding runtime validation code for scenarios like null/duplicate placeholders in the OsmoDoc PDF generation functionality.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc.API/Controllers/WordController.cs:38-60
Timestamp: 2025-06-18T15:05:30.284Z
Learning: osm-Jatin prefers to create separate GitHub issues to track technical debt and improvement suggestions that are out of scope for the current PR, such as temporary file cleanup concerns in the OsmoDoc project.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc/Pdf/Models/OsmoDocPdfConfig.cs:3-7
Timestamp: 2025-07-04T03:19:33.211Z
Learning: osm-Jatin prefers to defer non-critical code improvements like thread safety enhancements and validation logic when they are not essential for the current PR scope, preferring to keep changes focused on the main objectives.
docs/site/10.0.2/api/OsmoDoc.Word.Models.ParentBody.html (5)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:298-311
Timestamp: 2025-06-21T17:11:15.672Z
Learning: In the OsmoDoc Word document generation code, when checking mainDocumentPart for null before populating a drawings collection, an additional null check inside the foreach loop is redundant because if mainDocumentPart was null, the drawings collection would remain empty and the loop wouldn't execute.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc/Word/WordDocumentGenerator.cs:33-44
Timestamp: 2025-07-04T03:15:02.254Z
Learning: In the OsmoDoc project, empty DocumentData collections (Placeholders, TablesData, Images) are valid scenarios when users want to generate documents without any placeholder replacements, table data, or images. The DocumentData parameter is always initialized at the controller level, but null checks are still added for defensive programming.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists by default, and in WordGenerationRequestDTO, the DocumentData property is initialized with `= new();`. This pattern ensures that the properties are never null, though the parameter itself could still be null if explicitly passed as null.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:46-47
Timestamp: 2025-06-21T16:48:17.115Z
Learning: In the OsmoDoc project, the DocumentData class properties Placeholders and TablesData are initialized with empty lists using `= new()`, which means they are never null and don't require null-coalescing operators when accessed.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists with `= new()`, and DTOs are also initialized properly. This pattern ensures that the properties are never null, making additional null checks unnecessary for these specific properties in the WordDocumentGenerator.GenerateDocumentByTemplate method.
OsmoDoc.API/Helpers/AuthenticationHelper.cs (6)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#42
File: OsmoDoc.API/Program.cs:98-112
Timestamp: 2025-06-20T14:36:43.563Z
Learning: In the OsmoDoc project, JWT tokens are intentionally designed to be non-expiring. The custom LifetimeValidator in Program.cs always returns true to prevent token expiration validation, which is by design rather than a bug.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#42
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:18-24
Timestamp: 2025-06-20T14:37:36.118Z
Learning: In OsmoDoc.API, JWT tokens are intentionally created without expiration because the application uses Redis as the authoritative source for token validity. Tokens are stored in Redis when issued and can be manually revoked by removing them from Redis, providing centralized token management and immediate invalidation capability.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#41
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:10-27
Timestamp: 2025-06-19T04:10:32.232Z
Learning: In the OsmoDoc project, non-expiry JWT tokens are used intentionally with manual invalidation mechanisms. The team handles token lifecycle management manually rather than using time-based expiration.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:11-24
Timestamp: 2025-06-22T13:55:51.706Z
Learning: In the OsmoDoc project, JWT tokens are intentionally created without expiration dates. The team has chosen to implement manual token invalidation through Redis storage instead of using JWT expiration claims. Tokens are stored in Redis and can be manually revoked using the /api/revoke endpoint. This design decision was made in PR #42 where the user stated "Not needed, we will make the token inactive manually for now."
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#41
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:10-27
Timestamp: 2025-06-19T04:10:32.232Z
Learning: In the OsmoDoc project, they use a hybrid JWT + Redis token management approach: non-expiry JWT tokens are generated and stored in Redis for validation and manual revocation. The system includes RedisTokenService for token storage/validation and dedicated revocation endpoints, allowing stateless JWT benefits while maintaining token lifecycle control.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#51
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:10-27
Timestamp: 2025-07-04T14:44:16.407Z
Learning: In the OsmoDoc project, the team has determined that adding issuer and audience claims to JWT tokens is not required for their specific use case. They have a comprehensive token management system with Redis-based revocation that meets their security requirements without needing additional JWT validation features.
docs/site/10.0.2/api/OsmoDocWord.html (6)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists with `= new()`, and DTOs are also initialized properly. This pattern ensures that the properties are never null, making additional null checks unnecessary for these specific properties in the WordDocumentGenerator.GenerateDocumentByTemplate method.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:298-311
Timestamp: 2025-06-21T17:11:15.672Z
Learning: In the OsmoDoc Word document generation code, when checking mainDocumentPart for null before populating a drawings collection, an additional null check inside the foreach loop is redundant because if mainDocumentPart was null, the drawings collection would remain empty and the loop wouldn't execute.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists by default, and in WordGenerationRequestDTO, the DocumentData property is initialized with `= new();`. This pattern ensures that the properties are never null, though the parameter itself could still be null if explicitly passed as null.
OsmoDoc.API/Helpers/CommonMethodsHelper.cs (5)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#41
File: OsmoDoc.API/Controllers/WordController.cs:46-47
Timestamp: 2025-06-19T18:01:38.314Z
Learning: In the OsmoDoc project, the `CreateDirectoryIfNotExists` method in `CommonMethodsHelper` is designed to accept file paths as parameters. It internally uses `Path.GetDirectoryName(filePath)` to extract the directory path before creating the directory, so passing full file paths to this method is the correct usage pattern.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc.API/Controllers/PdfController.cs:34-46
Timestamp: 2025-06-18T14:34:35.161Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the PdfDocumentGenerator.GeneratePdf method only deletes its internal temporary files (converted HTML, modified HTML, JSON data files) but does not delete the input template files or output PDF files created by the controller, requiring manual cleanup in the controller to prevent disk bloat.
OsmoDoc.API/Helpers/AutoMappingProfile.cs (2)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Helpers/AutoMappingProfile.cs:9-11
Timestamp: 2025-07-04T03:10:35.518Z
Learning: osm-Jatin indicated that AutoMapper mapping configurations are not needed in the empty AutoMappingProfile constructor in the OsmoDoc project, suggesting they may not be using AutoMapper for certain mappings or have alternative approaches.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists with `= new()`, and DTOs are also initialized properly. This pattern ensures that the properties are never null, making additional null checks unnecessary for these specific properties in the WordDocumentGenerator.GenerateDocumentByTemplate method.
docs/site/10.0.2/api/OsmoDoc.Word.Models.DocumentData.html (5)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc/Word/WordDocumentGenerator.cs:33-44
Timestamp: 2025-07-04T03:15:02.254Z
Learning: In the OsmoDoc project, empty DocumentData collections (Placeholders, TablesData, Images) are valid scenarios when users want to generate documents without any placeholder replacements, table data, or images. The DocumentData parameter is always initialized at the controller level, but null checks are still added for defensive programming.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists with `= new()`, and DTOs are also initialized properly. This pattern ensures that the properties are never null, making additional null checks unnecessary for these specific properties in the WordDocumentGenerator.GenerateDocumentByTemplate method.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists by default, and in WordGenerationRequestDTO, the DocumentData property is initialized with `= new();`. This pattern ensures that the properties are never null, though the parameter itself could still be null if explicitly passed as null.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:46-47
Timestamp: 2025-06-21T16:48:17.115Z
Learning: In the OsmoDoc project, the DocumentData class properties Placeholders and TablesData are initialized with empty lists using `= new()`, which means they are never null and don't require null-coalescing operators when accessed.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:298-311
Timestamp: 2025-06-21T17:11:15.672Z
Learning: In the OsmoDoc Word document generation code, when checking mainDocumentPart for null before populating a drawings collection, an additional null check inside the foreach loop is redundant because if mainDocumentPart was null, the drawings collection would remain empty and the loop wouldn't execute.
README.md (10)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Pdf/PdfDocumentGenerator.cs:84-92
Timestamp: 2025-06-18T14:44:46.570Z
Learning: osm-Jatin prefers to document input requirements clearly in the README file rather than adding runtime validation code for scenarios like null/duplicate placeholders in the OsmoDoc PDF generation functionality.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc.API/Controllers/PdfController.cs:34-46
Timestamp: 2025-06-18T14:34:35.161Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the PdfDocumentGenerator.GeneratePdf method only deletes its internal temporary files (converted HTML, modified HTML, JSON data files) but does not delete the input template files or output PDF files created by the controller, requiring manual cleanup in the controller to prevent disk bloat.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists with `= new()`, and DTOs are also initialized properly. This pattern ensures that the properties are never null, making additional null checks unnecessary for these specific properties in the WordDocumentGenerator.GenerateDocumentByTemplate method.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists by default, and in WordGenerationRequestDTO, the DocumentData property is initialized with `= new();`. This pattern ensures that the properties are never null, though the parameter itself could still be null if explicitly passed as null.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc/Word/WordDocumentGenerator.cs:33-44
Timestamp: 2025-07-04T03:15:02.254Z
Learning: In the OsmoDoc project, empty DocumentData collections (Placeholders, TablesData, Images) are valid scenarios when users want to generate documents without any placeholder replacements, table data, or images. The DocumentData parameter is always initialized at the controller level, but null checks are still added for defensive programming.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:298-311
Timestamp: 2025-06-21T17:11:15.672Z
Learning: In the OsmoDoc Word document generation code, when checking mainDocumentPart for null before populating a drawings collection, an additional null check inside the foreach loop is redundant because if mainDocumentPart was null, the drawings collection would remain empty and the loop wouldn't execute.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:46-47
Timestamp: 2025-06-21T16:48:17.115Z
Learning: In the OsmoDoc project, the DocumentData class properties Placeholders and TablesData are initialized with empty lists using `= new()`, which means they are never null and don't require null-coalescing operators when accessed.
OsmoDoc.API/Models/RevokeTokenRequestDTO.cs (10)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Controllers/PdfController.cs:129-136
Timestamp: 2025-07-04T03:22:57.425Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the user initially thought that request parameter null checks were unnecessary because DocumentData property is initialized with `= new();` in the DTO. However, property initialization only prevents null properties within successfully created DTO objects, while the request parameter itself can still be null due to null request bodies, malformed JSON, or model binding failures.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:11-24
Timestamp: 2025-06-22T13:55:51.706Z
Learning: In the OsmoDoc project, JWT tokens are intentionally created without expiration dates. The team has chosen to implement manual token invalidation through Redis storage instead of using JWT expiration claims. Tokens are stored in Redis and can be manually revoked using the /api/revoke endpoint. This design decision was made in PR #42 where the user stated "Not needed, we will make the token inactive manually for now."
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#42
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:18-24
Timestamp: 2025-06-20T14:37:36.118Z
Learning: In OsmoDoc.API, JWT tokens are intentionally created without expiration because the application uses Redis as the authoritative source for token validity. Tokens are stored in Redis when issued and can be manually revoked by removing them from Redis, providing centralized token management and immediate invalidation capability.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#42
File: OsmoDoc/Services/RedisTokenStoreService.cs:18-24
Timestamp: 2025-06-20T14:36:49.953Z
Learning: In the OsmoDoc project, the team prefers manual token lifecycle management over automatic TTL expiration in Redis. They deliberately store tokens without expiration to maintain precise control over when tokens become invalid through their dedicated revocation endpoints, rather than relying on automatic expiration.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists by default, and in WordGenerationRequestDTO, the DocumentData property is initialized with `= new();`. This pattern ensures that the properties are never null, though the parameter itself could still be null if explicitly passed as null.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#51
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:10-27
Timestamp: 2025-07-04T14:44:16.407Z
Learning: In the OsmoDoc project, the team has determined that adding issuer and audience claims to JWT tokens is not required for their specific use case. They have a comprehensive token management system with Redis-based revocation that meets their security requirements without needing additional JWT validation features.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#42
File: OsmoDoc.API/Program.cs:98-112
Timestamp: 2025-06-20T14:36:43.563Z
Learning: In the OsmoDoc project, JWT tokens are intentionally designed to be non-expiring. The custom LifetimeValidator in Program.cs always returns true to prevent token expiration validation, which is by design rather than a bug.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#41
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:10-27
Timestamp: 2025-06-19T04:10:32.232Z
Learning: In the OsmoDoc project, they use a hybrid JWT + Redis token management approach: non-expiry JWT tokens are generated and stored in Redis for validation and manual revocation. The system includes RedisTokenService for token storage/validation and dedicated revocation endpoints, allowing stateless JWT benefits while maintaining token lifecycle control.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc.API/Controllers/LoginController.cs:25-31
Timestamp: 2025-06-21T16:53:18.086Z
Learning: In ASP.NET Core controllers, data annotations like [Required] and [EmailAddress] on DTO properties provide automatic model validation that eliminates the need for explicit null checks in most scenarios, as the framework handles validation before the action method executes.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#41
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:10-27
Timestamp: 2025-06-19T04:10:32.232Z
Learning: In the OsmoDoc project, non-expiry JWT tokens are used intentionally with manual invalidation mechanisms. The team handles token lifecycle management manually rather than using time-based expiration.
.env.example (3)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#41
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:10-27
Timestamp: 2025-06-19T04:10:32.232Z
Learning: In the OsmoDoc project, they use a hybrid JWT + Redis token management approach: non-expiry JWT tokens are generated and stored in Redis for validation and manual revocation. The system includes RedisTokenService for token storage/validation and dedicated revocation endpoints, allowing stateless JWT benefits while maintaining token lifecycle control.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#42
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:18-24
Timestamp: 2025-06-20T14:37:36.118Z
Learning: In OsmoDoc.API, JWT tokens are intentionally created without expiration because the application uses Redis as the authoritative source for token validity. Tokens are stored in Redis when issued and can be manually revoked by removing them from Redis, providing centralized token management and immediate invalidation capability.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:11-24
Timestamp: 2025-06-22T13:55:51.706Z
Learning: In the OsmoDoc project, JWT tokens are intentionally created without expiration dates. The team has chosen to implement manual token invalidation through Redis storage instead of using JWT expiration claims. Tokens are stored in Redis and can be manually revoked using the /api/revoke endpoint. This design decision was made in PR #42 where the user stated "Not needed, we will make the token inactive manually for now."
docs/site/10.0.2/api/OsmoDoc.Word.WordDocumentGenerator.html (8)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists with `= new()`, and DTOs are also initialized properly. This pattern ensures that the properties are never null, making additional null checks unnecessary for these specific properties in the WordDocumentGenerator.GenerateDocumentByTemplate method.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:298-311
Timestamp: 2025-06-21T17:11:15.672Z
Learning: In the OsmoDoc Word document generation code, when checking mainDocumentPart for null before populating a drawings collection, an additional null check inside the foreach loop is redundant because if mainDocumentPart was null, the drawings collection would remain empty and the loop wouldn't execute.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists by default, and in WordGenerationRequestDTO, the DocumentData property is initialized with `= new();`. This pattern ensures that the properties are never null, though the parameter itself could still be null if explicitly passed as null.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc/Word/WordDocumentGenerator.cs:33-44
Timestamp: 2025-07-04T03:15:02.254Z
Learning: In the OsmoDoc project, empty DocumentData collections (Placeholders, TablesData, Images) are valid scenarios when users want to generate documents without any placeholder replacements, table data, or images. The DocumentData parameter is always initialized at the controller level, but null checks are still added for defensive programming.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:46-47
Timestamp: 2025-06-21T16:48:17.115Z
Learning: In the OsmoDoc project, the DocumentData class properties Placeholders and TablesData are initialized with empty lists using `= new()`, which means they are never null and don't require null-coalescing operators when accessed.
OsmoDoc.sln (4)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Helpers/AutoMappingProfile.cs:9-11
Timestamp: 2025-07-04T03:10:35.518Z
Learning: osm-Jatin indicated that AutoMapper mapping configurations are not needed in the empty AutoMappingProfile constructor in the OsmoDoc project, suggesting they may not be using AutoMapper for certain mappings or have alternative approaches.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
OsmoDoc.API/Models/LoginRequestDTO.cs (3)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc.API/Controllers/LoginController.cs:25-31
Timestamp: 2025-06-21T16:53:18.086Z
Learning: In ASP.NET Core controllers, data annotations like [Required] and [EmailAddress] on DTO properties provide automatic model validation that eliminates the need for explicit null checks in most scenarios, as the framework handles validation before the action method executes.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Controllers/PdfController.cs:129-136
Timestamp: 2025-07-04T03:22:57.425Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the user initially thought that request parameter null checks were unnecessary because DocumentData property is initialized with `= new();` in the DTO. However, property initialization only prevents null properties within successfully created DTO objects, while the request parameter itself can still be null due to null request bodies, malformed JSON, or model binding failures.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists by default, and in WordGenerationRequestDTO, the DocumentData property is initialized with `= new();`. This pattern ensures that the properties are never null, though the parameter itself could still be null if explicitly passed as null.
docs/site/10.0.2/api/OsmoDoc.Word.Models.ContentData.html (4)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc/Word/WordDocumentGenerator.cs:33-44
Timestamp: 2025-07-04T03:15:02.254Z
Learning: In the OsmoDoc project, empty DocumentData collections (Placeholders, TablesData, Images) are valid scenarios when users want to generate documents without any placeholder replacements, table data, or images. The DocumentData parameter is always initialized at the controller level, but null checks are still added for defensive programming.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists with `= new()`, and DTOs are also initialized properly. This pattern ensures that the properties are never null, making additional null checks unnecessary for these specific properties in the WordDocumentGenerator.GenerateDocumentByTemplate method.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists by default, and in WordGenerationRequestDTO, the DocumentData property is initialized with `= new();`. This pattern ensures that the properties are never null, though the parameter itself could still be null if explicitly passed as null.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:46-47
Timestamp: 2025-06-21T16:48:17.115Z
Learning: In the OsmoDoc project, the DocumentData class properties Placeholders and TablesData are initialized with empty lists using `= new()`, which means they are never null and don't require null-coalescing operators when accessed.
OsmoDoc/OsmoDoc.csproj (10)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc.API/Controllers/PdfController.cs:34-46
Timestamp: 2025-06-18T14:34:35.161Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the PdfDocumentGenerator.GeneratePdf method only deletes its internal temporary files (converted HTML, modified HTML, JSON data files) but does not delete the input template files or output PDF files created by the controller, requiring manual cleanup in the controller to prevent disk bloat.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists with `= new()`, and DTOs are also initialized properly. This pattern ensures that the properties are never null, making additional null checks unnecessary for these specific properties in the WordDocumentGenerator.GenerateDocumentByTemplate method.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Controllers/PdfController.cs:129-136
Timestamp: 2025-07-04T03:22:57.425Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the user initially thought that request parameter null checks were unnecessary because DocumentData property is initialized with `= new();` in the DTO. However, property initialization only prevents null properties within successfully created DTO objects, while the request parameter itself can still be null due to null request bodies, malformed JSON, or model binding failures.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Pdf/PdfDocumentGenerator.cs:24-37
Timestamp: 2025-06-18T14:03:39.731Z
Learning: In OsmoDoc PdfDocumentGenerator.GeneratePdf method, an empty metaDataList is a valid scenario when users want to convert HTML/EJS templates to PDF without any placeholder replacements. Only null metaDataList should be validated, not empty ones.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Helpers/AutoMappingProfile.cs:9-11
Timestamp: 2025-07-04T03:10:35.518Z
Learning: osm-Jatin indicated that AutoMapper mapping configurations are not needed in the empty AutoMappingProfile constructor in the OsmoDoc project, suggesting they may not be using AutoMapper for certain mappings or have alternative approaches.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists by default, and in WordGenerationRequestDTO, the DocumentData property is initialized with `= new();`. This pattern ensures that the properties are never null, though the parameter itself could still be null if explicitly passed as null.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:46-47
Timestamp: 2025-06-21T16:48:17.115Z
Learning: In the OsmoDoc project, the DocumentData class properties Placeholders and TablesData are initialized with empty lists using `= new()`, which means they are never null and don't require null-coalescing operators when accessed.
OsmoDoc/Pdf/Models/DocumentData.cs (7)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:46-47
Timestamp: 2025-06-21T16:48:17.115Z
Learning: In the OsmoDoc project, the DocumentData class properties Placeholders and TablesData are initialized with empty lists using `= new()`, which means they are never null and don't require null-coalescing operators when accessed.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc/Word/WordDocumentGenerator.cs:33-44
Timestamp: 2025-07-04T03:15:02.254Z
Learning: In the OsmoDoc project, empty DocumentData collections (Placeholders, TablesData, Images) are valid scenarios when users want to generate documents without any placeholder replacements, table data, or images. The DocumentData parameter is always initialized at the controller level, but null checks are still added for defensive programming.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists by default, and in WordGenerationRequestDTO, the DocumentData property is initialized with `= new();`. This pattern ensures that the properties are never null, though the parameter itself could still be null if explicitly passed as null.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists with `= new()`, and DTOs are also initialized properly. This pattern ensures that the properties are never null, making additional null checks unnecessary for these specific properties in the WordDocumentGenerator.GenerateDocumentByTemplate method.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Pdf/PdfDocumentGenerator.cs:24-37
Timestamp: 2025-06-18T14:03:39.731Z
Learning: In OsmoDoc PdfDocumentGenerator.GeneratePdf method, an empty metaDataList is a valid scenario when users want to convert HTML/EJS templates to PDF without any placeholder replacements. Only null metaDataList should be validated, not empty ones.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Controllers/PdfController.cs:129-136
Timestamp: 2025-07-04T03:22:57.425Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the user initially thought that request parameter null checks were unnecessary because DocumentData property is initialized with `= new();` in the DTO. However, property initialization only prevents null properties within successfully created DTO objects, while the request parameter itself can still be null due to null request bodies, malformed JSON, or model binding failures.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Pdf/PdfDocumentGenerator.cs:84-92
Timestamp: 2025-06-18T14:44:46.570Z
Learning: osm-Jatin prefers to document input requirements clearly in the README file rather than adding runtime validation code for scenarios like null/duplicate placeholders in the OsmoDoc PDF generation functionality.
CONTRIBUTING.md (2)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Pdf/PdfDocumentGenerator.cs:84-92
Timestamp: 2025-06-18T14:44:46.570Z
Learning: osm-Jatin prefers to document input requirements clearly in the README file rather than adding runtime validation code for scenarios like null/duplicate placeholders in the OsmoDoc PDF generation functionality.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc.API/Controllers/WordController.cs:38-60
Timestamp: 2025-06-18T15:05:30.284Z
Learning: osm-Jatin prefers to create separate GitHub issues to track technical debt and improvement suggestions that are out of scope for the current PR, such as temporary file cleanup concerns in the OsmoDoc project.
OsmoDoc.API/Models/BaseResponse.cs (2)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Controllers/PdfController.cs:129-136
Timestamp: 2025-07-04T03:22:57.425Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the user initially thought that request parameter null checks were unnecessary because DocumentData property is initialized with `= new();` in the DTO. However, property initialization only prevents null properties within successfully created DTO objects, while the request parameter itself can still be null due to null request bodies, malformed JSON, or model binding failures.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc.API/Controllers/LoginController.cs:25-31
Timestamp: 2025-06-21T16:53:18.086Z
Learning: In ASP.NET Core controllers, data annotations like [Required] and [EmailAddress] on DTO properties provide automatic model validation that eliminates the need for explicit null checks in most scenarios, as the framework handles validation before the action method executes.
OsmoDoc/Word/Models/TableData.cs (4)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists by default, and in WordGenerationRequestDTO, the DocumentData property is initialized with `= new();`. This pattern ensures that the properties are never null, though the parameter itself could still be null if explicitly passed as null.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists with `= new()`, and DTOs are also initialized properly. This pattern ensures that the properties are never null, making additional null checks unnecessary for these specific properties in the WordDocumentGenerator.GenerateDocumentByTemplate method.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc/Word/WordDocumentGenerator.cs:33-44
Timestamp: 2025-07-04T03:15:02.254Z
Learning: In the OsmoDoc project, empty DocumentData collections (Placeholders, TablesData, Images) are valid scenarios when users want to generate documents without any placeholder replacements, table data, or images. The DocumentData parameter is always initialized at the controller level, but null checks are still added for defensive programming.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:46-47
Timestamp: 2025-06-21T16:48:17.115Z
Learning: In the OsmoDoc project, the DocumentData class properties Placeholders and TablesData are initialized with empty lists using `= new()`, which means they are never null and don't require null-coalescing operators when accessed.
OsmoDoc.API/Models/PdfGenerationRequestDTO.cs (5)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Controllers/PdfController.cs:129-136
Timestamp: 2025-07-04T03:22:57.425Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the user initially thought that request parameter null checks were unnecessary because DocumentData property is initialized with `= new();` in the DTO. However, property initialization only prevents null properties within successfully created DTO objects, while the request parameter itself can still be null due to null request bodies, malformed JSON, or model binding failures.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists by default, and in WordGenerationRequestDTO, the DocumentData property is initialized with `= new();`. This pattern ensures that the properties are never null, though the parameter itself could still be null if explicitly passed as null.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc.API/Controllers/PdfController.cs:34-46
Timestamp: 2025-06-18T14:34:35.161Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the PdfDocumentGenerator.GeneratePdf method only deletes its internal temporary files (converted HTML, modified HTML, JSON data files) but does not delete the input template files or output PDF files created by the controller, requiring manual cleanup in the controller to prevent disk bloat.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists with `= new()`, and DTOs are also initialized properly. This pattern ensures that the properties are never null, making additional null checks unnecessary for these specific properties in the WordDocumentGenerator.GenerateDocumentByTemplate method.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc.API/Controllers/LoginController.cs:25-31
Timestamp: 2025-06-21T16:53:18.086Z
Learning: In ASP.NET Core controllers, data annotations like [Required] and [EmailAddress] on DTO properties provide automatic model validation that eliminates the need for explicit null checks in most scenarios, as the framework handles validation before the action method executes.
Dockerfile (3)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
OsmoDoc/Word/Models/Enums.cs (3)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists with `= new()`, and DTOs are also initialized properly. This pattern ensures that the properties are never null, making additional null checks unnecessary for these specific properties in the WordDocumentGenerator.GenerateDocumentByTemplate method.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists by default, and in WordGenerationRequestDTO, the DocumentData property is initialized with `= new();`. This pattern ensures that the properties are never null, though the parameter itself could still be null if explicitly passed as null.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:46-47
Timestamp: 2025-06-21T16:48:17.115Z
Learning: In the OsmoDoc project, the DocumentData class properties Placeholders and TablesData are initialized with empty lists using `= new()`, which means they are never null and don't require null-coalescing operators when accessed.
OsmoDoc/Services/RedisTokenStoreService.cs (8)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#41
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:10-27
Timestamp: 2025-06-19T04:10:32.232Z
Learning: In the OsmoDoc project, they use a hybrid JWT + Redis token management approach: non-expiry JWT tokens are generated and stored in Redis for validation and manual revocation. The system includes RedisTokenService for token storage/validation and dedicated revocation endpoints, allowing stateless JWT benefits while maintaining token lifecycle control.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#42
File: OsmoDoc/Services/RedisTokenStoreService.cs:18-24
Timestamp: 2025-06-20T14:36:49.953Z
Learning: In the OsmoDoc project, the team prefers manual token lifecycle management over automatic TTL expiration in Redis. They deliberately store tokens without expiration to maintain precise control over when tokens become invalid through their dedicated revocation endpoints, rather than relying on automatic expiration.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#42
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:18-24
Timestamp: 2025-06-20T14:37:36.118Z
Learning: In OsmoDoc.API, JWT tokens are intentionally created without expiration because the application uses Redis as the authoritative source for token validity. Tokens are stored in Redis when issued and can be manually revoked by removing them from Redis, providing centralized token management and immediate invalidation capability.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:11-24
Timestamp: 2025-06-22T13:55:51.706Z
Learning: In the OsmoDoc project, JWT tokens are intentionally created without expiration dates. The team has chosen to implement manual token invalidation through Redis storage instead of using JWT expiration claims. Tokens are stored in Redis and can be manually revoked using the /api/revoke endpoint. This design decision was made in PR #42 where the user stated "Not needed, we will make the token inactive manually for now."
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#42
File: OsmoDoc/Services/Interfaces/IRedisTokenStoreService.cs:5-10
Timestamp: 2025-06-20T15:03:58.820Z
Learning: StackExchange.Redis basic methods (StringSetAsync, KeyExistsAsync, KeyDeleteAsync) don't directly support CancellationToken parameters. The recommended approach is to use cancellationToken.ThrowIfCancellationRequested() for early cancellation detection before Redis operations.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#51
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:10-27
Timestamp: 2025-07-04T14:44:16.407Z
Learning: In the OsmoDoc project, the team has determined that adding issuer and audience claims to JWT tokens is not required for their specific use case. They have a comprehensive token management system with Redis-based revocation that meets their security requirements without needing additional JWT validation features.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#42
File: OsmoDoc.API/Program.cs:98-112
Timestamp: 2025-06-20T14:36:43.563Z
Learning: In the OsmoDoc project, JWT tokens are intentionally designed to be non-expiring. The custom LifetimeValidator in Program.cs always returns true to prevent token expiration validation, which is by design rather than a bug.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#41
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:10-27
Timestamp: 2025-06-19T04:10:32.232Z
Learning: In the OsmoDoc project, non-expiry JWT tokens are used intentionally with manual invalidation mechanisms. The team handles token lifecycle management manually rather than using time-based expiration.
OsmoDoc.API/Controllers/WordController.cs (8)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists with `= new()`, and DTOs are also initialized properly. This pattern ensures that the properties are never null, making additional null checks unnecessary for these specific properties in the WordDocumentGenerator.GenerateDocumentByTemplate method.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc.API/Controllers/PdfController.cs:34-46
Timestamp: 2025-06-18T14:34:35.161Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the PdfDocumentGenerator.GeneratePdf method only deletes its internal temporary files (converted HTML, modified HTML, JSON data files) but does not delete the input template files or output PDF files created by the controller, requiring manual cleanup in the controller to prevent disk bloat.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists by default, and in WordGenerationRequestDTO, the DocumentData property is initialized with `= new();`. This pattern ensures that the properties are never null, though the parameter itself could still be null if explicitly passed as null.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Controllers/PdfController.cs:129-136
Timestamp: 2025-07-04T03:22:57.425Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the user initially thought that request parameter null checks were unnecessary because DocumentData property is initialized with `= new();` in the DTO. However, property initialization only prevents null properties within successfully created DTO objects, while the request parameter itself can still be null due to null request bodies, malformed JSON, or model binding failures.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:298-311
Timestamp: 2025-06-21T17:11:15.672Z
Learning: In the OsmoDoc Word document generation code, when checking mainDocumentPart for null before populating a drawings collection, an additional null check inside the foreach loop is redundant because if mainDocumentPart was null, the drawings collection would remain empty and the loop wouldn't execute.
OsmoDoc/Word/Models/ContentData.cs (4)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc/Word/WordDocumentGenerator.cs:33-44
Timestamp: 2025-07-04T03:15:02.254Z
Learning: In the OsmoDoc project, empty DocumentData collections (Placeholders, TablesData, Images) are valid scenarios when users want to generate documents without any placeholder replacements, table data, or images. The DocumentData parameter is always initialized at the controller level, but null checks are still added for defensive programming.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists with `= new()`, and DTOs are also initialized properly. This pattern ensures that the properties are never null, making additional null checks unnecessary for these specific properties in the WordDocumentGenerator.GenerateDocumentByTemplate method.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists by default, and in WordGenerationRequestDTO, the DocumentData property is initialized with `= new();`. This pattern ensures that the properties are never null, though the parameter itself could still be null if explicitly passed as null.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:46-47
Timestamp: 2025-06-21T16:48:17.115Z
Learning: In the OsmoDoc project, the DocumentData class properties Placeholders and TablesData are initialized with empty lists using `= new()`, which means they are never null and don't require null-coalescing operators when accessed.
OsmoDoc/Services/Interfaces/IRedisTokenStoreService.cs (6)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#41
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:10-27
Timestamp: 2025-06-19T04:10:32.232Z
Learning: In the OsmoDoc project, they use a hybrid JWT + Redis token management approach: non-expiry JWT tokens are generated and stored in Redis for validation and manual revocation. The system includes RedisTokenService for token storage/validation and dedicated revocation endpoints, allowing stateless JWT benefits while maintaining token lifecycle control.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#42
File: OsmoDoc/Services/RedisTokenStoreService.cs:18-24
Timestamp: 2025-06-20T14:36:49.953Z
Learning: In the OsmoDoc project, the team prefers manual token lifecycle management over automatic TTL expiration in Redis. They deliberately store tokens without expiration to maintain precise control over when tokens become invalid through their dedicated revocation endpoints, rather than relying on automatic expiration.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#42
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:18-24
Timestamp: 2025-06-20T14:37:36.118Z
Learning: In OsmoDoc.API, JWT tokens are intentionally created without expiration because the application uses Redis as the authoritative source for token validity. Tokens are stored in Redis when issued and can be manually revoked by removing them from Redis, providing centralized token management and immediate invalidation capability.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:11-24
Timestamp: 2025-06-22T13:55:51.706Z
Learning: In the OsmoDoc project, JWT tokens are intentionally created without expiration dates. The team has chosen to implement manual token invalidation through Redis storage instead of using JWT expiration claims. Tokens are stored in Redis and can be manually revoked using the /api/revoke endpoint. This design decision was made in PR #42 where the user stated "Not needed, we will make the token inactive manually for now."
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#42
File: OsmoDoc/Services/Interfaces/IRedisTokenStoreService.cs:5-10
Timestamp: 2025-06-20T15:03:58.820Z
Learning: StackExchange.Redis basic methods (StringSetAsync, KeyExistsAsync, KeyDeleteAsync) don't directly support CancellationToken parameters. The recommended approach is to use cancellationToken.ThrowIfCancellationRequested() for early cancellation detection before Redis operations.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#51
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:10-27
Timestamp: 2025-07-04T14:44:16.407Z
Learning: In the OsmoDoc project, the team has determined that adding issuer and audience claims to JWT tokens is not required for their specific use case. They have a comprehensive token management system with Redis-based revocation that meets their security requirements without needing additional JWT validation features.
OsmoDoc/Word/Models/DocumentData.cs (8)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc/Word/WordDocumentGenerator.cs:33-44
Timestamp: 2025-07-04T03:15:02.254Z
Learning: In the OsmoDoc project, empty DocumentData collections (Placeholders, TablesData, Images) are valid scenarios when users want to generate documents without any placeholder replacements, table data, or images. The DocumentData parameter is always initialized at the controller level, but null checks are still added for defensive programming.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists with `= new()`, and DTOs are also initialized properly. This pattern ensures that the properties are never null, making additional null checks unnecessary for these specific properties in the WordDocumentGenerator.GenerateDocumentByTemplate method.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists by default, and in WordGenerationRequestDTO, the DocumentData property is initialized with `= new();`. This pattern ensures that the properties are never null, though the parameter itself could still be null if explicitly passed as null.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:46-47
Timestamp: 2025-06-21T16:48:17.115Z
Learning: In the OsmoDoc project, the DocumentData class properties Placeholders and TablesData are initialized with empty lists using `= new()`, which means they are never null and don't require null-coalescing operators when accessed.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:298-311
Timestamp: 2025-06-21T17:11:15.672Z
Learning: In the OsmoDoc Word document generation code, when checking mainDocumentPart for null before populating a drawings collection, an additional null check inside the foreach loop is redundant because if mainDocumentPart was null, the drawings collection would remain empty and the loop wouldn't execute.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
OsmoDoc/Word/Models/ImageData.cs (7)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc/Word/WordDocumentGenerator.cs:33-44
Timestamp: 2025-07-04T03:15:02.254Z
Learning: In the OsmoDoc project, empty DocumentData collections (Placeholders, TablesData, Images) are valid scenarios when users want to generate documents without any placeholder replacements, table data, or images. The DocumentData parameter is always initialized at the controller level, but null checks are still added for defensive programming.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists by default, and in WordGenerationRequestDTO, the DocumentData property is initialized with `= new();`. This pattern ensures that the properties are never null, though the parameter itself could still be null if explicitly passed as null.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists with `= new()`, and DTOs are also initialized properly. This pattern ensures that the properties are never null, making additional null checks unnecessary for these specific properties in the WordDocumentGenerator.GenerateDocumentByTemplate method.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:46-47
Timestamp: 2025-06-21T16:48:17.115Z
Learning: In the OsmoDoc project, the DocumentData class properties Placeholders and TablesData are initialized with empty lists using `= new()`, which means they are never null and don't require null-coalescing operators when accessed.
OsmoDoc/Pdf/Models/OsmoDocPdfConfig.cs (2)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc.API/Controllers/PdfController.cs:34-46
Timestamp: 2025-06-18T14:34:35.161Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the PdfDocumentGenerator.GeneratePdf method only deletes its internal temporary files (converted HTML, modified HTML, JSON data files) but does not delete the input template files or output PDF files created by the controller, requiring manual cleanup in the controller to prevent disk bloat.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Controllers/PdfController.cs:129-136
Timestamp: 2025-07-04T03:22:57.425Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the user initially thought that request parameter null checks were unnecessary because DocumentData property is initialized with `= new();` in the DTO. However, property initialization only prevents null properties within successfully created DTO objects, while the request parameter itself can still be null due to null request bodies, malformed JSON, or model binding failures.
OsmoDoc.API/Controllers/LoginController.cs (5)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#41
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:10-27
Timestamp: 2025-06-19T04:10:32.232Z
Learning: In the OsmoDoc project, they use a hybrid JWT + Redis token management approach: non-expiry JWT tokens are generated and stored in Redis for validation and manual revocation. The system includes RedisTokenService for token storage/validation and dedicated revocation endpoints, allowing stateless JWT benefits while maintaining token lifecycle control.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#42
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:18-24
Timestamp: 2025-06-20T14:37:36.118Z
Learning: In OsmoDoc.API, JWT tokens are intentionally created without expiration because the application uses Redis as the authoritative source for token validity. Tokens are stored in Redis when issued and can be manually revoked by removing them from Redis, providing centralized token management and immediate invalidation capability.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:11-24
Timestamp: 2025-06-22T13:55:51.706Z
Learning: In the OsmoDoc project, JWT tokens are intentionally created without expiration dates. The team has chosen to implement manual token invalidation through Redis storage instead of using JWT expiration claims. Tokens are stored in Redis and can be manually revoked using the /api/revoke endpoint. This design decision was made in PR #42 where the user stated "Not needed, we will make the token inactive manually for now."
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Controllers/PdfController.cs:129-136
Timestamp: 2025-07-04T03:22:57.425Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the user initially thought that request parameter null checks were unnecessary because DocumentData property is initialized with `= new();` in the DTO. However, property initialization only prevents null properties within successfully created DTO objects, while the request parameter itself can still be null due to null request bodies, malformed JSON, or model binding failures.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Controllers/LoginController.cs:42-43
Timestamp: 2025-07-04T03:45:35.720Z
Learning: In the OsmoDoc project, the team follows a specific logging pattern that includes logging both the exception message and stack trace using `_logger.LogError(ex.Message)` and `_logger.LogError(ex.StackTrace)` as seen in LoginController.cs. This is their established pattern for error logging across the application.
docs/site/xrefmap.yml (8)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists with `= new()`, and DTOs are also initialized properly. This pattern ensures that the properties are never null, making additional null checks unnecessary for these specific properties in the WordDocumentGenerator.GenerateDocumentByTemplate method.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists by default, and in WordGenerationRequestDTO, the DocumentData property is initialized with `= new();`. This pattern ensures that the properties are never null, though the parameter itself could still be null if explicitly passed as null.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc/Word/WordDocumentGenerator.cs:33-44
Timestamp: 2025-07-04T03:15:02.254Z
Learning: In the OsmoDoc project, empty DocumentData collections (Placeholders, TablesData, Images) are valid scenarios when users want to generate documents without any placeholder replacements, table data, or images. The DocumentData parameter is always initialized at the controller level, but null checks are still added for defensive programming.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:298-311
Timestamp: 2025-06-21T17:11:15.672Z
Learning: In the OsmoDoc Word document generation code, when checking mainDocumentPart for null before populating a drawings collection, an additional null check inside the foreach loop is redundant because if mainDocumentPart was null, the drawings collection would remain empty and the loop wouldn't execute.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc.API/Controllers/PdfController.cs:34-46
Timestamp: 2025-06-18T14:34:35.161Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the PdfDocumentGenerator.GeneratePdf method only deletes its internal temporary files (converted HTML, modified HTML, JSON data files) but does not delete the input template files or output PDF files created by the controller, requiring manual cleanup in the controller to prevent disk bloat.
OsmoDoc.API/Models/WordGenerationRequestDTO.cs (8)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists by default, and in WordGenerationRequestDTO, the DocumentData property is initialized with `= new();`. This pattern ensures that the properties are never null, though the parameter itself could still be null if explicitly passed as null.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists with `= new()`, and DTOs are also initialized properly. This pattern ensures that the properties are never null, making additional null checks unnecessary for these specific properties in the WordDocumentGenerator.GenerateDocumentByTemplate method.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Controllers/PdfController.cs:129-136
Timestamp: 2025-07-04T03:22:57.425Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the user initially thought that request parameter null checks were unnecessary because DocumentData property is initialized with `= new();` in the DTO. However, property initialization only prevents null properties within successfully created DTO objects, while the request parameter itself can still be null due to null request bodies, malformed JSON, or model binding failures.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc/Word/WordDocumentGenerator.cs:33-44
Timestamp: 2025-07-04T03:15:02.254Z
Learning: In the OsmoDoc project, empty DocumentData collections (Placeholders, TablesData, Images) are valid scenarios when users want to generate documents without any placeholder replacements, table data, or images. The DocumentData parameter is always initialized at the controller level, but null checks are still added for defensive programming.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:46-47
Timestamp: 2025-06-21T16:48:17.115Z
Learning: In the OsmoDoc project, the DocumentData class properties Placeholders and TablesData are initialized with empty lists using `= new()`, which means they are never null and don't require null-coalescing operators when accessed.
OsmoDoc/Pdf/PdfDocumentGenerator.cs (7)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc.API/Controllers/PdfController.cs:34-46
Timestamp: 2025-06-18T14:34:35.161Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the PdfDocumentGenerator.GeneratePdf method only deletes its internal temporary files (converted HTML, modified HTML, JSON data files) but does not delete the input template files or output PDF files created by the controller, requiring manual cleanup in the controller to prevent disk bloat.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Pdf/PdfDocumentGenerator.cs:24-37
Timestamp: 2025-06-18T14:03:39.731Z
Learning: In OsmoDoc PdfDocumentGenerator.GeneratePdf method, an empty metaDataList is a valid scenario when users want to convert HTML/EJS templates to PDF without any placeholder replacements. Only null metaDataList should be validated, not empty ones.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists with `= new()`, and DTOs are also initialized properly. This pattern ensures that the properties are never null, making additional null checks unnecessary for these specific properties in the WordDocumentGenerator.GenerateDocumentByTemplate method.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Controllers/PdfController.cs:129-136
Timestamp: 2025-07-04T03:22:57.425Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the user initially thought that request parameter null checks were unnecessary because DocumentData property is initialized with `= new();` in the DTO. However, property initialization only prevents null properties within successfully created DTO objects, while the request parameter itself can still be null due to null request bodies, malformed JSON, or model binding failures.
OsmoDoc/Word/WordDocumentGenerator.cs (10)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists with `= new()`, and DTOs are also initialized properly. This pattern ensures that the properties are never null, making additional null checks unnecessary for these specific properties in the WordDocumentGenerator.GenerateDocumentByTemplate method.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:32-47
Timestamp: 2025-06-21T17:00:19.937Z
Learning: In the OsmoDoc project, DocumentData class has its Placeholders and TablesData properties initialized to empty lists by default, and in WordGenerationRequestDTO, the DocumentData property is initialized with `= new();`. This pattern ensures that the properties are never null, though the parameter itself could still be null if explicitly passed as null.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc/Word/WordDocumentGenerator.cs:33-44
Timestamp: 2025-07-04T03:15:02.254Z
Learning: In the OsmoDoc project, empty DocumentData collections (Placeholders, TablesData, Images) are valid scenarios when users want to generate documents without any placeholder replacements, table data, or images. The DocumentData parameter is always initialized at the controller level, but null checks are still added for defensive programming.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc.API/Controllers/PdfController.cs:34-46
Timestamp: 2025-06-18T14:34:35.161Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the PdfDocumentGenerator.GeneratePdf method only deletes its internal temporary files (converted HTML, modified HTML, JSON data files) but does not delete the input template files or output PDF files created by the controller, requiring manual cleanup in the controller to prevent disk bloat.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:46-47
Timestamp: 2025-06-21T16:48:17.115Z
Learning: In the OsmoDoc project, the DocumentData class properties Placeholders and TablesData are initialized with empty lists using `= new()`, which means they are never null and don't require null-coalescing operators when accessed.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#42
File: OsmoDoc/Word/WordDocumentGenerator.cs:0-0
Timestamp: 2025-06-20T14:47:35.545Z
Learning: NPOI's XWPFDocument.Write method does not support async operations (WriteAsync is not available), so when working with NPOI Word document generation, synchronous write operations should be used rather than attempting to make them async.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#43
File: OsmoDoc/Word/WordDocumentGenerator.cs:298-311
Timestamp: 2025-06-21T17:11:15.672Z
Learning: In the OsmoDoc Word document generation code, when checking mainDocumentPart for null before populating a drawings collection, an additional null check inside the foreach loop is redundant because if mainDocumentPart was null, the drawings collection would remain empty and the loop wouldn't execute.
OsmoDoc.API/Program.cs (9)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#42
File: OsmoDoc.API/Program.cs:98-112
Timestamp: 2025-06-20T14:36:43.563Z
Learning: In the OsmoDoc project, JWT tokens are intentionally designed to be non-expiring. The custom LifetimeValidator in Program.cs always returns true to prevent token expiration validation, which is by design rather than a bug.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Controllers/PdfController.cs:129-136
Timestamp: 2025-07-04T03:22:57.425Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the user initially thought that request parameter null checks were unnecessary because DocumentData property is initialized with `= new();` in the DTO. However, property initialization only prevents null properties within successfully created DTO objects, while the request parameter itself can still be null due to null request bodies, malformed JSON, or model binding failures.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#41
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:10-27
Timestamp: 2025-06-19T04:10:32.232Z
Learning: In the OsmoDoc project, they use a hybrid JWT + Redis token management approach: non-expiry JWT tokens are generated and stored in Redis for validation and manual revocation. The system includes RedisTokenService for token storage/validation and dedicated revocation endpoints, allowing stateless JWT benefits while maintaining token lifecycle control.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#42
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:18-24
Timestamp: 2025-06-20T14:37:36.118Z
Learning: In OsmoDoc.API, JWT tokens are intentionally created without expiration because the application uses Redis as the authoritative source for token validity. Tokens are stored in Redis when issued and can be manually revoked by removing them from Redis, providing centralized token management and immediate invalidation capability.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#42
File: OsmoDoc/Services/RedisTokenStoreService.cs:18-24
Timestamp: 2025-06-20T14:36:49.953Z
Learning: In the OsmoDoc project, the team prefers manual token lifecycle management over automatic TTL expiration in Redis. They deliberately store tokens without expiration to maintain precise control over when tokens become invalid through their dedicated revocation endpoints, rather than relying on automatic expiration.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc.API/Controllers/PdfController.cs:34-46
Timestamp: 2025-06-18T14:34:35.161Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the PdfDocumentGenerator.GeneratePdf method only deletes its internal temporary files (converted HTML, modified HTML, JSON data files) but does not delete the input template files or output PDF files created by the controller, requiring manual cleanup in the controller to prevent disk bloat.
OsmoDoc.API/Controllers/PdfController.cs (5)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc.API/Controllers/PdfController.cs:34-46
Timestamp: 2025-06-18T14:34:35.161Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the PdfDocumentGenerator.GeneratePdf method only deletes its internal temporary files (converted HTML, modified HTML, JSON data files) but does not delete the input template files or output PDF files created by the controller, requiring manual cleanup in the controller to prevent disk bloat.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Controllers/PdfController.cs:129-136
Timestamp: 2025-07-04T03:22:57.425Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the user initially thought that request parameter null checks were unnecessary because DocumentData property is initialized with `= new();` in the DTO. However, property initialization only prevents null properties within successfully created DTO objects, while the request parameter itself can still be null due to null request bodies, malformed JSON, or model binding failures.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
🧬 Code Graph Analysis (5)
OsmoDoc/Pdf/Models/DocumentData.cs (1)
OsmoDoc/Pdf/Models/ContentMetaData.cs (1)
  • ContentMetaData (3-7)
OsmoDoc.API/Models/PdfGenerationRequestDTO.cs (2)
OsmoDoc/Word/Models/DocumentData.cs (1)
  • DocumentData (11-28)
OsmoDoc/Pdf/Models/DocumentData.cs (1)
  • DocumentData (7-10)
OsmoDoc/Word/Models/DocumentData.cs (3)
OsmoDoc/Word/Models/ContentData.cs (1)
  • ContentData (7-29)
OsmoDoc/Word/Models/TableData.cs (1)
  • TableData (9-22)
OsmoDoc/Word/Models/ImageData.cs (1)
  • ImageData (12-24)
OsmoDoc/Pdf/PdfDocumentGenerator.cs (2)
OsmoDoc/Pdf/Models/ContentMetaData.cs (1)
  • ContentMetaData (3-7)
OsmoDoc/Pdf/Models/OsmoDocPdfConfig.cs (1)
  • OsmoDocPdfConfig (3-7)
OsmoDoc.API/Program.cs (4)
OsmoDoc.API/DotEnv.cs (2)
  • DotEnv (3-35)
  • Load (5-33)
OsmoDoc/Pdf/Models/OsmoDocPdfConfig.cs (1)
  • OsmoDocPdfConfig (3-7)
OsmoDoc/Services/RedisTokenStoreService.cs (2)
  • RedisTokenStoreService (9-42)
  • RedisTokenStoreService (14-17)
OsmoDoc.API/Models/BaseResponse.cs (1)
  • ModelValidationBadRequest (22-38)
🪛 LanguageTool
README.md

[duplication] ~1-~1: Possible typo: you repeated a word.
Context: # OsmoDoc OsmoDoc is a library with the following functio...

(ENGLISH_WORD_REPEAT_RULE)

🪛 YAMLlint (1.37.1)
docker-compose.yaml

[error] 32-32: no new line character at the end of file

(new-line-at-end-of-file)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (csharp)
🔇 Additional comments (47)
OsmoDoc.API/DotEnv.cs (1)

1-1: No lingering DocumentService references found

I ran ripgrep searches for both “DocumentService.API” and “DocumentService” across .cs, .csproj, and .sln files—no matches came up. The namespace rename looks clean and ready to merge.

OsmoDoc.API/OsmoDoc.API.sln (1)

6-6: All stale DocumentService.API references removed

Ran rg -n 'DocumentService\.API' --color=always and confirmed there are no remaining matches in the repository.
The old project entry has been fully purged—no further action needed.

.github/PULL_REQUEST_TEMPLATE/pull_request_template_api.md (1)

5-5: LGTM – hyperlink now targets the renamed repo

The new link resolves to the correct CONTRIBUTING section.
No further action.

.env.example (1)

8-10: Server port variable name differs from ASP.NET default

ASP.NET uses ASPNETCORE_URLS or DOTNET_URLS conventions. Make sure SERVER_PORT is actually read by Program.cs; otherwise the example may mislead contributors.

OsmoDoc/Word/Models/ImageData.cs (1)

5-10: Consider Flags or explicit integer mapping for future-proofing

If you foresee combining source types (e.g., Base64 | Url) mark the enum with [Flags]. Otherwise, explicitly assign values (Base64 = 0, LocalFile = 1, Url = 2) is already done—good.

OsmoDoc.API/OsmoDoc.API.csproj (2)

16-16: Good switch to new core project

Reference update to OsmoDoc.csproj looks correct and keeps the API lean.


11-11: Redis package versions are consistent across the solution

  • OsmoDoc/OsmoDoc.csproj → StackExchange.Redis 2.8.41
  • OsmoDoc.API/OsmoDoc.API.csproj → StackExchange.Redis 2.8.41

No further alignment is needed.

OsmoDoc.API/Helpers/Base64StringHelper.cs (1)

1-1: Namespace update LGTM

Renaming to OsmoDoc.API.Helpers keeps the solution consistent after the project rename.

docs/site/10.0.2/api/OsmoDoc.Word.Models.ContentType.html (1)

70-82: DocFX ID consistency

data-uid="OsmoDoc.Word.Models.ContentType" matches the generated XML docs; good catch on keeping identifiers stable after the rename.

docs/site/10.0.2/api/OsmoDoc.Word.Models.html (1)

70-92: Documentation namespace update looks complete

All cross-references point to OsmoDoc.Word.Models; no orphaned links spotted.

docs/site/10.0.2/api/OsmoDoc.Word.Models.ParentBody.html (1)

70-104: Generated DocFX content — nothing to review.

docs/site/10.0.2/api/OsmoDoc.Word.Models.TableData.html (1)

70-162: Generated DocFX content — nothing to review.

docs/site/10.0.2/api/OsmoDocWord.html (1)

8-81: Generated DocFX content — nothing to review.

docs/site/10.0.2/api/OsmoDoc.Word.Models.DocumentData.html (1)

70-110: Namespace rename looks correct – nothing to flag

All modified data-uid, namespace and xref links consistently reflect the OsmoDoc.Word.Models rename.
No functional impact; good to go.

Also applies to: 115-140, 156-157

OsmoDoc.sln (1)

6-8: LGTM! Project references correctly updated.

The solution file properly reflects the project rename from "DocumentService" to "OsmoDoc" with correct project paths and GUIDs.

OsmoDoc.API/Helpers/AutoMappingProfile.cs (1)

1-12: LGTM! Empty AutoMapper profile is consistent with team approach.

Based on previous discussions, the empty constructor is intentional as the team has alternative approaches for certain mappings.

docs/site/10.0.2/api/toc.html (1)

17-43: LGTM! Documentation references consistently updated.

All navigation links and titles properly reflect the namespace change from "DocumentService.Word" to "OsmoDoc.Word" while maintaining the same structure and hierarchy.

OsmoDoc.API/Models/RevokeTokenRequestDTO.cs (1)

1-9: LGTM! Well-structured DTO with proper validation.

The DTO correctly implements the Required validation attribute and proper initialization, integrating well with the Redis-based token management system.

OsmoDoc/OsmoDoc.csproj (1)

1-27: Flag inconsistency between PR objectives and actual changes.

The project file is well-structured with proper .NET 8.0 targeting and appropriate package references. However, there's a significant discrepancy between the PR objectives (which state this is about "handle cleanup of temporary files and folders" for PdfDocumentGenerator and WordDocumentGenerator) and the actual changes shown (which are primarily about renaming the project from "DocumentService" to "OsmoDoc").

The project file itself looks correct for the rename operation.

Likely an incorrect or invalid review comment.

OsmoDoc.API/Helpers/CommonMethodsHelper.cs (2)

9-12: Excellent input validation addition.

The validation logic properly handles null, empty, and whitespace scenarios with a descriptive error message. This defensive programming approach aligns well with the method's design to accept file paths.


16-16: Correct nullable annotation.

Making directoryName nullable is appropriate since Path.GetDirectoryName() can return null for certain inputs.

OsmoDoc.API/Models/LoginRequestDTO.cs (1)

5-10: Well-designed DTO with proper validation.

The DTO correctly implements:

  • Required validation for the Email property
  • EmailAddress validation for format checking
  • Property initialization to prevent null values

This follows ASP.NET Core best practices for automatic model validation.

docs/site/10.0.2/api/OsmoDoc.Word.Models.ContentData.html (1)

70-70: Consistent documentation namespace updates.

All namespace references, assembly names, HTML IDs, and cross-reference links have been systematically updated from DocumentService.Word.Models to OsmoDoc.Word.Models. The documentation maintains consistency with the codebase refactoring.

Also applies to: 74-74, 107-108, 115-116, 138-139, 156-156, 161-162, 179-179, 184-185

OsmoDoc/Word/Models/TableData.cs (1)

9-22: Well-designed model class.

The TableData class properly:

  • Provides comprehensive XML documentation
  • Initializes the Data collection to prevent null values
  • Uses a flexible structure (List<Dictionary<string, string>>) for table representation
  • Follows the established pattern in the project for model classes

This design effectively supports Word document table data scenarios.

docs/site/10.0.2/api/OsmoDoc.Word.WordDocumentGenerator.html (2)

70-70: Consistent documentation updates for WordDocumentGenerator.

All namespace references, assembly names, method signatures, and parameter type references have been systematically updated from DocumentService.Word to OsmoDoc.Word. The documentation properly reflects the codebase refactoring.

Also applies to: 74-74, 107-108, 115-116, 139-139


116-149: Verify cleanup functionality implementation.

The PR objectives mention adding cleanup functions for temporary files and folders in PdfDocumentGenerator and WordDocumentGenerator. However, the documentation only shows the existing GenerateDocumentByTemplate method without any cleanup-related methods.

Based on retrieved learnings, there were previous concerns about temporary file cleanup where "PdfDocumentGenerator.GeneratePdf method only deletes its internal temporary files but does not delete the input template files or output PDF files created by the controller."

Please verify if the cleanup functionality has been implemented in the actual source code:

#!/bin/bash
# Description: Search for cleanup methods in PdfDocumentGenerator and WordDocumentGenerator classes
# Expected: Find cleanup methods or temporary file handling logic

echo "Searching for cleanup methods in document generators..."
ast-grep --pattern $'class WordDocumentGenerator {
  $$$
  $_($$$) {
    $$$
  }
  $$$
}'

echo "Searching for cleanup-related method names..."
rg -A 10 -B 2 "cleanup|Cleanup|clean|Clean|dispose|Dispose|delete.*temp|remove.*temp" --type cs

echo "Searching for temporary file handling..."
rg -A 5 -B 2 "temp.*file|temporary.*file|\.tmp" --type cs

Likely an incorrect or invalid review comment.

OsmoDoc/Services/Interfaces/IRedisTokenStoreService.cs (1)

6-11: Well-designed interface for Redis token management.

The interface follows async/await patterns correctly with appropriate CancellationToken support. The method signatures align well with the hybrid JWT + Redis token management approach described in the learnings.

OsmoDoc/Word/Models/DocumentData.cs (1)

11-28: Well-structured DocumentData class with proper initialization.

The class design follows the established pattern from the learnings where collections are initialized with empty lists using = new(). This ensures properties are never null and supports scenarios where users want to generate documents without placeholder replacements, table data, or images.

OsmoDoc.API/Models/BaseResponse.cs (1)

24-37: Improved error extraction logic with better null handling.

The ModelValidationErrorResponse method now includes proper null filtering and safe error message extraction. The fallback to "Validation failed" ensures a meaningful response even when no specific error message is available.

OsmoDoc.API/Models/PdfGenerationRequestDTO.cs (1)

6-12: Well-designed DTO with proper validation and initialization.

The DTO follows best practices with:

  • required modifier for mandatory properties
  • Descriptive validation error messages
  • Proper initialization of DocumentData property following the established pattern
  • Appropriate nullable annotation for optional SerializedEjsDataJson
OsmoDoc/Word/Models/ContentData.cs (1)

1-29: LGTM! Well-structured model class.

The implementation follows good practices with proper XML documentation, defensive string initialization, and type-safe enum usage.

docs/site/xrefmap.yml (1)

4-195: Documentation updates align with project renaming.

The namespace changes from DocumentService.Word to OsmoDoc.Word are consistently applied throughout the cross-reference map.

Dockerfile (2)

5-7: Production configuration is appropriate for deployment.

The change from Debug/Development to Release/Production is suitable for deployment builds, but ensure this aligns with your deployment strategy.


36-40: Improved dependency installation efficiency.

Consolidating the dependency installation into a single RUN command reduces Docker layers and improves build efficiency.

OsmoDoc/Services/RedisTokenStoreService.cs (1)

9-42: Solid Redis token management implementation.

The service correctly implements the hybrid JWT + Redis approach with proper cancellation token handling and metadata storage. The design aligns with the team's preference for manual token lifecycle management.

OsmoDoc.API/Controllers/WordController.cs (3)

37-45: Good defensive programming with proper null checks.

The explicit null checks for request and DocumentData provide better error handling and clearer error messages.


47-56: Configuration validation prevents runtime failures.

The upfront configuration validation with meaningful error messages is a good improvement over repeated inline access.


85-88: Image validation logic is clear and appropriate.

The validation ensures all images have non-empty data before processing, providing clear error feedback.

OsmoDoc.API/Models/WordGenerationRequestDTO.cs (2)

11-12: LGTM! The property initialization pattern aligns with the project's defensive programming approach.

The DocumentData property is properly initialized with = new() and marked as required, which ensures it's never null while still enforcing its presence in the request.


15-20: LGTM! Collections are properly initialized.

All collection properties are initialized to empty lists, following the project's established pattern to prevent null reference exceptions.

OsmoDoc.API/Controllers/LoginController.cs (3)

13-20: LGTM! Proper dependency injection setup.

The controller correctly injects the Redis token store service and logger dependencies.


25-46: LGTM! Login implementation aligns with the Redis-backed token management approach.

The method correctly generates non-expiring JWT tokens and stores them in Redis for manual lifecycle management, as per the project's design. The error logging follows the established pattern.

Based on learnings, this aligns with the project's hybrid JWT + Redis token management approach where tokens are intentionally created without expiration.


48-70: LGTM! Token revocation properly implemented.

The revoke endpoint correctly removes tokens from Redis, providing immediate invalidation capability as designed.

OsmoDoc/Pdf/PdfDocumentGenerator.cs (1)

50-79: Excellent implementation of resource cleanup!

The method properly implements cleanup of temporary files and folders as per the PR objectives:

  • Uses try-finally pattern to ensure cleanup executes even on exceptions
  • Tracks temporary file paths for cleanup
  • Calls CleanupTemporaryResources in the finally block

This addresses the REST-1639 task requirement for handling cleanup of temporary files in PdfDocumentGenerator.

OsmoDoc/Word/WordDocumentGenerator.cs (2)

270-356: Excellent implementation of temporary file cleanup!

The method properly implements cleanup of temporary image files as per the PR objectives:

  • Tracks all temporary files created during image processing
  • Uses try-finally pattern to ensure cleanup executes
  • Silently handles cleanup errors to avoid masking original exceptions
  • Each temporary file is properly deleted in the finally block

This addresses the REST-1639 task requirement for handling cleanup of temporary files in WordDocumentGenerator.


385-389: HttpClient usage aligns with project preferences.

The creation of a new HttpClient instance per image download is intentional as per the team's decision documented in PR #41.

Based on learnings, this pattern was deliberately chosen despite potential performance considerations.

OsmoDoc.API/Program.cs (1)

1-181: Well-structured application startup configuration!

The Program.cs file properly configures all necessary services including Redis integration, JWT authentication with token revocation, request size limits, and logging. The implementation aligns with the project's architecture.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
OsmoDoc.API/Controllers/PdfController.cs (1)

156-279: Consider refactoring to reduce code duplication.

The GeneratePdfUsingEjs method duplicates significant logic from GeneratePdf. Consider extracting common functionality into a private method to improve maintainability.

This could be addressed in a separate refactoring PR to keep this PR focused on the cleanup implementation.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0f25da9 and 7f21e52.

📒 Files selected for processing (1)
  • OsmoDoc.API/Controllers/PdfController.cs (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc.API/Controllers/WordController.cs:38-60
Timestamp: 2025-06-18T15:05:30.284Z
Learning: osm-Jatin prefers to create separate GitHub issues to track technical debt and improvement suggestions that are out of scope for the current PR, such as temporary file cleanup concerns in the OsmoDoc project.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#52
File: OsmoDoc.API/Controllers/PdfController.cs:27-124
Timestamp: 2025-07-05T11:54:07.620Z
Learning: In the OsmoDoc project, the cleanup scope is intentionally limited to modified/intermediate files created during document generation, not the input template or output files. This is because OsmoDoc is planned to be used as a NuGet package where users will provide and manage their own input and output file paths.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#51
File: OsmoDoc/Pdf/PdfDocumentGenerator.cs:92-102
Timestamp: 2025-07-05T11:36:58.372Z
Learning: osm-Jatin follows through on technical debt by creating tracking issues and then implementing fixes in separate PRs, ensuring proper review and testing of improvements identified during code reviews in the OsmoDoc project.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc.API/Controllers/PdfController.cs:34-46
Timestamp: 2025-06-18T14:34:35.161Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the PdfDocumentGenerator.GeneratePdf method only deletes its internal temporary files (converted HTML, modified HTML, JSON data files) but does not delete the input template files or output PDF files created by the controller, requiring manual cleanup in the controller to prevent disk bloat.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc/Pdf/Models/OsmoDocPdfConfig.cs:3-7
Timestamp: 2025-07-04T03:19:33.211Z
Learning: osm-Jatin prefers to defer non-critical code improvements like thread safety enhancements and validation logic when they are not essential for the current PR scope, preferring to keep changes focused on the main objectives.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Pdf/PdfDocumentGenerator.cs:84-92
Timestamp: 2025-06-18T14:44:46.570Z
Learning: osm-Jatin prefers to document input requirements clearly in the README file rather than adding runtime validation code for scenarios like null/duplicate placeholders in the OsmoDoc PDF generation functionality.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Controllers/PdfController.cs:96-97
Timestamp: 2025-07-04T03:27:39.757Z
Learning: osm-Jatin prefers to defer security-related logging improvements (like removing stack trace logging) when they are not essential for the current PR scope in the OsmoDoc project, choosing to keep existing implementation for now.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#41
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:10-27
Timestamp: 2025-06-19T04:10:32.232Z
Learning: In the OsmoDoc project, they use a hybrid JWT + Redis token management approach: non-expiry JWT tokens are generated and stored in Redis for validation and manual revocation. The system includes RedisTokenService for token storage/validation and dedicated revocation endpoints, allowing stateless JWT benefits while maintaining token lifecycle control.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#42
File: OsmoDoc/Services/RedisTokenStoreService.cs:18-24
Timestamp: 2025-06-20T14:36:49.953Z
Learning: In the OsmoDoc project, the team prefers manual token lifecycle management over automatic TTL expiration in Redis. They deliberately store tokens without expiration to maintain precise control over when tokens become invalid through their dedicated revocation endpoints, rather than relying on automatic expiration.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#42
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:18-24
Timestamp: 2025-06-20T14:37:36.118Z
Learning: In OsmoDoc.API, JWT tokens are intentionally created without expiration because the application uses Redis as the authoritative source for token validity. Tokens are stored in Redis when issued and can be manually revoked by removing them from Redis, providing centralized token management and immediate invalidation capability.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:11-24
Timestamp: 2025-06-22T13:55:51.706Z
Learning: In the OsmoDoc project, JWT tokens are intentionally created without expiration dates. The team has chosen to implement manual token invalidation through Redis storage instead of using JWT expiration claims. Tokens are stored in Redis and can be manually revoked using the /api/revoke endpoint. This design decision was made in PR #42 where the user stated "Not needed, we will make the token inactive manually for now."
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#51
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:10-27
Timestamp: 2025-07-04T14:44:16.407Z
Learning: In the OsmoDoc project, the team has determined that adding issuer and audience claims to JWT tokens is not required for their specific use case. They have a comprehensive token management system with Redis-based revocation that meets their security requirements without needing additional JWT validation features.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#41
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:10-27
Timestamp: 2025-06-19T04:10:32.232Z
Learning: In the OsmoDoc project, non-expiry JWT tokens are used intentionally with manual invalidation mechanisms. The team handles token lifecycle management manually rather than using time-based expiration.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#42
File: OsmoDoc.API/Program.cs:98-112
Timestamp: 2025-06-20T14:36:43.563Z
Learning: In the OsmoDoc project, JWT tokens are intentionally designed to be non-expiring. The custom LifetimeValidator in Program.cs always returns true to prevent token expiration validation, which is by design rather than a bug.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#52
File: OsmoDoc.API/Helpers/AuthenticationHelper.cs:13-16
Timestamp: 2025-07-05T11:50:12.072Z
Learning: In the OsmoDoc project, osm-Jatin prefers to keep performance optimizations simple for infrequently used endpoints like the login endpoint, choosing not to implement caching optimizations when the endpoint usage is expected to be rare.
OsmoDoc.API/Controllers/PdfController.cs (14)
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc.API/Controllers/PdfController.cs:34-46
Timestamp: 2025-06-18T14:34:35.161Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the PdfDocumentGenerator.GeneratePdf method only deletes its internal temporary files (converted HTML, modified HTML, JSON data files) but does not delete the input template files or output PDF files created by the controller, requiring manual cleanup in the controller to prevent disk bloat.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Controllers/PdfController.cs:129-136
Timestamp: 2025-07-04T03:22:57.425Z
Learning: In OsmoDoc.API/Controllers/PdfController.cs, the user initially thought that request parameter null checks were unnecessary because DocumentData property is initialized with `= new();` in the DTO. However, property initialization only prevents null properties within successfully created DTO objects, while the request parameter itself can still be null due to null request bodies, malformed JSON, or model binding failures.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#52
File: OsmoDoc/Pdf/Models/OsmoDocPdfConfig.cs:5-7
Timestamp: 2025-07-05T11:50:52.134Z
Learning: In OsmoDoc/Pdf/Models/OsmoDocPdfConfig.cs, osm-Jatin intentionally keeps the WkhtmltopdfPath property with a public setter to allow runtime configuration for cross-platform compatibility, enabling users to manually set the appropriate wkhtmltopdf binary path based on their operating system.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Pdf/PdfDocumentGenerator.cs:24-37
Timestamp: 2025-06-18T14:03:39.731Z
Learning: In OsmoDoc PdfDocumentGenerator.GeneratePdf method, an empty metaDataList is a valid scenario when users want to convert HTML/EJS templates to PDF without any placeholder replacements. Only null metaDataList should be validated, not empty ones.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Word/WordDocumentGenerator.cs:314-315
Timestamp: 2025-06-19T18:07:02.969Z
Learning: In the OsmoDoc/Word/WordDocumentGenerator.cs file, the team prefers to keep the HttpClient usage as it is currently implemented (creating a new HttpClient instance for each image download), despite potential performance considerations. This decision was made with reference to discussion in PR #41.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#52
File: OsmoDoc.API/Controllers/PdfController.cs:27-124
Timestamp: 2025-07-05T11:54:07.620Z
Learning: In the OsmoDoc project, the cleanup scope is intentionally limited to modified/intermediate files created during document generation, not the input template or output files. This is because OsmoDoc is planned to be used as a NuGet package where users will provide and manage their own input and output file paths.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc.API/Controllers/WordController.cs:38-60
Timestamp: 2025-06-18T15:05:30.284Z
Learning: osm-Jatin prefers to create separate GitHub issues to track technical debt and improvement suggestions that are out of scope for the current PR, such as temporary file cleanup concerns in the OsmoDoc project.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc/Pdf/Models/OsmoDocPdfConfig.cs:3-7
Timestamp: 2025-07-04T03:19:33.211Z
Learning: osm-Jatin prefers to defer non-critical code improvements like thread safety enhancements and validation logic when they are not essential for the current PR scope, preferring to keep changes focused on the main objectives.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#51
File: OsmoDoc/Pdf/PdfDocumentGenerator.cs:92-102
Timestamp: 2025-07-05T11:36:58.372Z
Learning: osm-Jatin follows through on technical debt by creating tracking issues and then implementing fixes in separate PRs, ensuring proper review and testing of improvements identified during code reviews in the OsmoDoc project.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#40
File: OsmoDoc/Pdf/PdfDocumentGenerator.cs:84-92
Timestamp: 2025-06-18T14:44:46.570Z
Learning: osm-Jatin prefers to document input requirements clearly in the README file rather than adding runtime validation code for scenarios like null/duplicate placeholders in the OsmoDoc PDF generation functionality.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#49
File: OsmoDoc.API/Controllers/PdfController.cs:96-97
Timestamp: 2025-07-04T03:27:39.757Z
Learning: osm-Jatin prefers to defer security-related logging improvements (like removing stack trace logging) when they are not essential for the current PR scope in the OsmoDoc project, choosing to keep existing implementation for now.
Learnt from: osm-Jatin
PR: OsmosysSoftware/osmodoc#41
File: OsmoDoc.API/Controllers/WordController.cs:46-47
Timestamp: 2025-06-19T18:01:38.314Z
Learning: In the OsmoDoc project, the `CreateDirectoryIfNotExists` method in `CommonMethodsHelper` is designed to accept file paths as parameters. It internally uses `Path.GetDirectoryName(filePath)` to extract the directory path before creating the directory, so passing full file paths to this method is the correct usage pattern.
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (csharp)
🔇 Additional comments (4)
OsmoDoc.API/Controllers/PdfController.cs (4)

1-7: Namespace migration looks good.

The namespace and using directive changes from DocumentService to OsmoDoc are consistent with the project-wide rename.


35-49: Excellent validation improvements.

The explicit null check for the request parameter and upfront configuration validation with clear error messages are solid improvements. This prevents potential null reference exceptions and makes configuration issues immediately apparent.


126-150: Excellent cleanup implementation fulfills PR objectives.

The finally block properly handles cleanup of temporary files with:

  • Null checks before file operations
  • Exception handling that logs errors without throwing
  • Ensures cleanup occurs even when exceptions happen in the main logic

This correctly implements the PR objective of handling cleanup of temporary files and folders for the API context.


77-83: Proper async/await implementation.

The asynchronous call to PdfDocumentGenerator.GeneratePdf is correctly implemented with proper await usage throughout the method.

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.

2 participants