Fix issues post merge
This commit is contained in:
@ -23,12 +23,12 @@ const StyledContainer = styled.div<ContainerProps>`
|
||||
`;
|
||||
|
||||
const StyledCircle = styled(motion.div)<{
|
||||
toggleSize: ToggleSize;
|
||||
size: ToggleSize;
|
||||
}>`
|
||||
background-color: ${({ theme }) => theme.background.primary};
|
||||
border-radius: 50%;
|
||||
height: ${({ toggleSize }) => (toggleSize === 'small' ? 12 : 16)}px;
|
||||
width: ${({ toggleSize }) => (toggleSize === 'small' ? 12 : 16)}px;
|
||||
height: ${({ size }) => (size === 'small' ? 12 : 16)}px;
|
||||
width: ${({ size }) => (size === 'small' ? 12 : 16)}px;
|
||||
`;
|
||||
|
||||
export type ToggleProps = {
|
||||
@ -76,7 +76,7 @@ export const Toggle = ({
|
||||
<StyledCircle
|
||||
animate={isOn ? 'on' : 'off'}
|
||||
variants={circleVariants}
|
||||
toggleSize={toggleSize}
|
||||
size={toggleSize}
|
||||
/>
|
||||
</StyledContainer>
|
||||
);
|
||||
|
||||
@ -65,7 +65,7 @@ export const SettingsObjectNewFieldStep2 = () => {
|
||||
},
|
||||
});
|
||||
|
||||
if (!activeObjectMetadataItem || !objectViews.length) return null;
|
||||
if (!activeObjectMetadataItem) return null;
|
||||
|
||||
const canSave = !!formValues.label;
|
||||
|
||||
|
||||
@ -6,13 +6,13 @@ import { TypeOrmQueryService } from '@ptc-org/nestjs-query-typeorm';
|
||||
import { Repository } from 'typeorm';
|
||||
|
||||
import { Workspace } from 'src/coreV2/workspace/workspace.entity';
|
||||
import { TenantManagerService } from 'src/tenant-manager/tenant-manager.service';
|
||||
import { WorkspaceManagerService } from 'src/workspace/workspace-manager/workspace-manager.service';
|
||||
|
||||
export class WorkspaceService extends TypeOrmQueryService<Workspace> {
|
||||
constructor(
|
||||
@InjectRepository(Workspace)
|
||||
private readonly workspaceRepository: Repository<Workspace>,
|
||||
private readonly tenantManagerService: TenantManagerService,
|
||||
private readonly workspaceManagerService: WorkspaceManagerService,
|
||||
) {
|
||||
super(workspaceRepository);
|
||||
}
|
||||
@ -21,83 +21,8 @@ export class WorkspaceService extends TypeOrmQueryService<Workspace> {
|
||||
const workspace = await this.workspaceRepository.findOneBy({ id });
|
||||
assert(workspace, 'Workspace not found');
|
||||
|
||||
// await this.deleteWorkspaceRelations(id);
|
||||
|
||||
await this.tenantManagerService.delete(id);
|
||||
await this.workspaceManagerService.delete(id);
|
||||
|
||||
return workspace;
|
||||
}
|
||||
|
||||
// // FIXME: The rest of the entities are not defined so we can't use this
|
||||
// async deleteWorkspaceRelations(workspaceId: string) {
|
||||
// const queryRunner =
|
||||
// this.workspaceRepository.manager.connection.createQueryRunner();
|
||||
// await queryRunner.connect();
|
||||
|
||||
// await queryRunner.startTransaction();
|
||||
|
||||
// try {
|
||||
// await queryRunner.manager.delete(PipelineProgress, {
|
||||
// workspaceId,
|
||||
// });
|
||||
|
||||
// await queryRunner.manager.delete(Company, {
|
||||
// workspaceId,
|
||||
// });
|
||||
|
||||
// await queryRunner.manager.delete(Person, {
|
||||
// workspaceId,
|
||||
// });
|
||||
|
||||
// await queryRunner.manager.delete(PipelineStage, {
|
||||
// workspaceId,
|
||||
// });
|
||||
|
||||
// await queryRunner.manager.delete(WorkspaceMember, {
|
||||
// workspaceId,
|
||||
// });
|
||||
|
||||
// await queryRunner.manager.delete(Attachment, {
|
||||
// workspaceId,
|
||||
// });
|
||||
|
||||
// await queryRunner.manager.delete(Comment, {
|
||||
// workspaceId,
|
||||
// });
|
||||
|
||||
// await queryRunner.manager.delete(ActivityTarget, {
|
||||
// workspaceId,
|
||||
// });
|
||||
|
||||
// await queryRunner.manager.delete(Activity, {
|
||||
// workspaceId,
|
||||
// });
|
||||
|
||||
// await queryRunner.manager.delete(ApiKey, {
|
||||
// workspaceId,
|
||||
// });
|
||||
|
||||
// await queryRunner.manager.delete(Favorite, {
|
||||
// workspaceId,
|
||||
// });
|
||||
|
||||
// await queryRunner.manager.delete(WebHook, {
|
||||
// workspaceId,
|
||||
// });
|
||||
|
||||
// await queryRunner.manager.delete(WebHook, {
|
||||
// workspaceId,
|
||||
// });
|
||||
|
||||
// await queryRunner.manager.delete(Workspace, {
|
||||
// id: workspaceId,
|
||||
// });
|
||||
|
||||
// await queryRunner.commitTransaction();
|
||||
// } catch {
|
||||
// await queryRunner.rollbackTransaction();
|
||||
// } finally {
|
||||
// await queryRunner.release();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@ -3,10 +3,10 @@ import { Module } from '@nestjs/common';
|
||||
import { NestjsQueryGraphQLModule } from '@ptc-org/nestjs-query-graphql';
|
||||
import { NestjsQueryTypeOrmModule } from '@ptc-org/nestjs-query-typeorm';
|
||||
|
||||
import { TenantManagerModule } from 'src/tenant-manager/tenant-manager.module';
|
||||
import { WorkspaceResolver } from 'src/coreV2/workspace/workspace.resolver';
|
||||
import { FileModule } from 'src/core/file/file.module';
|
||||
import { AbilityModule } from 'src/ability/ability.module';
|
||||
import { WorkspaceManagerModule } from 'src/workspace/workspace-manager/workspace-manager.module';
|
||||
|
||||
import { Workspace } from './workspace.entity';
|
||||
import { workspaceAutoResolverOpts } from './workspace.auto-resolver-opts';
|
||||
@ -18,7 +18,7 @@ import { WorkspaceService } from './services/workspace.service';
|
||||
NestjsQueryGraphQLModule.forFeature({
|
||||
imports: [
|
||||
NestjsQueryTypeOrmModule.forFeature([Workspace]),
|
||||
TenantManagerModule,
|
||||
WorkspaceManagerModule,
|
||||
FileModule,
|
||||
AbilityModule,
|
||||
],
|
||||
|
||||
@ -81,21 +81,23 @@ export class WorkspaceManagerService {
|
||||
workspaceId: string,
|
||||
): Promise<ObjectMetadataEntity[]> {
|
||||
const createdObjectMetadata = await this.objectMetadataService.createMany(
|
||||
Object.values(standardObjectsMetadata).map((objectMetadata: any) => ({
|
||||
...objectMetadata,
|
||||
dataSourceId,
|
||||
workspaceId,
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
fields: [...basicFieldsMetadata, ...objectMetadata.fields].map(
|
||||
(field) => ({
|
||||
...field,
|
||||
workspaceId,
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
}),
|
||||
),
|
||||
})),
|
||||
Object.values(standardObjectsMetadata).map(
|
||||
(objectMetadata: ObjectMetadataEntity) => ({
|
||||
...objectMetadata,
|
||||
dataSourceId,
|
||||
workspaceId,
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
fields: [...basicFieldsMetadata, ...objectMetadata.fields].map(
|
||||
(field) => ({
|
||||
...field,
|
||||
workspaceId,
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
}),
|
||||
),
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
await this.relationMetadataService.createMany(
|
||||
|
||||
Reference in New Issue
Block a user