3959 create a activationstatus in coreworkspace and use it in front to redirect properly (#3989)
* Add computed field to workspace entity * Add activationStatus to front requests * Update Selector * Use activation status * Stop using selector for mock values * Remove isCurrentWorkspaceActiveSelector * Use activation status * Fix typo * Use activation status * Create hook for sign in up navigate * Update hook to handle profile creation * Use varaible * Use more readable boolean function
This commit is contained in:
@ -35,6 +35,10 @@ export class WorkspaceService extends TypeOrmQueryService<Workspace> {
|
||||
return user.defaultWorkspace;
|
||||
}
|
||||
|
||||
async isWorkspaceActivated(id: string): Promise<boolean> {
|
||||
return await this.workspaceManagerService.doesDataSourceExist(id);
|
||||
}
|
||||
|
||||
async deleteWorkspace(id: string, shouldDeleteCoreWorkspace = true) {
|
||||
const workspace = await this.workspaceRepository.findOneBy({ id });
|
||||
|
||||
|
||||
@ -62,4 +62,7 @@ export class Workspace {
|
||||
@Field()
|
||||
@Column({ default: 'incomplete' })
|
||||
subscriptionStatus: 'incomplete' | 'active' | 'canceled';
|
||||
|
||||
@Field()
|
||||
activationStatus: 'active' | 'inactive';
|
||||
}
|
||||
|
||||
@ -1,4 +1,11 @@
|
||||
import { Resolver, Query, Args, Mutation } from '@nestjs/graphql';
|
||||
import {
|
||||
Resolver,
|
||||
Query,
|
||||
Args,
|
||||
Mutation,
|
||||
ResolveField,
|
||||
Parent,
|
||||
} from '@nestjs/graphql';
|
||||
import { ForbiddenException, UseGuards } from '@nestjs/common';
|
||||
|
||||
import { FileUpload, GraphQLUpload } from 'graphql-upload';
|
||||
@ -90,4 +97,15 @@ export class WorkspaceResolver {
|
||||
|
||||
return this.workspaceService.deleteWorkspace(id);
|
||||
}
|
||||
|
||||
@ResolveField(() => String)
|
||||
async activationStatus(
|
||||
@Parent() workspace: Workspace,
|
||||
): Promise<'active' | 'inactive'> {
|
||||
if (await this.workspaceService.isWorkspaceActivated(workspace.id)) {
|
||||
return 'active';
|
||||
}
|
||||
|
||||
return 'inactive';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user