@@ -7,8 +7,13 @@ import { requireUser } from "~/services/session.server";
77import { flags as getGlobalFlags } from "~/v3/featureFlags.server" ;
88import { validatePartialFeatureFlags , getAllFlagControlTypes } from "~/v3/featureFlags" ;
99
10+ // Session-auth route for the admin feature flags dialog.
11+ // Uses replace semantics: the action writes the full flag set (or null to clear).
12+ // Compare with v1 (admin.api.v1.orgs.$organizationId.feature-flags.ts) which
13+ // uses PAT auth and merge semantics for programmatic use.
14+
1015const ParamsSchema = z . object ( {
11- orgId : z . string ( ) ,
16+ organizationId : z . string ( ) ,
1217} ) ;
1318
1419export async function loader ( { request, params } : LoaderFunctionArgs ) {
@@ -17,11 +22,11 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
1722 throw new Response ( "Unauthorized" , { status : 403 } ) ;
1823 }
1924
20- const { orgId } = ParamsSchema . parse ( params ) ;
25+ const { organizationId } = ParamsSchema . parse ( params ) ;
2126
2227 const [ organization , globalFlags ] = await Promise . all ( [
2328 prisma . organization . findFirst ( {
24- where : { id : orgId } ,
29+ where : { id : organizationId } ,
2530 select : {
2631 id : true ,
2732 title : true ,
@@ -61,7 +66,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
6166 throw new Response ( "Unauthorized" , { status : 403 } ) ;
6267 }
6368
64- const { orgId } = ParamsSchema . parse ( params ) ;
69+ const { organizationId } = ParamsSchema . parse ( params ) ;
6570
6671 let body : unknown ;
6772 try {
@@ -90,7 +95,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
9095
9196 try {
9297 await prisma . organization . update ( {
93- where : { id : orgId } ,
98+ where : { id : organizationId } ,
9499 data : { featureFlags : featureFlags as Prisma . InputJsonValue } ,
95100 } ) ;
96101 } catch ( e ) {
0 commit comments