From b42bd2adb26a154da3b9fab65dc23c4e63d2bea6 Mon Sep 17 00:00:00 2001 From: Thomas Dax Date: Thu, 2 Jan 2025 17:01:58 +0100 Subject: [PATCH] Harmonize usage of uuid --- .../api/cms-api/src/dependencies/dependencies.service.ts | 8 ++++---- .../user-permissions/entities/user-permission.entity.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/api/cms-api/src/dependencies/dependencies.service.ts b/packages/api/cms-api/src/dependencies/dependencies.service.ts index 3c0854ae9f..cc41df6b47 100644 --- a/packages/api/cms-api/src/dependencies/dependencies.service.ts +++ b/packages/api/cms-api/src/dependencies/dependencies.service.ts @@ -5,7 +5,7 @@ import { Injectable, Logger, Type } from "@nestjs/common"; import { INJECTABLE_WATERMARK } from "@nestjs/common/constants"; import { ModuleRef } from "@nestjs/core"; import { subMinutes } from "date-fns"; -import { v4 } from "uuid"; +import { v4 as uuid } from "uuid"; import { EntityInfoGetter, EntityInfoServiceInterface } from "./decorators/entity-info.decorator"; import { DiscoverService } from "./discover.service"; @@ -95,18 +95,18 @@ export class DependenciesService { async refreshViews(options?: { force?: boolean; awaitRefresh?: boolean }): Promise { const refresh = async (options?: { concurrently: boolean }) => { - const uuid = v4(); + const id = uuid(); // Before forking the entity manager, race conditions occurred frequently // when executing the refresh asynchronous const forkedEntityManager = this.entityManager.fork(); - console.time(`refresh materialized block dependency ${uuid}`); + console.time(`refresh materialized block dependency ${id}`); const blockIndexRefresh = this.refreshRepository.create({ startedAt: new Date() }); await forkedEntityManager.persistAndFlush(blockIndexRefresh); await forkedEntityManager.execute(`REFRESH MATERIALIZED VIEW ${options?.concurrently ? "CONCURRENTLY" : ""} block_index_dependencies`); await forkedEntityManager.persistAndFlush(Object.assign(blockIndexRefresh, { finishedAt: subMinutes(new Date(), 5) })); - console.timeEnd(`refresh materialized block dependency ${uuid}`); + console.timeEnd(`refresh materialized block dependency ${id}`); }; const abortActiveRefreshes = async (activeRefreshes: PGStatActivity[]) => { diff --git a/packages/api/cms-api/src/user-permissions/entities/user-permission.entity.ts b/packages/api/cms-api/src/user-permissions/entities/user-permission.entity.ts index 138becba66..66c9faad83 100644 --- a/packages/api/cms-api/src/user-permissions/entities/user-permission.entity.ts +++ b/packages/api/cms-api/src/user-permissions/entities/user-permission.entity.ts @@ -1,7 +1,7 @@ import { BaseEntity, Entity, PrimaryKey, Property } from "@mikro-orm/core"; import { Field, ID, ObjectType, registerEnumType } from "@nestjs/graphql"; import { GraphQLJSONObject } from "graphql-scalars"; -import { v4 } from "uuid"; +import { v4 as uuid } from "uuid"; import { ContentScope } from "../interfaces/content-scope.interface"; @@ -18,7 +18,7 @@ registerEnumType(UserPermissionSource, { export class UserPermission extends BaseEntity { @Field(() => ID) @PrimaryKey({ type: "uuid" }) - id: string = v4(); + id: string = uuid(); @Property() userId: string;