Conversation
…, 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
…ad as well as migration files
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #173 +/- ##
===========================================
- Coverage 23.00% 12.65% -10.36%
===========================================
Files 34 79 +45
Lines 1143 2505 +1362
Branches 0 24 +24
===========================================
+ Hits 263 317 +54
- Misses 875 2183 +1308
Partials 5 5
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
…/adjust cursor request endpoint to reflect the new updated schema
* rooms migration file * feat: guest booking migration * rls fix * indexes on both tables * type fix * incomplete guest bookings table + endpoint * server integrated + openapi * moved getRooms to rooms repo * get guests endpoint * changes * fixed openapi * remove stale webhook dir * route for specific guest info * cleanup GetBookingsByFloor handler * changed some models * filtered by hotel id * lint * may the lint gods be merciful * comments * fixed issue * rename --------- Co-authored-by: eric-kitagawa <kitagawa.e@northeastern.edu>
…, 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
Dao-Ho
left a comment
There was a problem hiding this comment.
some comments but overall logic looks great! 🔥 🚀
| return errs.BadRequest("request id is not a valid UUID") | ||
| } | ||
|
|
||
| var incoming models.MakeRequest |
There was a problem hiding this comment.
Let's make this var more descriptive
| if err := c.BodyParser(&incoming); err != nil { | ||
| return errs.InvalidJSON() | ||
| } | ||
| req := models.Request{ID: id, MakeRequest: incoming} |
There was a problem hiding this comment.
same with this var, more descriptive please 🙏
|
|
||
| if err := validateCreateRequest(&req); err != nil { | ||
| return err | ||
| } |
There was a problem hiding this comment.
we also have a validation system in place, let's remove this validateCreateRequest and use the validation Zaydaan added.
Please look at how BindAndValidate is used in our users.go file in the handler
if err := httpx.BindAndValidate(c, &CreateUserRequest); err != nil {
return err
}| `, req.HotelID, req.GuestID, req.UserID, req.ReservationID, req.Name, | ||
| if req.ID == "" { | ||
| req.ID = uuid.New().String() | ||
| } |
There was a problem hiding this comment.
shouldn't be the CRUD's job to create a new ID, let's throw an error if this is the case. Should be on the caller for passing this id value
| req.Status, req.Priority, req.EstimatedCompletionTime, | ||
| req.ScheduledTime, req.Notes).Scan(&req.ID, &req.CreatedAt, &req.UpdatedAt) | ||
| req.ScheduledTime, req.Notes).Scan(&req.ID, &req.CreatedAt, &req.RequestVersion) | ||
|
|
| ALTER COLUMN request_version DROP DEFAULT; | ||
|
|
||
| ALTER TABLE public.requests DROP COLUMN updated_at No newline at end of file | ||
| ALTER TABLE public.requests DROP COLUMN updated_at |
There was a problem hiding this comment.
let's move this to a new migration file - each new migration should be its own separate file.
Also, this should be it's own separate PR. Every migration should be a separate pr
| ALTER TABLE public.requests DROP CONSTRAINT requests_pkey; | ||
|
|
||
| ALTER TABLE public.requests ADD CONSTRAINT requests_pkey PRIMARY KEY (id, request_version); No newline at end of file | ||
| ALTER TABLE public.requests ADD CONSTRAINT requests_pkey PRIMARY KEY (id, request_version); |
There was a problem hiding this comment.
same with this - separate PR and file
|
|
||
|
|
||
|
|
||
|
|
There was a problem hiding this comment.
what is this file? I don't think you meant to commit this
Description
modifies existing request enpoints to fetch the request with the latest version (in case of same ids)
Type of Change
Related Issue(s)
Closes #
Related to # #108
What Changed?
Testing & Validation
I only modified existing tests for our requests endpoints and made sure they passed.
How this was tested
Screenshots/Recordings
The below shows a POST request which makes a fresh request and 2 following PUT requests. As expected, the POST delivers a fresh id, created at, and request version. And the following PUT requests change the request version to date NOW() and maintains the created at and id of the request.
And finally I'll show you that GET request will serve up the latest version (timestamp) of the record stored
timestamp is 2026-03-17T21:47:13.232841-04:00 which aligns with the last PUT request we made
Unfinished Work & Known Issues
Notes & Nuances
Pre-Merge Checklist
Code Quality
Testing & CI
Documentation
Reviewer Notes