Skip to content

#4243 finance content - #4326

Open
wavehassman wants to merge 13 commits into
developfrom
#4243-finance-data
Open

#4243 finance content#4326
wavehassman wants to merge 13 commits into
developfrom
#4243-finance-data

Conversation

@wavehassman

@wavehassman wavehassman commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Changes

Made Reimbursement_Request, Reimbursement_Status, Receipt, Reimbursement_Product_Reason, Reimbursement_Product, Refund_Source, Reimbursement, Reimbursement_Request_Comment.
Generates 150 reimbursement requests per car

  • Only Head+ recipients can set date of expense at creation; everyone else waits until leadership-approves, then self-reports it and self-marks pending finance (mirroring the actual frontend gating).
  • 70/30 split of WBS-linked vs. general-supply products.
  • Receipts, SABO numbers, delivery dates, assignees, and system + freeform comments generated consistently with each request's status history.
  • A Reimbursement record is generated per recipient off their accumulated reimbursed total.
  • Skips cars/projects that haven't started yet

NEED MATERIALS TO BE MERGED IN BEFORE THIS

Checklist

It can be helpful to check the Checks and Files changed tabs.
Please review the contributor guide and reach out to your Tech Lead if anything is unclear.
Please request reviewers and ping on slack only after you've gone through this whole checklist.

  • All commits are tagged with the ticket number
  • No linting errors / newline at end of file warnings
  • All code follows repository-configured prettier formatting
  • No merge conflicts
  • All checks passing
  • Screenshots of UI changes (see Screenshots section)
  • Remove any non-applicable sections of this template
  • Assign the PR to yourself
  • No yarn.lock changes (unless dependencies have changed)
  • Request reviewers & ping on Slack
  • PR is linked to the ticket (fill in the closes line below)

Closes #4243

@wavehassman wavehassman changed the title #4243 Finance #4243 finance content Jul 13, 2026
@wavehassman
wavehassman marked this pull request as draft July 13, 2026 01:41
@wavehassman
wavehassman marked this pull request as ready for review July 13, 2026 02:13

@Steph375 Steph375 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, thanks for the help! I just had one clarifying question

Comment thread src/backend/src/prisma/seed/reimbursement-request.process.ts
@Steph375
Steph375 self-requested a review July 13, 2026 20:19
Steph375
Steph375 previously approved these changes Jul 13, 2026

@Santiordon Santiordon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looking good! Just left some small adjustments but this is really good code! Thanks for lightening the load a bit!

Comment thread src/backend/src/prisma/factories/reimbursement-request.factory.ts Outdated
Comment thread src/backend/src/prisma/factories/reimbursement-request.factory.ts Outdated
Comment thread src/backend/src/prisma/factories/reimbursement-request.factory.ts Outdated
Santiordon
Santiordon previously approved these changes Jul 14, 2026

@Santiordon Santiordon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@wavehassman wavehassman left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Phase 1 already computes everything else synchronously before any writes happen. Extending PlannedRequest to also carry these four pre-decided values would make Phase 2 pure writes with zero faker calls which would keep the concurrency speedup from the "Synchronization and Batching" commit while restoring deterministic, reproducible seed output


// Products (and their reasons + tied-material status updates) are independent of each other.
const productWrites = group.map((spec, productIndex) => {
const otherReasonId =

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Concurrent async resolution order isn't guaranteed, so this breaks reproducibility


const reason = await this.prisma.reimbursement_Product_Reason.create({ data: reasonCreateInput });

const productName =

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

faker call inside the concurrently-executed per-product write. Move to Phase 1 with above

admins: FullUser[],
financePersonnel: FullUser[]
): Promise<void> {
const actor = this.pickActorForStage(step.type, recipient, headApprovers, admins, financePersonnel);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the actor for each status-history step is chosen inside the concurrent per-request batch instead of during planning
Move to Phase 1: compute actorId per step and carry it alongside the step's date

);
}

if (

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

(dateDelivered / assignee / extra-comment decisions in createReimbursementRequest's followUps block): all three still call faker inside the concurrently-executed function. Move all three into Phase 1 and just consume the pre-decided values here

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.

[Seed Data] - Generate Finance and Reimbursement Data

3 participants