Skip to content

Commit d13b0e6

Browse files
committed
refactor(auth): add createdAt field to user response and update environment variables
1 parent a8f1ba2 commit d13b0e6

60 files changed

Lines changed: 431 additions & 853 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/api/src/auth/auth.controller.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export class AuthController {
5454
logo: true,
5555
onboardingCompleted: true,
5656
hasAccess: true,
57+
createdAt: true,
5758
},
5859
},
5960
},

apps/app/src/actions/add-comment.ts

Lines changed: 0 additions & 75 deletions
This file was deleted.

apps/app/src/actions/files/upload-file.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
'use server';
22

3-
console.log('[uploadFile] Upload action module is being loaded...');
4-
5-
console.log('[uploadFile] Importing auth and logger...');
63
import { BUCKET_NAME, s3Client } from '@/app/s3';
74
import { auth } from '@/utils/auth';
85
import { logger } from '@/utils/logger';
@@ -13,14 +10,6 @@ import { revalidatePath } from 'next/cache';
1310
import { headers } from 'next/headers';
1411
import { z } from 'zod';
1512

16-
console.log('[uploadFile] Importing S3 client...');
17-
18-
console.log('[uploadFile] Importing AWS SDK...');
19-
20-
console.log('[uploadFile] Importing database...');
21-
22-
console.log('[uploadFile] All imports successful');
23-
2413
// This log will run as soon as the module is loaded.
2514
logger.info('[uploadFile] Module loaded.');
2615

@@ -50,10 +39,8 @@ const uploadAttachmentSchema = z.object({
5039
});
5140

