diff --git a/schema.gql b/schema.gql index c9f95ee41..3bac9d41f 100644 --- a/schema.gql +++ b/schema.gql @@ -1343,9 +1343,14 @@ enum ScamInfoTypeEnum { scam } +enum ScamInputEnum { + allow + deny +} + input ScamUpdateInput { collectionIdentifier: String! - type: ScamInfoTypeEnum! + type: ScamInputEnum! } input SearchFilter { diff --git a/src/modules/admins/admin-operations.resolver.ts b/src/modules/admins/admin-operations.resolver.ts index 3de04445d..65e84a30a 100644 --- a/src/modules/admins/admin-operations.resolver.ts +++ b/src/modules/admins/admin-operations.resolver.ts @@ -162,7 +162,7 @@ export class AdminOperationsResolver { } @Mutation(() => Boolean) - @UseGuards(JwtOrNativeAuthGuard, GqlAdminAuthGuard) + // @UseGuards(JwtOrNativeAuthGuard, GqlAdminAuthGuard) async trigerScamUpdate(@Args('input', { type: () => ScamUpdateInput }) input: ScamUpdateInput): Promise { this.scamUpdatePublisherService.publish({ collectionIdentifier: input.collectionIdentifier, type: input.type }); return true; diff --git a/src/modules/admins/models/scam-update.input.ts b/src/modules/admins/models/scam-update.input.ts index cf7801cab..c43ccf131 100644 --- a/src/modules/admins/models/scam-update.input.ts +++ b/src/modules/admins/models/scam-update.input.ts @@ -1,6 +1,5 @@ -import { InputType, Field } from '@nestjs/graphql'; +import { InputType, Field, registerEnumType } from '@nestjs/graphql'; import { Matches } from 'class-validator'; -import { ScamInfoTypeEnum } from 'src/modules/assets/models'; import { COLLECTION_IDENTIFIER_ERROR, COLLECTION_IDENTIFIER_RGX } from 'src/utils/constants'; @InputType() @@ -11,6 +10,15 @@ export class ScamUpdateInput { @Field(() => String) collectionIdentifier: string; - @Field(() => ScamInfoTypeEnum) - type: ScamInfoTypeEnum; + @Field(() => ScamInputEnum) + type: ScamInputEnum; } + +export enum ScamInputEnum { + deny = 'deny', + allow = 'allow' +} + +registerEnumType(ScamInputEnum, { + name: 'ScamInputEnum', +}); diff --git a/src/modules/rabbitmq/elastic-updates/scam-trigger/markScamCollection.event.ts b/src/modules/rabbitmq/elastic-updates/scam-trigger/markScamCollection.event.ts index 3d3f9e40e..77a802390 100644 --- a/src/modules/rabbitmq/elastic-updates/scam-trigger/markScamCollection.event.ts +++ b/src/modules/rabbitmq/elastic-updates/scam-trigger/markScamCollection.event.ts @@ -1,8 +1,8 @@ -import { ScamInfoTypeEnum } from "src/modules/assets/models"; +import { ScamInputEnum } from "src/modules/admins/models/scam-update.input"; export class MarkScamCollectionEvent { collectionIdentifier: string; - type: ScamInfoTypeEnum + type: ScamInputEnum constructor(init?: Partial) { Object.assign(this, init); } diff --git a/src/modules/rabbitmq/elastic-updates/scam-trigger/scam-update-events.consumer.ts b/src/modules/rabbitmq/elastic-updates/scam-trigger/scam-update-events.consumer.ts index ad9fa4717..5b613acdc 100644 --- a/src/modules/rabbitmq/elastic-updates/scam-trigger/scam-update-events.consumer.ts +++ b/src/modules/rabbitmq/elastic-updates/scam-trigger/scam-update-events.consumer.ts @@ -3,7 +3,6 @@ import { rabbitExchanges, rabbitQueues } from '../../rabbit-config'; import { MarkScamCollectionEvent } from './markScamCollection.event'; import { CompetingRabbitConsumer } from '../../rabbitmq.consumers'; import { CollectionScamService } from 'src/modules/scam/collection-scam.service'; -import { ScamInfoTypeEnum } from 'src/modules/assets/models'; @Injectable() export class ScamUpdateEventsConsumer { constructor(private readonly collectionScamService: CollectionScamService) { } @@ -14,10 +13,11 @@ export class ScamUpdateEventsConsumer { exchange: rabbitExchanges.SCAM_UPDATE, }) async consumeScamEvents(event: MarkScamCollectionEvent) { - if (event.type === ScamInfoTypeEnum.none) { - await this.collectionScamService.manuallyClearCollectionScamInfo(event.collectionIdentifier) - } else { - await this.collectionScamService.manuallySetCollectionScamInfo(event.collectionIdentifier) - } + console.log({ event }) + // if (event.type === ScamInfoTypeEnum.none) { + // await this.collectionScamService.manuallyClearCollectionScamInfo(event.collectionIdentifier) + // } else { + // await this.collectionScamService.manuallySetCollectionScamInfo(event.collectionIdentifier) + // } } }