Skip to content

Conversation

@osm-Jatin
Copy link

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

Task Link

REST-1582

Description

  • Update the README file.
  • Add usage guide for the OsmoDoc

Summary by CodeRabbit

  • New Features

    • Introduced a new API for PDF and Word document generation from templates, supporting placeholder replacement, tables, and images.
    • Added endpoints for user login and token revocation with JWT and Redis-based token management.
    • Added Redis integration for token storage and revocation.
    • Added configuration options for resource cleanup and request size limits.
    • Added comprehensive usage documentation and API reference.
  • Improvements

    • Enhanced input validation and error handling for document generation endpoints.
    • Improved configuration management and environment variable loading.
    • Updated and expanded environment variable examples and Docker configuration.
    • Updated project and solution structure, namespaces, and documentation to reflect the new "OsmoDoc" branding.
  • Bug Fixes

    • Fixed resource cleanup for temporary files generated during document creation.
  • Documentation

    • Rewrote and expanded README and added a detailed usage guide.
    • Added and updated API documentation and templates for sample usage.
  • Chores

    • Renamed projects, files, and namespaces from "DocumentService" to "OsmoDoc".
    • Updated .gitignore and contributing guidelines.

osm-Jatin and others added 30 commits June 15, 2025 14:51
osm-Jatin and others added 27 commits July 4, 2025 08:58
@osm-Jatin osm-Jatin requested a review from sameer-s-b July 8, 2025 19:48
@osm-Jatin osm-Jatin self-assigned this Jul 8, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 8, 2025

Caution

Review failed

Failed to post review comments.

Walkthrough

This update migrates the project from "DocumentService" to "OsmoDoc," introducing a new modular structure with distinct namespaces for API, PDF, Word, and services. It adds Redis-backed JWT token management, enhances PDF and Word document generation with asynchronous and configurable resource cleanup, and provides comprehensive documentation and usage guides. Docker and environment configuration are modernized, and the codebase is refactored to align with the new architecture.

Changes

File(s) / Path(s) Change Summary
.env.example, .gitignore, Dockerfile, docker-compose.yaml, appsettings.json Expanded environment variables, improved Docker configuration, and added resource cleanup flag.
CONTRIBUTING.md, README.md, .github/PULL_REQUEST_TEMPLATE/pull_request_template_api.md Updated documentation and templates to reference "OsmoDoc" instead of "DocumentService."
OsmoDoc.sln, OsmoDoc.API/OsmoDoc.API.sln, OsmoDoc/OsmoDoc.csproj, OsmoDoc.API/OsmoDoc.API.csproj Renamed and restructured projects and solution files for OsmoDoc.
OsmoDoc.API/Program.cs Refactored startup: loads env via DotEnv.LoadEnvFile, integrates Redis, adds JWT revocation, configures PDF tool path, and updates Swagger.
OsmoDoc.API/Controllers/LoginController.cs Added new login and token revocation API using Redis for JWT management.
OsmoDoc.API/Controllers/PdfController.cs, OsmoDoc.API/Controllers/WordController.cs Refactored controllers for new namespaces, async document generation, input validation, and resource cleanup.
OsmoDoc.API/Helpers/*, OsmoDoc.API/DotEnv.cs Updated namespaces, improved directory creation validation, and added recursive env file loader.
OsmoDoc.API/Models/*, OsmoDoc/Word/Models/*, OsmoDoc/Pdf/Models/* Introduced/refactored DTOs and models for PDF/Word generation, image handling, and validation.
OsmoDoc/Pdf/PdfDocumentGenerator.cs, OsmoDoc/Word/WordDocumentGenerator.cs Implemented new static classes for PDF/Word generation with async, logging, and platform-specific logic.
OsmoDoc/Services/Interfaces/IRedisTokenStoreService.cs, OsmoDoc/Services/RedisTokenStoreService.cs Added Redis token storage service and interface for JWT management.
docs/guides/usage_guide.md, docs/templates/* Added comprehensive usage guide and sample templates for PDF/Word generation.
docs/site/*, docfx.json, docs/site/xrefmap.yml, docs/site/manifest.json, docs/site/styles/docfx.js Regenerated and expanded API documentation for OsmoDoc, updated navigation, and improved search handling.
DocumentService*, DocumentService.API* Removed legacy DocumentService code, DTOs, models, and project files.

Sequence Diagram(s)

Login and JWT Token Management

sequenceDiagram
    participant Client
    participant LoginController
    participant RedisTokenStoreService
    participant JWT_Helper

    Client->>LoginController: POST /api/login (with email)
    LoginController->>JWT_Helper: Generate JWT token
    JWT_Helper-->>LoginController: JWT token
    LoginController->>RedisTokenStoreService: StoreTokenAsync(token, email)
    RedisTokenStoreService-->>LoginController: (completed)
    LoginController-->>Client: BaseResponse (token, success)

    Client->>LoginController: POST /api/revoke (with token)
    LoginController->>RedisTokenStoreService: RevokeTokenAsync(token)
    RedisTokenStoreService-->>LoginController: (completed)
    LoginController-->>Client: BaseResponse (success)
Loading

PDF Generation Flow

sequenceDiagram
    participant Client
    participant PdfController
    participant PdfDocumentGenerator
    participant FileSystem

    Client->>PdfController: POST /api/pdf/GeneratePdfUsingHtml (with request)
    PdfController->>PdfDocumentGenerator: GeneratePdf(templatePath, metaData, outputPath, ...)
    PdfDocumentGenerator->>FileSystem: Read template, write temp files
    PdfDocumentGenerator-->>PdfController: PDF generated at outputPath
    PdfController->>FileSystem: (optional) Delete temp files
    PdfController-->>Client: BaseResponse (PDF as base64 or path)
Loading

Word Document Generation Flow

sequenceDiagram
    participant Client
    participant WordController
    participant WordDocumentGenerator
    participant FileSystem

    Client->>WordController: POST /api/word/GenerateWordDocument (with request)
    WordController->>WordDocumentGenerator: GenerateDocumentByTemplate(templatePath, documentData, outputPath)
    WordDocumentGenerator->>FileSystem: Read template, process images, tables, placeholders
    WordDocumentGenerator-->>WordController: Word document generated
    WordController->>FileSystem: (optional) Delete temp files
    WordController-->>Client: BaseResponse (Word doc as base64 or path)
Loading

Poem

The OsmoDoc rabbit hops anew,
Refactored code, a clearer view!
Redis tokens, docs that gleam,
Async flows and Docker steam.
Word and PDF, templates bright,
We leap ahead in docs and byte!
🐇✨📄
✨ 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.

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.

3 participants