Skip to content

Update repository methods for versioning PR1#124

Open
oilagh wants to merge 1 commit intomainfrom
requests-versioning
Open

Update repository methods for versioning PR1#124
oilagh wants to merge 1 commit intomainfrom
requests-versioning

Conversation

@oilagh
Copy link
Contributor

@oilagh oilagh commented Feb 17, 2026

Description

First PR that simply adds request versioning column to supabase thru migration & modifies existing request enpoints to fetch the request with the latest version (in case of same ids)

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • [ X ] New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring (code improvement without changing functionality)
  • Documentation update
  • Configuration/infrastructure change
  • Performance improvement
  • Test coverage improvement

Related Issue(s)

Closes #
Related to # #108

What Changed?

  • Essentially just update find request, find requests, and inert request at the repo level to change the way it accesses records from the DB
  • Add a new column request_version to DB

Testing & Validation

I only modified existing tests for our requests endpoints and made sure they passed.

How this was tested

  1. Unit tests

Screenshots/Recordings

Unfinished Work & Known Issues

  • None, this PR is complete and production-ready
  • [ X ] The following items are intentionally deferred:
    • in future PRs need to add new PATCH/PUT for creating a new request with the same ID but updated request_version


Notes & Nuances



Pre-Merge Checklist

Code Quality

  • Code follows the project's style guidelines and conventions
  • Self-review completed (I've reviewed my own code for obvious issues)
  • No debugging code, console logs, or commented-out code left behind
  • No merge conflicts with the base branch
  • Meaningful commit messages that explain the "why"

Testing & CI

  • All CI checks are passing
  • All new and existing tests pass locally
  • Test coverage hasn't decreased (or decrease is justified)
  • Linting passes without errors

Documentation

  • Code is self-documenting or includes helpful comments for complex logic
  • API documentation updated (if backend endpoints changed)
  • Type definitions are accurate and up-to-date

Reviewer Notes

  • Areas needing extra attention: ...
  • Questions for reviewers: ...

…, insert requests) and add migration to add column request_version to requests table and also make it so created_at which contains date created reflects the version because shud be the same
@oilagh oilagh changed the title Update repository methods for versioning Update repository methods for versioning PR1 Feb 17, 2026
@oilagh oilagh force-pushed the requests-versioning branch from 4fc102d to 97e712e Compare February 17, 2026 22:28
Copy link
Contributor

@Dao-Ho Dao-Ho left a comment

Choose a reason for hiding this comment

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

Left some thoughts on this, overall you nailed the essence of what we want to do 🔥 🔥 Would love to hear what you think though

-- drop default expression so that we can specify ourselves what we want for future inserts
-- this is just to modify existing data that we already have in the DB
ALTER TABLE public.requests
ALTER COLUMN request_version DROP DEFAULT;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd move this migration to a separate pr and merge/apply the migration before we actually update the query.

ID string `json:"id" example:"530e8400-e458-41d4-a716-446655440000"`
CreatedAt time.Time `json:"created_at" example:"2024-01-02T00:00:00Z"`
UpdatedAt time.Time `json:"updated_at" example:"2024-01-02T00:00:00Z"`
RequestVersion time.Time `json:"request_version" example:"2024-01-02T00:00:00Z"`
Copy link
Contributor

@Dao-Ho Dao-Ho Feb 19, 2026

Choose a reason for hiding this comment

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

What is the difference between request_version and updated_at? 🤔 Maybe we don't need both

Also a couple of ways I think we can interpret/design the storage of this data. We can either maintain the original created_at across all versions that we insert, or we could handle that in our find query (fetch the latest request but return the request_version of the first version, which we'll have to do for all queries fetching requests). I'll leave this design decision up to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments