Skip to content

Conversation

@hbjORbj
Copy link
Contributor

@hbjORbj hbjORbj commented Dec 12, 2025

What does this PR do?

Moves the userAdminRouter from packages/features/ee/users/server/trpc-router.ts to packages/trpc/server/routers/viewer/users/_router.ts to follow the standard tRPC router organization pattern.

Why?

This removes cross-package coupling by replacing imported types with local interfaces as well as circular dependencies where features layer import trpc layer

Changes

  • Moved userAdminRouter to packages/trpc/server/routers/viewer/users/_router.ts
  • Updated imports in viewer/_router.tsx and /api/trpc/users handler
  • Replaced UserAdminRouterOutputs type dependency with local User interface in UserForm.tsx and users-edit-view.tsx
  • Simplified UsersEditView to accept a User prop directly (removed page-level wrappers)

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • N/A - I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

@graphite-app graphite-app bot requested a review from a team December 12, 2025 07:19
@hbjORbj hbjORbj changed the title refactor: move usersrouter to trpc refactor: Move Users Admin TRPC router from features package to trpc layer Dec 12, 2025
Comment on lines +15 to +16
interface User {
id: number;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

creating a type rather than coupling with UserAdminRouterOutputs which exists in trpc package now

type FormValues = Pick<
User,
"avatarUrl" | "name" | "username" | "email" | "bio" | "createdDate" | "theme" | "defaultScheduleId" | "allowDynamicBooking"
| "avatarUrl"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just formatting changes

</LicenseRequired>
);
};
interface User {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

creating a type rather than coupling with UserAdminRouterOutputs which exists in trpc package now

@hbjORbj hbjORbj enabled auto-merge (squash) December 12, 2025 07:21
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 5 files

Comment on lines -18 to -20
const userIdSchema = z.object({ id: z.coerce.number() });

const UsersEditPage = () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not used anywhere

@hbjORbj hbjORbj merged commit a8f43da into main Dec 14, 2025
89 of 96 checks passed
@hbjORbj hbjORbj deleted the refactor/move-usersRouter-to-trpc branch December 14, 2025 11:45
weekStart: string;
theme: string | null;
defaultScheduleId: number | null;
locale: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build failed because locale is nullable in the database schema

weekStart: string;
theme: string | null;
defaultScheduleId: number | null;
locale: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build failed because locale is nullable in the database schema

@verstratenbram
Copy link
Contributor

Build failed because locale is nullable in the database schema

@calcom/web:build: Failed to compile.
@calcom/web:build: 
@calcom/web:build: ./app/(use-page-wrapper)/settings/(admin-layout)/admin/users/[id]/edit/page.tsx:49:24
@calcom/web:build: Type error: Type '{ id: number; email: string; name: string | null; role: UserPermissionRole; timeZone: string; requiresBookerEmailVerification: boolean | null; metadata: JsonValue; ... 40 more ...; whitelistWorkflows: boolean; }' is not assignable to type 'User'.
@calcom/web:build:   Types of property 'locale' are incompatible.
@calcom/web:build:     Type 'string | null' is not assignable to type 'string'.
@calcom/web:build:       Type 'null' is not assignable to type 'string'.
@calcom/web:build: 
@calcom/web:build:   47 |     <SettingsHeader title={t("editing_user")} description={t("admin_users_edit_description")}>
@calcom/web:build:   48 |       <LicenseRequired>
@calcom/web:build: > 49 |         <UsersEditView user={user} />
@calcom/web:build:      |                        ^
@calcom/web:build:   50 |       </LicenseRequired>
@calcom/web:build:   51 |     </SettingsHeader>
@calcom/web:build:   52 |   );
Next.js build worker exited with code: 1 and signal: null

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants