Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feat/send-notificatio…
Browse files Browse the repository at this point in the history
…n-permission
  • Loading branch information
Melisa Anabella Rossi committed May 7, 2024
2 parents 6f4842b + b656750 commit 59bb88e
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 11 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
},
"dependencies": {
"@aws-sdk/client-sns": "^3.501.0",
"@dcl/catalyst-api-specs": "^3.2.5",
"@dcl/catalyst-contracts": "^4.4.0",
"@dcl/catalyst-api-specs": "^3.2.6",
"@dcl/catalyst-contracts": "^4.4.1",
"@dcl/catalyst-storage": "^4.2.0",
"@dcl/crypto": "^3.4.5",
"@dcl/hashing": "^3.0.4",
Expand Down
24 changes: 24 additions & 0 deletions src/migrations/0014_permissions_set_addresses_lowercase.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Migration, MigratorComponents, PermissionType } from '../types'
import SQL from 'sql-template-strings'

export const migration: Migration = {
id: '0014_permissions_set_addresses_lowercase',
run: async (components: Pick<MigratorComponents, 'database' | 'nameOwnership' | 'storage' | 'worldsManager'>) => {
const worlds = await components.database.query('SELECT name, permissions FROM worlds ORDER BY name')

for (const world of worlds.rows) {
const permissions = world.permissions
for (const permissionType of Object.keys(permissions)) {
const permission = permissions[permissionType]
if (permission.type === PermissionType.AllowList) {
permission.wallets = permission.wallets.map((address: string) => address.toLowerCase())
}
}

await components.database.query(SQL`
UPDATE worlds
SET permissions = ${JSON.stringify(permissions)}::json
WHERE name = ${world.name}`)
}
}
}
4 changes: 3 additions & 1 deletion src/migrations/all-migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { migration as migration_0010 } from './0010_remove_world_metadata_files'
import { migration as migration_0011 } from './0011_add_size_and_owner_columns'
import { migration as migration_0012 } from './0012_store_world_owner_and_size'
import { migration as migration_0013 } from './0013_create_blocked_table'
import { migration as migration_0014 } from './0014_permissions_set_addresses_lowercase'

export const allMigrations: Migration[] = [
migration_0001,
Expand All @@ -26,5 +27,6 @@ export const allMigrations: Migration[] = [
migration_0010,
migration_0011,
migration_0012,
migration_0013
migration_0013,
migration_0014
]
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -743,17 +743,17 @@
resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==

"@dcl/catalyst-api-specs@^3.2.5":
version "3.2.5"
resolved "https://registry.npmjs.org/@dcl/catalyst-api-specs/-/catalyst-api-specs-3.2.5.tgz"
integrity sha512-x6zFbYLOpcwxm+LI20aa9EB+IuLF8QYxOx5D86XgZVVGvIjHlyUVpZrkE+C/VAtQsOK3Ry80jGu7G1n0BHXw9w==
"@dcl/catalyst-api-specs@^3.2.6":
version "3.2.6"
resolved "https://registry.yarnpkg.com/@dcl/catalyst-api-specs/-/catalyst-api-specs-3.2.6.tgz#1d0d7e7803b38ed3d1de0eef83394444a825bc33"
integrity sha512-bm8bfmIsZV3QqhY3tolxYm3ljA1vxhC+lRRQkwEnjZJiXHP0aeyvkCeVZp2ZmNTskXm29LDPGo3mcCGb/qiztA==
dependencies:
yaml "^2.3.4"

"@dcl/catalyst-contracts@^4.4.0":
version "4.4.0"
resolved "https://registry.npmjs.org/@dcl/catalyst-contracts/-/catalyst-contracts-4.4.0.tgz"
integrity sha512-jA4LU/f0VQI4epwctUZFIxnvnXBSsWGdoDibuV1kIW1nnooqRmCKdN2bbQKYWhWKtwjQfUHvbUKLzA+dD2a1gw==
"@dcl/catalyst-contracts@^4.4.0", "@dcl/catalyst-contracts@^4.4.1":
version "4.4.1"
resolved "https://registry.yarnpkg.com/@dcl/catalyst-contracts/-/catalyst-contracts-4.4.1.tgz#c05e45c1e58d8633b8e0260f00b6b6908517471a"
integrity sha512-auKNcpZUQV4u7BiL65TXGB0j+eLRVzvpE7oDd7ML0wyB4A8op9B1Ca+7JKZQLClrhj6nbyXoDT7JzFeSpkipoA==

"@dcl/catalyst-storage@^4.2.0":
version "4.2.0"
Expand Down

0 comments on commit 59bb88e

Please sign in to comment.