fix: revert ctx→_ctx rename — ctx IS used for auth in server actions
The previous lint fix incorrectly renamed ctx to _ctx in server actions that actually USE ctx.user.id for authorization. This caused runtime 'ctx is not defined' errors when creating pages, modules, etc. Reverted all 13 action files back to using ctx properly.
This commit is contained in:
@@ -25,7 +25,7 @@ export const uploadFile = authActionClient
|
||||
recordId: z.string().uuid().optional(),
|
||||
}),
|
||||
)
|
||||
.action(async ({ parsedInput: input, ctx: _ctx }) => {
|
||||
.action(async ({ parsedInput: input, ctx }) => {
|
||||
const client = getSupabaseServerClient();
|
||||
const logger = await getLogger();
|
||||
const api = createModuleBuilderApi(client);
|
||||
|
||||
@@ -17,7 +17,7 @@ import { validateRecordData } from '../services/record-validation.service';
|
||||
|
||||
export const createRecord = authActionClient
|
||||
.inputSchema(CreateRecordSchema)
|
||||
.action(async ({ parsedInput: input, ctx: _ctx }) => {
|
||||
.action(async ({ parsedInput: input, ctx }) => {
|
||||
const client = getSupabaseServerClient();
|
||||
const logger = await getLogger();
|
||||
const api = createModuleBuilderApi(client);
|
||||
@@ -69,7 +69,7 @@ export const createRecord = authActionClient
|
||||
|
||||
export const updateRecord = authActionClient
|
||||
.inputSchema(UpdateRecordSchema.extend({ accountId: z.string().uuid() }))
|
||||
.action(async ({ parsedInput: input, ctx: _ctx }) => {
|
||||
.action(async ({ parsedInput: input, ctx }) => {
|
||||
const client = getSupabaseServerClient();
|
||||
const logger = await getLogger();
|
||||
const api = createModuleBuilderApi(client);
|
||||
@@ -123,7 +123,7 @@ export const updateRecord = authActionClient
|
||||
|
||||
export const deleteRecord = authActionClient
|
||||
.inputSchema(DeleteRecordSchema.extend({ accountId: z.string().uuid() }))
|
||||
.action(async ({ parsedInput: input, ctx: _ctx }) => {
|
||||
.action(async ({ parsedInput: input, ctx }) => {
|
||||
const client = getSupabaseServerClient();
|
||||
const logger = await getLogger();
|
||||
const api = createModuleBuilderApi(client);
|
||||
@@ -154,7 +154,7 @@ export const deleteRecord = authActionClient
|
||||
|
||||
export const lockRecord = authActionClient
|
||||
.inputSchema(LockRecordSchema.extend({ accountId: z.string().uuid() }))
|
||||
.action(async ({ parsedInput: input, ctx: _ctx }) => {
|
||||
.action(async ({ parsedInput: input, ctx }) => {
|
||||
const client = getSupabaseServerClient();
|
||||
const api = createModuleBuilderApi(client);
|
||||
const userId = ctx.user.id;
|
||||
@@ -182,7 +182,7 @@ export const bulkImportRecords = authActionClient
|
||||
dryRun: z.boolean().default(false),
|
||||
}),
|
||||
)
|
||||
.action(async ({ parsedInput: input, ctx: _ctx }) => {
|
||||
.action(async ({ parsedInput: input, ctx }) => {
|
||||
const client = getSupabaseServerClient();
|
||||
const logger = await getLogger();
|
||||
const api = createModuleBuilderApi(client);
|
||||
|
||||
Reference in New Issue
Block a user