942d2fef83
# Introduction Followup of https://github.com/twentyhq/twenty/pull/17001#pullrequestreview-3638508738 close https://github.com/twentyhq/core-team-issues/issues/1910 We've completely decom the `sync-metadata` in production. We're now then removing its implementation in favor of the v2. ## TODO: - [x] Remove sync-metadata implem and commands - [x] Remove workspace decorators - [x] Type each deprecated field to deprecated on their workspaceEntity - [x] Remove the `workspace-sync-metadata` folder entirely - [x] remove workspace migration - [x] workspace migration removal migration - [x] remove the `v2` references from workspace manager file names - [x] remove the `v2` references from workspace manager modules - [ ] Double check impact on translation file path updates ## Note - Removed the gate logic - Remains some service v2 naming, serverless needs to be migrated on v2 fully - Removed workspaceMigration service app health consumption, making it always returning up ( no more down ) cc @FelixMalfait ( quite obsolete health check now, will require complete refactor once we introduce inter app dependency etc )
82 lines
3.2 KiB
TypeScript
82 lines
3.2 KiB
TypeScript
import { UseGuards, UseInterceptors } from '@nestjs/common';
|
|
import { Args, Mutation, Query, Resolver } from '@nestjs/graphql';
|
|
|
|
import { PermissionFlagType } from 'twenty-shared/constants';
|
|
|
|
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
|
import { WorkspaceEntity } from 'src/engine/core-modules/workspace/workspace.entity';
|
|
import { AuthWorkspace } from 'src/engine/decorators/auth/auth-workspace.decorator';
|
|
import { SettingsPermissionGuard } from 'src/engine/guards/settings-permission.guard';
|
|
import { WorkspaceAuthGuard } from 'src/engine/guards/workspace-auth.guard';
|
|
import { CreateSkillInput } from 'src/engine/metadata-modules/skill/dtos/create-skill.input';
|
|
import { SkillDTO } from 'src/engine/metadata-modules/skill/dtos/skill.dto';
|
|
import { UpdateSkillInput } from 'src/engine/metadata-modules/skill/dtos/update-skill.input';
|
|
import { SkillGraphqlApiExceptionInterceptor } from 'src/engine/metadata-modules/skill/interceptors/skill-graphql-api-exception.interceptor';
|
|
import { SkillService } from 'src/engine/metadata-modules/skill/skill.service';
|
|
import { WorkspaceMigrationBuilderGraphqlApiExceptionInterceptor } from 'src/engine/workspace-manager/workspace-migration/interceptors/workspace-migration-builder-graphql-api-exception.interceptor';
|
|
|
|
@UseGuards(WorkspaceAuthGuard, SettingsPermissionGuard(PermissionFlagType.AI))
|
|
@UseInterceptors(
|
|
WorkspaceMigrationBuilderGraphqlApiExceptionInterceptor,
|
|
SkillGraphqlApiExceptionInterceptor,
|
|
)
|
|
@Resolver(() => SkillDTO)
|
|
export class SkillResolver {
|
|
constructor(private readonly skillService: SkillService) {}
|
|
|
|
@Query(() => [SkillDTO])
|
|
async skills(
|
|
@AuthWorkspace() workspace: WorkspaceEntity,
|
|
): Promise<SkillDTO[]> {
|
|
return this.skillService.findAll(workspace.id);
|
|
}
|
|
|
|
@Query(() => SkillDTO, { nullable: true })
|
|
async skill(
|
|
@Args('id', { type: () => UUIDScalarType }) id: string,
|
|
@AuthWorkspace() workspace: WorkspaceEntity,
|
|
): Promise<SkillDTO | null> {
|
|
return this.skillService.findById(id, workspace.id);
|
|
}
|
|
|
|
@Mutation(() => SkillDTO)
|
|
async createSkill(
|
|
@Args('input') input: CreateSkillInput,
|
|
@AuthWorkspace() workspace: WorkspaceEntity,
|
|
): Promise<SkillDTO> {
|
|
return this.skillService.create(input, workspace.id);
|
|
}
|
|
|
|
@Mutation(() => SkillDTO)
|
|
async updateSkill(
|
|
@Args('input') input: UpdateSkillInput,
|
|
@AuthWorkspace() workspace: WorkspaceEntity,
|
|
): Promise<SkillDTO> {
|
|
return this.skillService.update(input, workspace.id);
|
|
}
|
|
|
|
@Mutation(() => SkillDTO)
|
|
async deleteSkill(
|
|
@Args('id', { type: () => UUIDScalarType }) id: string,
|
|
@AuthWorkspace() workspace: WorkspaceEntity,
|
|
): Promise<SkillDTO> {
|
|
return this.skillService.delete(id, workspace.id);
|
|
}
|
|
|
|
@Mutation(() => SkillDTO)
|
|
async activateSkill(
|
|
@Args('id', { type: () => UUIDScalarType }) id: string,
|
|
@AuthWorkspace() workspace: WorkspaceEntity,
|
|
): Promise<SkillDTO> {
|
|
return this.skillService.activate(id, workspace.id);
|
|
}
|
|
|
|
@Mutation(() => SkillDTO)
|
|
async deactivateSkill(
|
|
@Args('id', { type: () => UUIDScalarType }) id: string,
|
|
@AuthWorkspace() workspace: WorkspaceEntity,
|
|
): Promise<SkillDTO> {
|
|
return this.skillService.deactivate(id, workspace.id);
|
|
}
|
|
}
|