refactor(workspace): clean up resolver and improve error handling (#9225)
Removed unused `LoginTokenService` imports and dependencies for better code clarity. Enhanced error handling in `getPublicWorkspaceDataBySubdomain` with a try-catch block, ensuring consistent exception handling. This improves maintainability and robustness of the resolver.
This commit is contained in:
@ -12,7 +12,6 @@ import { FileUpload, GraphQLUpload } from 'graphql-upload';
|
||||
|
||||
import { FileFolder } from 'src/engine/core-modules/file/interfaces/file-folder.interface';
|
||||
|
||||
import { LoginTokenService } from 'src/engine/core-modules/auth/token/services/login-token.service';
|
||||
import { BillingSubscription } from 'src/engine/core-modules/billing/entities/billing-subscription.entity';
|
||||
import { BillingSubscriptionService } from 'src/engine/core-modules/billing/services/billing-subscription.service';
|
||||
import { DomainManagerService } from 'src/engine/core-modules/domain-manager/service/domain-manager.service';
|
||||
@ -54,7 +53,6 @@ import { WorkspaceService } from './services/workspace.service';
|
||||
export class WorkspaceResolver {
|
||||
constructor(
|
||||
private readonly workspaceService: WorkspaceService,
|
||||
private readonly loginTokenService: LoginTokenService,
|
||||
private readonly domainManagerService: DomainManagerService,
|
||||
private readonly userWorkspaceService: UserWorkspaceService,
|
||||
private readonly environmentService: EnvironmentService,
|
||||
@ -186,6 +184,7 @@ export class WorkspaceResolver {
|
||||
|
||||
@Query(() => PublicWorkspaceDataOutput)
|
||||
async getPublicWorkspaceDataBySubdomain(@OriginHeader() origin: string) {
|
||||
try {
|
||||
const workspace =
|
||||
await this.domainManagerService.getWorkspaceByOriginOrDefaultWorkspace(
|
||||
origin,
|
||||
@ -231,5 +230,8 @@ export class WorkspaceResolver {
|
||||
systemEnabledProviders,
|
||||
}),
|
||||
};
|
||||
} catch (err) {
|
||||
workspaceGraphqlApiExceptionHandler(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user