File tree Expand file tree Collapse file tree
(marketing)/codevs/_components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export const revalidate = 0;
1515
1616export default async function CodevsProfiles ( ) {
1717 const [ { data : allCodevs , error } ] = await Promise . all ( [
18- getCodevs ( { filters : { role_id : 10 } } ) , // show only Codevs with role_id 10 which is Codev
18+ getCodevs ( { filters : { application_status : "passed" } } ) , // show only accepted Codevs (application_status is the source of truth)
1919 ] ) ;
2020
2121 if ( error ) {
Original file line number Diff line number Diff line change @@ -275,7 +275,7 @@ export async function acceptApplicantAction(applicantId: string) {
275275 . from ( "codev" )
276276 . update ( {
277277 application_status : "passed" ,
278- role_id : 4 ,
278+ role_id : 10 ,
279279 date_joined : new Date ( ) . toISOString ( ) ,
280280 updated_at : new Date ( ) . toISOString ( )
281281 } )
@@ -305,7 +305,7 @@ export async function multipleAcceptApplicantAction(applicantIds: string[]) {
305305 . from ( "codev" )
306306 . update ( {
307307 application_status : "passed" ,
308- role_id : 4 ,
308+ role_id : 10 ,
309309 date_joined : new Date ( ) . toISOString ( ) ,
310310 updated_at : new Date ( ) . toISOString ( )
311311 } )
Original file line number Diff line number Diff line change 1+ -- =============================================================================
2+ -- Fix role_id for accepted developers
3+ --
4+ -- The accept flow was incorrectly assigning role_id: 4 (Super Admin/Intern)
5+ -- instead of role_id: 10 (Codev). This migration:
6+ -- 1. Fixes existing accepted devs who have role_id 4 → set them to role_id 10
7+ -- 2. Does NOT touch role_id 1 (Admin) users — they stay as Admin
8+ -- 3. Only affects rows where application_status = 'passed'
9+ --
10+ -- Role ID mapping (confirmed from codebase usage):
11+ -- 1 = Admin
12+ -- 4 = Super Admin / Intern (over-privileged, was assigned by mistake in accept flow)
13+ -- 5 = Mentor
14+ -- 7 = Applicant
15+ -- 10 = Codev (intended role for accepted developers)
16+ -- =============================================================================
17+
18+ -- Fix existing accepted developers who were given the wrong role
19+ UPDATE public .codev
20+ SET role_id = 10 ,
21+ updated_at = NOW()
22+ WHERE application_status = ' passed'
23+ AND role_id = 4 ;
24+
25+ -- Log what was changed
26+ SELECT ' Fixed role_id for accepted devs' AS action,
27+ COUNT (* ) AS rows_affected
28+ FROM public .codev
29+ WHERE application_status = ' passed'
30+ AND role_id = 10 ;
You can’t perform that action at this time.
0 commit comments