Skip to content

Commit

Permalink
Merge pull request #938 from multiversx/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
danielailie authored Mar 14, 2023
2 parents 7ab43e6 + 1eb4516 commit 55c68c1
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 81 deletions.
44 changes: 23 additions & 21 deletions src/modules/admins/flag-nft.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,26 +265,28 @@ export class FlagNftService {
}

private async setElasticNftFlagMapping(): Promise<void> {
await Locker.lock(
'setElasticNftFlagMapping',
async () => {
try {
await this.elasticUpdater.putMappings(
'tokens',
this.elasticUpdater.buildPutMultipleMappingsBody([
{
key: 'nft_nsfw_mark',
value: 'float',
},
]),
);
} catch (error) {
this.logger.error('Error when trying to map nsfw Elastic types', {
path: `$${FlagNftService.name}.${this.setElasticNftFlagMapping.name}`,
});
}
},
false,
);
if (process.env.ENABLE_ELASTIC_UPDATES === 'true') {
await Locker.lock(
'setElasticNftFlagMapping',
async () => {
try {
await this.elasticUpdater.putMappings(
'tokens',
this.elasticUpdater.buildPutMultipleMappingsBody([
{
key: 'nft_nsfw_mark',
value: 'float',
},
]),
);
} catch (error) {
this.logger.error('Error when trying to map nsfw Elastic types', {
path: `$${FlagNftService.name}.${this.setElasticNftFlagMapping.name}`,
});
}
},
false,
);
}
}
}
1 change: 0 additions & 1 deletion src/modules/auth/jwt.auth-guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export class JwtAuthenticateGuard implements CanActivate {
});
});
} catch (error) {
this.logger.warn(error);
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/modules/auth/native.auth-guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export class NativeAuthGuard implements CanActivate {
const userInfo = await this.authServer.validate(jwt);

if (
origin &&
origin !== userInfo.origin &&
origin !== 'https://' + userInfo.origin
) {
Expand All @@ -66,7 +67,6 @@ export class NativeAuthGuard implements CanActivate {

return true;
} catch (error: any) {
this.logger.warn(error);
return false;
}
}
Expand Down
118 changes: 60 additions & 58 deletions src/modules/nft-rarity/nft-rarity.elastic.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,66 +274,68 @@ export class NftRarityElasticService {
}

async setElasticRarityMappings(): Promise<void> {
await Locker.lock(
'setElasticRarityMappings',
async () => {
try {
await this.elasticService.putMappings(
'tokens',
this.elasticService.buildPutMultipleMappingsBody([
{
key: 'nft_rank_custom',
value: 'long',
},
{
key: 'nft_custom_ranks_hash',
value: 'text',
},
{
key: 'nft_score_openRarity',
value: 'float',
},
{
key: 'nft_rank_openRarity',
value: 'long',
},
{
key: 'nft_score_jaccardDistances',
value: 'float',
},
{
key: 'nft_rank_jaccardDistances',
value: 'long',
},
{
key: 'nft_score_trait',
value: 'float',
},
{
key: 'nft_rank_trait',
value: 'long',
},
{
key: 'nft_score_statistical',
value: 'float',
},
if (process.env.ENABLE_ELASTIC_UPDATES === 'true') {
await Locker.lock(
'setElasticRarityMappings',
async () => {
try {
await this.elasticService.putMappings(
'tokens',
this.elasticService.buildPutMultipleMappingsBody([
{
key: 'nft_rank_custom',
value: 'long',
},
{
key: 'nft_custom_ranks_hash',
value: 'text',
},
{
key: 'nft_score_openRarity',
value: 'float',
},
{
key: 'nft_rank_openRarity',
value: 'long',
},
{
key: 'nft_score_jaccardDistances',
value: 'float',
},
{
key: 'nft_rank_jaccardDistances',
value: 'long',
},
{
key: 'nft_score_trait',
value: 'float',
},
{
key: 'nft_rank_trait',
value: 'long',
},
{
key: 'nft_score_statistical',
value: 'float',
},
{
key: 'nft_rank_statistical',
value: 'long',
},
]),
);
} catch (error) {
this.logger.error(
'Error when trying to map Elastic types for rarity variables',
{
key: 'nft_rank_statistical',
value: 'long',
path: `${NftRarityElasticService.name}.${this.setElasticRarityMappings.name}`,
},
]),
);
} catch (error) {
this.logger.error(
'Error when trying to map Elastic types for rarity variables',
{
path: `${NftRarityElasticService.name}.${this.setElasticRarityMappings.name}`,
},
);
}
},
false,
);
);
}
},
false,
);
}
}

async getAllCollectionsFromElastic(): Promise<string[]> {
Expand Down

0 comments on commit 55c68c1

Please sign in to comment.