File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import type * as actions_clear from "../actions/clear.js";
1818import type * as actions_createChallengeFromConfig from "../actions/createChallengeFromConfig.js" ;
1919import type * as actions_fix2025ActivityTypes from "../actions/fix2025ActivityTypes.js" ;
2020import type * as actions_fixContributesToStreak from "../actions/fixContributesToStreak.js" ;
21+ import type * as actions_migrateSupabaseAvatars from "../actions/migrateSupabaseAvatars.js" ;
2122import type * as actions_payments from "../actions/payments.js" ;
2223import type * as actions_rescoreStravaActivities from "../actions/rescoreStravaActivities.js" ;
2324import type * as actions_seed from "../actions/seed.js" ;
@@ -159,6 +160,7 @@ declare const fullApi: ApiFromModules<{
159160 "actions/createChallengeFromConfig" : typeof actions_createChallengeFromConfig ;
160161 "actions/fix2025ActivityTypes" : typeof actions_fix2025ActivityTypes ;
161162 "actions/fixContributesToStreak" : typeof actions_fixContributesToStreak ;
163+ "actions/migrateSupabaseAvatars" : typeof actions_migrateSupabaseAvatars ;
162164 "actions/payments" : typeof actions_payments ;
163165 "actions/rescoreStravaActivities" : typeof actions_rescoreStravaActivities ;
164166 "actions/seed" : typeof actions_seed ;
Original file line number Diff line number Diff line change 11import { internalMutation } from "../_generated/server" ;
22import { v } from "convex/values" ;
33
4+ /**
5+ * Update a user's avatarUrl after migrating from Supabase to Cloudinary.
6+ */
7+ export const patchUserAvatar = internalMutation ( {
8+ args : {
9+ userId : v . id ( "users" ) ,
10+ avatarUrl : v . string ( ) ,
11+ } ,
12+ handler : async ( ctx , args ) => {
13+ await ctx . db . patch ( args . userId , { avatarUrl : args . avatarUrl } ) ;
14+ } ,
15+ } ) ;
16+
417/**
518 * Patch an activity with cloudinaryPublicIds after backfill upload.
619 */
Original file line number Diff line number Diff line change 11import { internalQuery } from "../_generated/server" ;
22import { v } from "convex/values" ;
33
4+ /**
5+ * Find users whose avatarUrl points to Supabase storage.
6+ */
7+ export const findUsersWithSupabaseAvatars = internalQuery ( {
8+ args : { } ,
9+ handler : async ( ctx ) => {
10+ const users = await ctx . db . query ( "users" ) . collect ( ) ;
11+ return users
12+ . filter ( ( u ) => u . avatarUrl ?. includes ( "supabase.co" ) )
13+ . map ( ( u ) => ( {
14+ _id : u . _id ,
15+ name : u . name ,
16+ avatarUrl : u . avatarUrl ! ,
17+ } ) ) ;
18+ } ,
19+ } ) ;
20+
421/**
522 * Find activities that have Convex mediaIds but no cloudinaryPublicIds.
623 * Used by the backfill action to process existing media.
You can’t perform that action at this time.
0 commit comments