Repository navigation
Make provided helpers easier to understand - #18
Merged
Merged
Conversation
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.
Students need to use contact privacy without deciding whether to expose someone’s email and phone themselves. Add
getVisibleProfile(ctx, tx, currentUser, record): it returns a profile with contacts only for self or shared-ride peers, using the supplied transaction. Guests receive no contacts, and a failed permission lookup returns an error and no profile. Keep the copying helper internal so ride results retain one permission lookup for all owners and riders.Rename
ActortoCurrentUser, userequireSignedInUserfor identity extraction, and give conversion and error helpers clearer verbs. Update comments and existing tests. Student operation stubs remain intact.Add
HELPERS.mdand link it from the README, matching the revised Google Doc. The guide explains request identity, stored records, prepared results, and automatic contact permissions with concrete examples. It omits the general tutorials on types, structs, transactions, and sqlc.Validation:
go test -race -count=1 ./...,go vet ./...,go build ./..., formatting, andgit diff --checkpassed. New helper tests cover self, shared-ride peers, unrelated profiles, guests, and permission-query failures. Unfinished student operations retain their existing test skips.Companion reference implementation: https://github.com/chu-andrew/carpool4/pull/3