Skip to content

feat: checks#23

Merged
hmbanan666 merged 1 commit into
mainfrom
checks
Jul 29, 2025
Merged

feat: checks#23
hmbanan666 merged 1 commit into
mainfrom
checks

Conversation

@hmbanan666
Copy link
Copy Markdown
Collaborator

@hmbanan666 hmbanan666 commented Jul 29, 2025

Summary by CodeRabbit

  • New Features
    • Added support for a new "Checks" metric in kitchen revenue data, allowing users to track the number of checks alongside total revenue.
  • Bug Fixes
    • Improved file import handling to accommodate updated file formats with an extra header row.

@hmbanan666 hmbanan666 self-assigned this Jul 29, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jul 29, 2025

Walkthrough

The changes update the backend logic and database schema to support a new "checks" field in kitchen revenue records. The file parsing now expects an extra header row, validates the presence of the "checks" column, and persists this value to the database, which has been updated to include a non-nullable "checks" integer column.

Changes

Cohort / File(s) Change Summary
Backend Parsing and Logic Update
apps/web-app/server/api/kitchen/revenue/iiko-daily.post.ts
Adjusts file parsing to handle an extra header row, requires and validates "checks" column, parses and persists "checks" value, and skips rows lacking valid "checks" data.
Database Schema Update
packages/database/src/tables.ts
Adds a non-nullable integer checks column with a default value of 0 to the kitchenRevenues table.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant API as Kitchen Revenue API
    participant Parser
    participant DB as Database

    User->>API: Upload kitchen revenue Excel file
    API->>Parser: Parse file (start at new header row)
    Parser->>Parser: Validate columns ("Группа", "Сумма со скидкой, р. Всего", "Чеков")
    Parser->>Parser: Extract data rows (including "checks")
    Parser->>API: Return parsed data with "checks"
    API->>DB: Create/Update kitchen revenue with "checks" value
    DB-->>API: Confirmation
    API-->>User: Success response
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • feat: upload revenue file #20: Adds frontend components and UI for uploading kitchen revenue files, complementing these backend and schema changes for the "checks" field.

Poem

Hopping through headers, I found one more—
"Checks" now counted, as never before!
With columns aligned and data in place,
Our kitchen's revenue keeps up the pace.
A bunny's delight, this backend hop,
With every new field, we reach the top!
🥕✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 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 4b6b86c and 516f5d8.

📒 Files selected for processing (2)
  • apps/web-app/server/api/kitchen/revenue/iiko-daily.post.ts (4 hunks)
  • packages/database/src/tables.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/database/src/tables.ts (1)
packages/database/src/repository/kitchen.ts (1)
  • createRevenue (62-65)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (8)
packages/database/src/tables.ts (1)

423-423: LGTM! Schema change is well-designed.

The addition of the checks integer column with a non-nullable constraint and default value of 0 is appropriate for tracking the number of checks/transactions in kitchen revenue records.

apps/web-app/server/api/kitchen/revenue/iiko-daily.post.ts (7)

78-78: Verify the row indexing adjustment is correct.

The dictionary is now read from data[4] (5th row) instead of the previous data[3] (4th row). The comment indicates "4th row - empty, 5th - column names" which suggests the file format now has an empty 4th row.

Please verify that this row indexing change accurately reflects the actual file format. If the 4th row is indeed empty in the new format, this change is correct.


88-89: Good addition of checks column validation.

The code now properly validates the presence of the "Чеков" (checks) column and includes it in the dictionary validation check. This ensures the parsing will fail early if the expected column is missing.


115-116: Data row slicing correctly adjusted for new format.

The data rows now start from index 5 (6th row) which is consistent with the dictionary being moved to index 4 (5th row). This maintains the correct offset between header and data rows.


124-124: Data structure properly extended with checks field.

The parsed kitchen data structure now includes the checks: number field, maintaining type safety and consistency with the database schema.


129-131: Robust type validation for all required fields.

The validation now checks that checks is a number alongside the existing validations for name and total. This ensures data integrity and prevents runtime errors.


138-138: Parsed data correctly includes checks value.

The checks value is properly added to the parsed kitchen object, maintaining consistency with the extended data structure.


157-157: Database operations properly updated with checks field.

Both the createRevenue and updateRevenue operations now include the checks field, ensuring the newly parsed data is persisted correctly in the database. This aligns with the schema changes in the tables.ts file.

Also applies to: 162-162

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch checks

🪧 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 generate unit tests to generate unit tests for 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.

@sonarqubecloud
Copy link
Copy Markdown

@hmbanan666 hmbanan666 merged commit 6663de5 into main Jul 29, 2025
8 checks passed
@hmbanan666 hmbanan666 deleted the checks branch July 29, 2025 08:14
This was referenced Jul 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant