-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Profiles Send ID #274
Profiles Send ID #274
Conversation
send_id is a numerical representation of an account based on when it was created. - Add Migration to backfill send_id and auto-increment on new account creation. - Update references to Name -> Send ID - Add PGTap unit tests for the send_id.
…pdate db models to account for this and frontend listing funs.
Updates to Preview Branch (profiles_send_id) ↗︎
Tasks are run on every commit but only new migration files are pushed.
❌ Migrations Error • Fri, 05 Apr 2024 15:30:01 GMT
Branching Preview Branches by Supabase. |
Vercel Unique URL: https://sendapp-8187kcnzx-0xsend.vercel.app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didn't finish all of it. let's try to keep our feature PRs separated e.g. send IDs in one PR, and profile search stacked on top of it.
for sure we need to fix the referral code thing, unless you tested that it works?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
careful with this approach of modifying already applied migrations, pretty sure staging won't get properly updated since supabase thinks it's already applied.
This would work for prod though since it hasn't been applied.
On the safe side, let's apply this in a new migration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
send_id can never be null right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct
let baseUrl = getBaseUrl() | ||
|
||
if (!baseUrl && typeof window !== 'undefined') { | ||
const { protocol, hostname, port } = window.location | ||
baseUrl = `${protocol}//${hostname}${port ? `:${port}` : ''}` | ||
} | ||
|
||
return `${baseUrl}/?referral=${referralCode}` | ||
return `${baseUrl}/${linkType}/${Code}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't this break the referral tracking code? we don't have any test coverage for that, but I'm sure it does.
https://github.com/0xsend/sendapp/blob/dev/apps/next/pages/index.tsx#L25-L34
|
||
CREATE SEQUENCE profiles_send_id_seq; | ||
SELECT setval('profiles_send_id_seq', coalesce(max(send_id), 0) + 1, false) FROM profiles; | ||
ALTER TABLE profiles ALTER COLUMN send_id SET DEFAULT nextval('profiles_send_id_seq'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also make it not null. let's add an after update trigger to ensure a user can't change their send ID since users are allowed to update their profiles according to our current RLS policies.
something like this https://github.com/0xsend/sendapp/blob/dev/supabase/migrations/20230819194129_add_tags_table_rls.sql#L98-L104
This PR Adds the send_id to the users profile, the send id represents the order in which a user signed up for an account.
Frontend needs to be updated to handle the new resultset.