Billable rates (1/3): data model + validation - #932
Open
devin-ai-integration[bot] wants to merge 2 commits into
Open
devin-ai-integration[bot] wants to merge 2 commits into
devin-ai-integration[bot] wants to merge 2 commits into
Conversation
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This was referenced Sep 1, 2026
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Bottom layer of a 3-PR stack adding billable rates and billed amounts to client reports. This PR only introduces the storage and validation primitives — nothing reads or writes them yet, so behavior is unchanged.
clients.billing_rate DECIMAL(10,2) NOT NULL DEFAULT 0andwork_entries.billable INTEGER NOT NULL DEFAULT 1inbackend/src/database/init.js. The defaults are what make this layer non-breaking: existing rows/inserts get rate 0 (amount 0) and are billable, which is the behavior PR 2 will compute against. The DB is in-memory and rebuilt per process, so there is no migration.billingRateon the Joi client schemas:clientSchemadefaults it to0,updateClientSchemadeliberately does not default it — a default on a partial-update schema would re-write the rate to 0 on every PUT that omits it..strict()on the rate rules: without it this Joi version coerces12.345to12.35instead of rejecting it, soprecision(2)alone would silently round client input.billableis intentionally absent from the work-entry schemas: the API does not accept it yet, and the column default covers every insert.Stack: PR 1 (this) → PR #933 (service/API:
billingRatein clients CRUD,totalAmountin reports, amount column in CSV/PDF) → PR #934 (UI).Testing
cd backend && npm test(171 tests) with coverage above thebackend/jest.config.jsthresholds. New cases cover the rate default, the rejections (negative, over max, non-numeric, >2 decimals), the no-default-on-update behavior, and the two column definitions in theCREATE TABLEstatements.Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/af51f484897545a8bc1df69511f47ed4
Open in Devin Desktop: https://partner-workshops.devinenterprise.com/desktop/session/af51f484897545a8bc1df69511f47ed4?variant=devin
Requested by: @sumitshatwara