5241
export const uploadFile = async (input: z.infer<typeof uploadAttachmentSchema>) => {
53-
console.log('[uploadFile] Function called - starting execution');
5442
logger.info(`[uploadFile] Starting upload for ${input.fileName}`);
5543

56-
console.log('[uploadFile] Checking S3 client availability');
5744
try {
5845
// Check if S3 client is available
5946
if (!s3Client) {
@@ -72,11 +59,9 @@ export const uploadFile = async (input: z.infer<typeof uploadAttachmentSchema>)
7259
} as const;
7360
}
7461

75-
console.log('[uploadFile] Parsing input schema');
7662
const { fileName, fileType, fileData, entityId, entityType, pathToRevalidate } =
7763
uploadAttachmentSchema.parse(input);
7864

79-
console.log('[uploadFile] Getting user session');
8065
const session = await auth.api.getSession({ headers: await headers() });
8166
const organizationId = session?.session.activeOrganizationId;
8267

@@ -90,7 +75,6 @@ export const uploadFile = async (input: z.infer<typeof uploadAttachmentSchema>)
9075

9176
logger.info(`[uploadFile] Starting upload for ${fileName} in org ${organizationId}`);
9277

93-
console.log('[uploadFile] Converting file data to buffer');
9478
const fileBuffer = Buffer.from(fileData, 'base64');
9579

9680
const MAX_FILE_SIZE_MB = 100;

apps/app/src/actions/floating.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

apps/app/src/actions/tasks.ts

Lines changed: 0 additions & 26 deletions
This file was deleted.

apps/app/src/app/(app)/[orgId]/components/AppShellWrapper.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
DropdownMenuSeparator,
1717
DropdownMenuTrigger,
1818
} from '@comp/ui/dropdown-menu';
19+
import type { OrganizationFromMe } from '@/types';
1920
import type { Onboarding, Organization } from '@db';
2021
import {
2122
AppShell,
@@ -51,7 +52,7 @@ import { ConditionalOnboardingTracker } from './ConditionalOnboardingTracker';
5152
interface AppShellWrapperProps {
5253
children: React.ReactNode;
5354
organization: Organization;
54-
organizations: Organization[];
55+
organizations: OrganizationFromMe[];
5556
logoUrls: Record<string, string>;
5657
onboarding: Onboarding | null;
5758
isCollapsed: boolean;

apps/app/src/app/(app)/[orgId]/frameworks/components/DraggableCards.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,6 @@ export function DraggableCards({ children, onReorder }: DraggableCardsProps) {
6868
return originalIndex;
6969
});
7070

71-
console.log('Drag reorder:', {
72-
oldIndex,
73-
newIndex,
74-
newItems: newItems.map((_, i) => `card-${i}`),
75-
newOrder,
76-
childrenLength: children.length,
77-
});
78-
7971
updateOrder(newOrder);
8072

8173
// Call the onReorder callback with the new order

apps/app/src/app/(app)/[orgId]/integrations/components/PlatformIntegrations.tsx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -252,19 +252,16 @@ export function PlatformIntegrations({ className, taskTemplates }: PlatformInteg
252252

253253
// Wait for data to load
254254
if (!connections || !providers || loadingConnections || loadingProviders) {
255-
console.log('[OAuth] Waiting for data to load...');
256255
return;
257256
}
258257

259258
// Mark as handled
260259
hasHandledOAuthRef.current = true;
261-
console.log('[OAuth] Handling callback for', providerSlug);
262260

263261
const connection = connections.find((c) => c.providerSlug === providerSlug);
264262
const provider = providers.find((p) => p.id === providerSlug);
265263

266264
if (connection && provider) {
267-
console.log('[OAuth] Found connection and provider, opening dialog');
268265
toast.success(`${provider.name} connected successfully!`);
269266

270267
// Set state first
@@ -273,16 +270,8 @@ export function PlatformIntegrations({ className, taskTemplates }: PlatformInteg
273270

274271
// Open dialog after a tick to ensure state is updated
275272
setTimeout(() => {
276-
console.log('[OAuth] Opening manage dialog');
277273
setManageDialogOpen(true);
278274
}, 150);
279-
} else {
280-
console.warn('[OAuth] Connection or provider not found:', {
281-
hasConnection: !!connection,
282-
hasProvider: !!provider,
283-
connectionsCount: connections.length,
284-
providersCount: providers.length,
285-
});
286275
}
287276

288277
// Clean up URL parameters

apps/app/src/app/(app)/[orgId]/layout.test.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ vi.mock('@/app/s3', () => ({
2424
vi.mock('@/components/trigger-token-provider', () => ({
2525
TriggerTokenProvider: ({ children }: { children: React.ReactNode }) => children,
2626
}));
27-
vi.mock('@/data/getOrganizations', () => ({
28-
getOrganizations: vi.fn().mockResolvedValue({ organizations: [] }),
27+
vi.mock('@/lib/api-server', () => ({
28+
serverApi: {
29+
get: vi.fn().mockResolvedValue({ data: { organizations: [] }, status: 200 }),
30+
},
2931
}));
3032
vi.mock('@/lib/permissions', () => ({
3133
canAccessApp: vi.fn().mockReturnValue(true),

apps/app/src/app/(app)/[orgId]/layout.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { getFeatureFlags } from '@/app/posthog';
22
import { APP_AWS_ORG_ASSETS_BUCKET, s3Client } from '@/app/s3';
33
import { TriggerTokenProvider } from '@/components/trigger-token-provider';
4-
import { getOrganizations } from '@/data/getOrganizations';
4+
import { serverApi } from '@/lib/api-server';
55
import { canAccessApp } from '@/lib/permissions';
6+
import type { OrganizationFromMe } from '@/types';
67
import { resolveUserPermissions } from '@/lib/permissions.server';
78
import { auth } from '@/utils/auth';
89
import { GetObjectCommand } from '@aws-sdk/client-s3';
@@ -120,8 +121,9 @@ export default async function Layout({
120121
},
121122
});
122123

123-
// Fetch organizations and feature flags for sidebar
124-
const { organizations } = await getOrganizations();
124+
// Fetch organizations for sidebar via API
125+
const meRes = await serverApi.get<{ organizations: OrganizationFromMe[] }>('/v1/auth/me');
126+
const organizations = meRes.data?.organizations ?? [];
125127

126128
// Generate logo URLs for all organizations
127129
const logoUrls: Record<string, string> = {};

0 commit comments

Comments
 (0)