Skip to content

Commit 01d6244

Browse files
committed
refactor: simplify user profile to username-only state
Removed the full user profile API endpoint and state management in favor of a simpler username-only approach. The previous IUserProfile interface contained both email and username, but only username was actively used throughout the application. Changes: - Backend: removed /api/userprofile endpoint and userProfileApi service - Frontend: renamed User/Profile store slice to User/Name - API: removed IUserProfile interface from common DTO - Simplified API response to return username string directly - Updated all imports and selectors to use new username-only state - Renamed actionCreators from userProfileActionCreators to usernameActionCreators - Updated all tests to reflect new naming and structure This reduces complexity and aligns the state structure with actual usage. Assisted-by: Claude Sonnet 4.5
1 parent f87012b commit 01d6244

32 files changed

Lines changed: 154 additions & 446 deletions

File tree

packages/common/src/dto/api/index.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,6 @@ export interface IPluginRegistry {
166166
openVSXURL?: string;
167167
}
168168

169-
export interface IUserProfile {
170-
email: string;
171-
username: string;
172-
}
173169
export interface IWorkspacePreferences {
174170
'skip-authorisation': GitProvider[];
175171
'trusted-sources'?: TrustedSources;

packages/dashboard-backend/src/__tests__/route-registration.spec.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,6 @@ describe('Route Registration Integration Tests', () => {
182182
expect(res.statusCode).toBeLessThan(500);
183183
});
184184

185-
it('should not break existing user-profile route', async () => {
186-
const res = await app.inject().get(`${baseApiPath}/userprofile/${namespace}`);
187-
188-
expect(res.statusCode).not.toBe(404);
189-
});
190-
191185
it('should preserve existing devworkspaces routes', async () => {
192186
const routes = app.printRoutes();
193187

packages/dashboard-backend/src/app.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ import { registerPodmanLoginRoute } from '@/routes/api/podmanLogin';
4545
import { registerPodsRoutes } from '@/routes/api/pods';
4646
import { registerServerConfigRoute } from '@/routes/api/serverConfig';
4747
import { registerSShKeysRoutes } from '@/routes/api/sshKeys';
48-
import { registerUserProfileRoute } from '@/routes/api/userProfile';
4948
import { registerWebsocket } from '@/routes/api/websocket';
5049
import { registerWorkspacePreferencesRoute } from '@/routes/api/workspacePreferences';
5150
import { registerFactoryAcceptanceRedirect } from '@/routes/factoryAcceptanceRedirect';
@@ -120,8 +119,6 @@ export default async function buildApp(server: FastifyInstance): Promise<unknown
120119

121120
registerServerConfigRoute(server),
122121

123-
registerUserProfileRoute(server),
124-
125122
registerGitBranchesRoute(server),
126123

127124
registerDataResolverRoute(server),

packages/dashboard-backend/src/devworkspaceClient/__mocks__/index.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import {
2727
IPodApi,
2828
IServerConfigApi,
2929
IShhKeysApi,
30-
IUserProfileApi,
3130
IWorkspacePreferencesApi,
3231
} from '@/devworkspaceClient/types';
3332

@@ -52,9 +51,6 @@ export class DevWorkspaceClient implements IDevWorkspaceClient {
5251
get kubeConfigApi(): IKubeConfigApi {
5352
throw new Error('Method not implemented.');
5453
}
55-
get userProfileApi(): IUserProfileApi {
56-
throw new Error('Method not implemented.');
57-
}
5854
get logsApi(): ILogsApi {
5955
throw new Error('Method not implemented.');
6056
}

packages/dashboard-backend/src/devworkspaceClient/__tests__/index.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import { LogsApiService } from '@/devworkspaceClient/services/logsApi';
2626
import { PodApiService } from '@/devworkspaceClient/services/podApi';
2727
import { ServerConfigApiService } from '@/devworkspaceClient/services/serverConfigApi';
2828
import { SshKeysService } from '@/devworkspaceClient/services/sshKeysApi';
29-
import { UserProfileApiService } from '@/devworkspaceClient/services/userProfileApi';
3029

3130
jest.mock('@/devworkspaceClient/services/devWorkspaceApi.ts');
3231

@@ -54,7 +53,6 @@ describe('DevWorkspace client', () => {
5453
expect(client.logsApi).toBeInstanceOf(LogsApiService);
5554
expect(client.podApi).toBeInstanceOf(PodApiService);
5655
expect(client.serverConfigApi).toBeInstanceOf(ServerConfigApiService);
57-
expect(client.userProfileApi).toBeInstanceOf(UserProfileApiService);
5856
expect(client.gitConfigApi).toBeInstanceOf(GitConfigApiService);
5957
expect(client.gettingStartedSampleApi).toBeInstanceOf(GettingStartedSamplesApiService);
6058
expect(client.sshKeysApi).toBeInstanceOf(SshKeysService);

packages/dashboard-backend/src/devworkspaceClient/index.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import { PodApiService } from '@/devworkspaceClient/services/podApi';
2828
import { PodmanApiService } from '@/devworkspaceClient/services/podmanApi';
2929
import { ServerConfigApiService } from '@/devworkspaceClient/services/serverConfigApi';
3030
import { SshKeysService } from '@/devworkspaceClient/services/sshKeysApi';
31-
import { UserProfileApiService } from '@/devworkspaceClient/services/userProfileApi';
3231
import { WorkspacePreferencesApiService } from '@/devworkspaceClient/services/workspacePreferencesApi';
3332
import {
3433
IAirGapSampleApi,
@@ -48,7 +47,6 @@ import {
4847
IPodmanApi,
4948
IServerConfigApi,
5049
IShhKeysApi,
51-
IUserProfileApi,
5250
IWorkspacePreferencesApi,
5351
} from '@/devworkspaceClient/types';
5452

@@ -93,10 +91,6 @@ export class DevWorkspaceClient implements IDevWorkspaceClient {
9391
return new PodmanApiService(this.kubeConfig);
9492
}
9593

96-
get userProfileApi(): IUserProfileApi {
97-
return new UserProfileApiService(this.kubeConfig);
98-
}
99-
10094
get logsApi(): ILogsApi {
10195
return new LogsApiService(this.kubeConfig);
10296
}

packages/dashboard-backend/src/devworkspaceClient/services/__tests__/userProfileApi.spec.ts

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

packages/dashboard-backend/src/devworkspaceClient/services/userProfileApi.ts

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

packages/dashboard-backend/src/devworkspaceClient/types/index.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -449,13 +449,6 @@ export interface IPodmanApi {
449449
podmanLogin(namespace: string, devworkspaceId: string): Promise<void>;
450450
}
451451

452-
export interface IUserProfileApi {
453-
/**
454-
* Returns user profile object that contains username and email.
455-
*/
456-
getUserProfile(namespace: string): Promise<api.IUserProfile | undefined>;
457-
}
458-
459452
export interface IWorkspacePreferencesApi {
460453
/**
461454
* Returns workspace preferences object that contains skip-authorisation info.
@@ -522,7 +515,6 @@ export interface IDevWorkspaceClient {
522515
personalAccessTokenApi: IPersonalAccessTokenApi;
523516
podApi: IPodApi;
524517
serverConfigApi: IServerConfigApi;
525-
userProfileApi: IUserProfileApi;
526518
gitConfigApi: IGitConfigApi;
527519
gettingStartedSampleApi: IGettingStartedSampleApi;
528520
airGapSampleApi: IAirGapSampleApi;

packages/dashboard-backend/src/routes/api/__tests__/userProfile.spec.ts

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

0 commit comments

Comments
 (0)