diff --git a/.env b/.env index f142c3cd..1b0cc280 100644 --- a/.env +++ b/.env @@ -84,7 +84,7 @@ BEEHIIV_API_KEY=none ANALYTICS_ALLOWED_ORIGINS='["http://127.0.0.1:3000", "http://localhost:3000", "https://modrinth.com", "https://www.modrinth.com", "*"]' -CLICKHOUSE_URL=http:/localhost:8123 +CLICKHOUSE_URL=http://localhost:8123 CLICKHOUSE_USER=default CLICKHOUSE_PASSWORD= CLICKHOUSE_DATABASE=staging_ariadne diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index c7955faa..454d8e6c 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -2,7 +2,7 @@ blank_issues_enabled: true contact_links: - name: Discord about: Ask questions on our Discord Server. - url: https://discord.gg/modrinth-734077874708938864 + url: https://discord.modrinth.com - name: Roadmap about: View our Roadmap. Please do not open issues for items on our roadmap. url: https://roadmap.modrinth.com diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3757ded0..93e6a72d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,6 +4,8 @@ on: push: branches: [master] pull_request: + branches: + - master env: CARGO_TERM_COLOR: always @@ -21,23 +23,34 @@ jobs: steps: - uses: actions/checkout@v2 + + # Start Docker Compose + - name: Start Docker Compose + run: docker-compose up -d + - uses: actions-rs/toolchain@v1 name: Install toolchain with: profile: minimal toolchain: ${{ matrix.rust }} override: true - - name: Cache build artifacts - id: cache-build + + # Cache dependencies and build artifacts + - name: Cache build artifacts and dependencies uses: actions/cache@v2 with: - path: target/** - key: ${{ runner.os }}-build-cache-${{ matrix.rust }} + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - uses: actions-rs/cargo@v1 with: command: build env: SQLX_OFFLINE: true + - uses: actions-rs/cargo@v1 with: command: test @@ -50,4 +63,5 @@ jobs: S3_URL: ${{ secrets.S3_URL }} S3_REGION: ${{ secrets.S3_REGION }} S3_BUCKET_NAME: ${{ secrets.S3_BUCKET_NAME }} - SQLX_OFFLINE: true \ No newline at end of file + SQLX_OFFLINE: true + DATABASE_URL: postgresql://labrinth:labrinth@localhost/postgres diff --git a/Cargo.lock b/Cargo.lock index b1eaad62..a11a10c3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -83,9 +83,9 @@ dependencies = [ [[package]] name = "actix-http" -version = "3.3.1" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2079246596c18b4a33e274ae10c0e50613f4d32a4198e09c7b93771013fed74" +checksum = "a92ef85799cba03f76e4f7c10f533e66d87c9a7e7055f3391f09000ad8351bc9" dependencies = [ "actix-codec", "actix-rt", @@ -93,7 +93,7 @@ dependencies = [ "actix-utils", "ahash 0.8.3", "base64 0.21.2", - "bitflags 1.3.2", + "bitflags 2.4.0", "brotli", "bytes", "bytestring", @@ -284,6 +284,19 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "actix-web-prom" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f23f332a652836b8f3a6876103c70c9ed436d0e69fa779ab5d7f57b1d5c8d488" +dependencies = [ + "actix-web", + "futures-core", + "pin-project-lite", + "prometheus", + "regex", +] + [[package]] name = "actix-ws" version = "0.2.5" @@ -2233,9 +2246,11 @@ dependencies = [ "actix", "actix-cors", "actix-files", + "actix-http", "actix-multipart", "actix-rt", "actix-web", + "actix-web-prom", "actix-ws", "argon2", "async-trait", @@ -3141,6 +3156,20 @@ dependencies = [ "rustc_version 0.2.3", ] +[[package]] +name = "prometheus" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "449811d15fbdf5ceb5c1144416066429cf82316e2ec8ce0c1f6f8a02e7bbcf8c" +dependencies = [ + "cfg-if 1.0.0", + "fnv", + "lazy_static", + "memchr", + "parking_lot 0.12.1", + "thiserror", +] + [[package]] name = "ptr_meta" version = "0.1.4" diff --git a/Cargo.toml b/Cargo.toml index d413c6b6..f74a0a02 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,6 +18,7 @@ actix-multipart = "0.6.0" actix-cors = "0.6.4" actix-ws = "0.2.5" actix-files = "0.6.2" +actix-web-prom = "0.7.0" tokio = { version = "1.29.1", features = ["sync"] } tokio-stream = "0.1.14" @@ -37,7 +38,7 @@ hyper-tls = "0.5.0" serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } serde_with = "3.0.0" -chrono = { version = "0.4.26", features = ["serde"]} +chrono = { version = "0.4.26", features = ["serde"] } yaserde = "0.8.0" yaserde_derive = "0.8.0" xml-rs = "0.8.15" @@ -72,9 +73,21 @@ log = "0.4.19" env_logger = "0.10.0" thiserror = "1.0.41" -sqlx = { version = "0.6.3", features = ["offline", "runtime-tokio-rustls", "postgres", "chrono", "macros", "migrate", "decimal", "json"] } -rust_decimal = { version = "1.30.0", features = ["serde-with-float", "serde-with-str"] } -redis = { version = "0.23.0", features = ["tokio-comp", "ahash", "r2d2"]} +sqlx = { version = "0.6.3", features = [ + "offline", + "runtime-tokio-rustls", + "postgres", + "chrono", + "macros", + "migrate", + "decimal", + "json", +] } +rust_decimal = { version = "1.30.0", features = [ + "serde-with-float", + "serde-with-str", +] } +redis = { version = "0.23.0", features = ["tokio-comp", "ahash", "r2d2"] } deadpool-redis = "0.12.0" clickhouse = { version = "0.11.2", features = ["uuid", "time"] } uuid = { version = "1.2.2", features = ["v4", "fast-rng", "serde"] } @@ -91,4 +104,7 @@ color-thief = "0.2.2" woothee = "0.13.0" -lettre = "0.10.4" \ No newline at end of file +lettre = "0.10.4" + +[dev-dependencies] +actix-http = "3.4.0" diff --git a/migrations/20230816085700_collections_and_more.sql b/migrations/20230816085700_collections_and_more.sql new file mode 100644 index 00000000..81efecda --- /dev/null +++ b/migrations/20230816085700_collections_and_more.sql @@ -0,0 +1,37 @@ +CREATE TABLE collections ( + id bigint PRIMARY KEY, + title varchar(255) NOT NULL, + description varchar(2048) NOT NULL, + user_id bigint REFERENCES users NOT NULL, + created timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, + + status varchar(64) NOT NULL DEFAULT 'listed', + + icon_url varchar(2048) NULL, + color integer NULL +); + +CREATE TABLE collections_mods ( + collection_id bigint REFERENCES collections NOT NULL, + mod_id bigint REFERENCES mods NOT NULL, + PRIMARY KEY (collection_id, mod_id) +); + +CREATE TABLE uploaded_images ( + id bigint PRIMARY KEY, + url varchar(2048) NOT NULL, + size integer NOT NULL, + created timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, + owner_id bigint REFERENCES users NOT NULL, + + -- Type of contextual association + context varchar(64) NOT NULL, -- project, version, thread_message, report, etc. + + -- Only one of these should be set (based on 'context') + mod_id bigint NULL REFERENCES mods, + version_id bigint NULL REFERENCES versions, + thread_message_id bigint NULL REFERENCES threads_messages, + report_id bigint NULL REFERENCES reports + +); \ No newline at end of file diff --git a/migrations/20230913024611_organizations.sql b/migrations/20230913024611_organizations.sql new file mode 100644 index 00000000..b6e7ae9c --- /dev/null +++ b/migrations/20230913024611_organizations.sql @@ -0,0 +1,17 @@ +CREATE TABLE organizations ( + id bigint PRIMARY KEY, + title varchar(255) NOT NULL, -- also slug + description text NOT NULL, + created_at timestamp NOT NULL DEFAULT now(), + updated_at timestamp NOT NULL DEFAULT now(), + team_id bigint NOT NULL REFERENCES teams(id) ON UPDATE CASCADE, + + icon_url varchar(255) NULL, + color integer NULL +); + +ALTER TABLE mods ADD COLUMN organization_id bigint NULL REFERENCES organizations(id) ON DELETE SET NULL; + +-- Organization permissions only apply to teams that are associated to an organization +-- If they do, 'permissions' is considered the fallback permissions for projects in the organization +ALTER TABLE team_members ADD COLUMN organization_permissions bigint NULL; diff --git a/sqlx-data.json b/sqlx-data.json index 99570f9c..e69de29b 100644 --- a/sqlx-data.json +++ b/sqlx-data.json @@ -1,6195 +0,0 @@ -{ - "db": "PostgreSQL", - "010cafcafb6adc25b00e3c81d844736b0245e752a90334c58209d8a02536c800": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET moderation_message = NULL, moderation_message_body = NULL, queued = NOW()\n WHERE (id = $1)\n " - }, - "02843e787de72594e186a14734bd02099ca6d2f07dcc06da8d6d8a069638ca2a": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "mod_id", - "ordinal": 1, - "type_info": "Int8" - } - ], - "nullable": [ - false, - false - ], - "parameters": { - "Left": [ - "Text", - "Int8", - "Int8" - ] - } - }, - "query": "\n SELECT id, mod_id FROM versions\n WHERE ((version_number = $1 OR id = $3) AND mod_id = $2)\n " - }, - "03006da8781d9c07d564c6b406221cb0557623abe3242e79a21868482e6d9898": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Timestamptz", - "Int8" - ] - } - }, - "query": "\n UPDATE versions\n SET status = $1, date_published = $2\n WHERE (id = $3)\n " - }, - "04128dd06489004e0d0305bfd0f4ca5ee4b4a6b9f610de6e1b9ef9c8543cc025": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "SELECT id FROM users WHERE trolley_id = $1" - }, - "04345d9c23430267f755b1420520df91bd403524fd60ba1a94e3a239ea70cae7": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET source_url = $1\n WHERE (id = $2)\n " - }, - "0472045549758d8eef84592908c438d6222a26926f4b06865b84979fc92564ba": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Timestamptz" - ] - } - }, - "query": "\n UPDATE pats\n SET last_used = $2\n WHERE (id = $1)\n " - }, - "04e5ecb14c526000e9098efb65861f6125e6fcc88f39d6ad811ac8504d229de1": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET icon_url = NULL, color = NULL\n WHERE (id = $1)\n " - }, - "05baeb26d9856218e5c6f8856a96788b2a7ac3536ff9412a50552cef1d561a1e": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int4" - ] - } - }, - "query": "\n INSERT INTO mods_categories (joining_mod_id, joining_category_id, is_additional)\n VALUES ($1, $2, FALSE)\n " - }, - "06a92b638c77276f36185788748191e7731a2cce874ecca4af913d0d0412d223": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int4", - "Int8" - ] - } - }, - "query": "\n UPDATE versions\n SET downloads = $1\n WHERE (id = $2)\n " - }, - "07ebc9dc82cd012cd4f5880b1eb3d82602c195a3e3ddd557103ee037aa6dad1c": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int4", - "Varchar" - ] - } - }, - "query": "\n INSERT INTO mods_donations (joining_mod_id, joining_platform_id, url)\n VALUES ($1, $2, $3)\n " - }, - "08baa3d4e15821d791a1981a6abf653991dcc0901cea49156cd202d10ed2968c": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT id FROM users WHERE github_id = $1" - }, - "08f6bc80d18c171e54dd1db90e15569a02b526d708a9c918c90d79c764cb02fa": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int4" - }, - { - "name": "category", - "ordinal": 1, - "type_info": "Varchar" - }, - { - "name": "icon", - "ordinal": 2, - "type_info": "Varchar" - }, - { - "name": "category_header", - "ordinal": 3, - "type_info": "Varchar" - }, - { - "name": "project_type", - "ordinal": 4, - "type_info": "Varchar" - } - ], - "nullable": [ - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [] - } - }, - "query": "\n SELECT c.id id, c.category category, c.icon icon, c.header category_header, pt.name project_type\n FROM categories c\n INNER JOIN project_types pt ON c.project_type = pt.id\n ORDER BY c.ordering, c.category\n " - }, - "09f4fba5c0c26457a7415a2196d4f5a9b2c72662b92cae8c96dda9557a024df7": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE users\n SET email = $1, email_verified = FALSE\n WHERE (id = $2)\n " - }, - "0a1a470c12b84c7e171f0f51e8e541e9abe8bbee17fc441a5054e1dfd5607c05": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE versions\n SET name = $1\n WHERE (id = $2)\n " - }, - "0b79ae3825e05ae07058a0a9d02fb0bd68ce37f3c7cf0356d565c23520988816": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "version_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "mod_id", - "ordinal": 2, - "type_info": "Int8" - }, - { - "name": "url", - "ordinal": 3, - "type_info": "Varchar" - }, - { - "name": "filename", - "ordinal": 4, - "type_info": "Varchar" - }, - { - "name": "is_primary", - "ordinal": 5, - "type_info": "Bool" - }, - { - "name": "size", - "ordinal": 6, - "type_info": "Int4" - }, - { - "name": "file_type", - "ordinal": 7, - "type_info": "Varchar" - }, - { - "name": "hashes", - "ordinal": 8, - "type_info": "Jsonb" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - true, - null - ], - "parameters": { - "Left": [ - "Text", - "ByteaArray" - ] - } - }, - "query": "\n SELECT f.id, f.version_id, v.mod_id, f.url, f.filename, f.is_primary, f.size, f.file_type,\n JSONB_AGG(DISTINCT jsonb_build_object('algorithm', h.algorithm, 'hash', encode(h.hash, 'escape'))) filter (where h.hash is not null) hashes\n FROM files f\n INNER JOIN versions v on v.id = f.version_id\n INNER JOIN hashes h on h.file_id = f.id\n WHERE h.algorithm = $1 AND h.hash = ANY($2)\n GROUP BY f.id, v.mod_id, v.date_published\n ORDER BY v.date_published\n " - }, - "0ba5a9f4d1381ed37a67b7dc90edf7e3ec86cae6c2860e5db1e53144d4654e58": { - "describe": { - "columns": [ - { - "name": "amount", - "ordinal": 0, - "type_info": "Numeric" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n SELECT SUM(pv.amount) amount\n FROM payouts_values pv\n WHERE pv.user_id = $1\n " - }, - "0c2addb0d7a87fa558821ff8e943bbb751fb2bdc22d1a5368f61cc7827586840": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8", - "Varchar", - "Varchar", - "Bool", - "Int4", - "Varchar" - ] - } - }, - "query": "\n INSERT INTO files (id, version_id, url, filename, is_primary, size, file_type)\n VALUES ($1, $2, $3, $4, $5, $6, $7)\n " - }, - "0d91a3a73844f46ef00d8d45a0d028f1c4c1da016044f63f21d96707eafec858": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "team_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "member_role", - "ordinal": 2, - "type_info": "Varchar" - }, - { - "name": "permissions", - "ordinal": 3, - "type_info": "Int8" - }, - { - "name": "accepted", - "ordinal": 4, - "type_info": "Bool" - }, - { - "name": "payouts_split", - "ordinal": 5, - "type_info": "Numeric" - }, - { - "name": "ordering", - "ordinal": 6, - "type_info": "Int8" - }, - { - "name": "user_id", - "ordinal": 7, - "type_info": "Int8" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Int8Array" - ] - } - }, - "query": "\n SELECT tm.id id, tm.team_id team_id, tm.role member_role, tm.permissions permissions, tm.accepted accepted, tm.payouts_split payouts_split, tm.ordering,\n tm.user_id user_id\n FROM team_members tm\n WHERE tm.team_id = ANY($1)\n ORDER BY tm.team_id, tm.ordering\n " - }, - "0f29bb5ba767ebd0669c860994e48e3cb2674f0d53f6c4ab85c79d46b04cbb40": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n SELECT EXISTS(SELECT 1 FROM mods WHERE id=$1)\n " - }, - "0fb1cca8a2a37107104244953371fe2f8a5e6edd57f4b325c5842c6571eb16b4": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "\n SELECT EXISTS(SELECT 1 FROM mod_follows mf WHERE mf.follower_id = $1 AND mf.mod_id = $2)\n " - }, - "1209ffc1ffbea89f7060573275dc7325ac4d7b4885b6c1d1ec92998e6012e455": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int4", - "Varchar" - ] - } - }, - "query": "\n UPDATE mods_gallery\n SET description = $2\n WHERE id = $1\n " - }, - "1220d15a56dbf823eaa452fbafa17442ab0568bc81a31fa38e16e3df3278e5f9": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT EXISTS(SELECT 1 FROM users WHERE id = $1)" - }, - "124fbf0544ea6989d6dc5e840405dbc76d7385276a38ad79d9093c53c73bbde2": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET webhook_sent = TRUE\n WHERE id = $1\n " - }, - "127691940ca7e542e246dd2a1c9cb391041b30ddf0547d73b49c1dd9dc59d2ae": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8Array" - ] - } - }, - "query": "\n UPDATE notifications\n SET read = TRUE\n WHERE id = ANY($1)\n " - }, - "16049957962ded08751d5a4ddce2ffac17ecd486f61210c51a952508425d83e6": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE versions\n SET changelog = $1\n WHERE (id = $2)\n " - }, - "164e5168aabe47d64f99ea851392c9d8479022cff360a610f185c342a24e88d8": { - "describe": { - "columns": [ - { - "name": "mod_id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n SELECT mod_id FROM versions WHERE id = $1\n " - }, - "165a4e679a0063dbf20832f298b4af3bb350f2e7128b0a91d6c1b8a25e56b0f6": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "SELECT EXISTS(SELECT 1 FROM reports WHERE id = $1 AND reporter = $2)" - }, - "166d93a7d4ac629444eadcd51d793490220bbf1e503bf85ec97b37500c8f74aa": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM sessions WHERE id = $1\n " - }, - "177716d2b04fd2a2b63b2e14c8ffdfa554d84254b14053496c118dec24bf5049": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "TextArray" - ] - } - }, - "query": "\n UPDATE mods\n SET game_versions = (\n SELECT COALESCE(ARRAY_AGG(DISTINCT gv.version) filter (where gv.version is not null), array[]::varchar[])\n FROM versions v\n INNER JOIN game_versions_versions gvv ON v.id = gvv.joining_version_id\n INNER JOIN game_versions gv on gvv.game_version_id = gv.id\n WHERE v.mod_id = mods.id AND v.status != ALL($2)\n )\n WHERE id = $1\n " - }, - "1931ff3846345c0af4e15c3a84dcbfc7c9cbb92c98d2e73634f611a1e5358c7a": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT EXISTS(SELECT 1 FROM threads WHERE id=$1)" - }, - "196c8ac2228e199f23eaf980f7ea15b37f76e66bb81da1115a754aad0be756e4": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8", - "Numeric", - "Timestamptz" - ] - } - }, - "query": "\n INSERT INTO payouts_values (user_id, mod_id, amount, created)\n VALUES ($1, $2, $3, $4)\n " - }, - "19dc22c4d6d14222f8e8bace74c2961761c53b7375460ade15af921754d5d7da": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET license = $1\n WHERE (id = $2)\n " - }, - "1ab781d26c93aa74bf90b78b74b99e50004d25d42d56b734e5e83f2333d0c0d2": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE users\n SET avatar_url = $1\n WHERE (id = $2)\n " - }, - "1cefe4924d3c1f491739858ce844a22903d2dbe26f255219299f1833a10ce3d7": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8", - "TextArray" - ] - } - }, - "query": "\n SELECT id FROM mods TABLESAMPLE SYSTEM_ROWS($1) WHERE status = ANY($2)\n " - }, - "1d6f3e926fc4a27c5af172f672b7f825f9f5fe2d538b06337ef182ab1a553398": { - "describe": { - "columns": [ - { - "name": "name", - "ordinal": 0, - "type_info": "Varchar" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n SELECT name FROM project_types pt\n INNER JOIN mods ON mods.project_type = pt.id\n WHERE mods.id = $1\n " - }, - "1db6be78a74ff04c52ee105e0df30acf5bbf18f1de328980bb7f3da7f5f6569e": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int4" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "\n SELECT id FROM side_types\n WHERE name = $1\n " - }, - "1ffce9b2d5c9fa6c8b9abce4bad9f9419c44ad6367b7463b979c91b9b5b4fea1": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT EXISTS(SELECT 1 FROM versions WHERE id=$1)" - }, - "2007ac2b16a1d3d8fd053d962ba8548613535255fa197059e86959adf372948d": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Jsonb" - ] - } - }, - "query": "\n UPDATE threads_messages\n SET body = $2\n WHERE id = $1\n " - }, - "21d20e5f09cb0729dc16c8609c35cec5a913f3172b53b8ae05da0096a33b4b64": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n SELECT id\n FROM pats\n WHERE user_id = $1\n ORDER BY created DESC\n " - }, - "21ef50f46b7b3e62b91e7d067c1cb33806e14c33bb76d63c2711f822c44261f6": { - "describe": { - "columns": [ - { - "name": "name", - "ordinal": 0, - "type_info": "Varchar" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n SELECT name FROM project_types pt\n INNER JOIN mods ON mods.project_type = pt.id\n WHERE mods.id = $1\n " - }, - "220e59ae72edef546e3c7682ae91336bfba3e4230add1543910d80e846e0ad95": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n SELECT m.id FROM mods m\n INNER JOIN team_members tm ON tm.team_id = m.team_id AND tm.accepted = TRUE\n WHERE tm.user_id = $1\n ORDER BY m.downloads DESC\n " - }, - "2265be690ec4c6b03fd142bb8b81a5ebec67d09a08c05e9dba122f5acf2fc98a": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Timestamptz" - ] - } - }, - "query": "SELECT EXISTS(SELECT 1 FROM payouts_values WHERE created = $1)" - }, - "232d7d0319c20dd5fff29331b067d6c6373bcff761a77958a2bb5f59068a83a5": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8", - "Int8" - ] - } - }, - "query": "\n UPDATE team_members\n SET permissions = $1\n WHERE (team_id = $2 AND user_id = $3)\n " - }, - "25131559cb73a088000ab6379a769233440ade6c7511542da410065190d203fc": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int4" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "\n SELECT id FROM loaders\n WHERE loader = $1\n " - }, - "294f264382ad55475b51776cd5d306c4867e8e6966ab79921bba69dc023f8337": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM threads_members\n WHERE thread_id = $1\n " - }, - "299b8ea6e7a0048fa389cc4432715dc2a09e227d2f08e91167a43372a7ac6e35": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM mods_categories\n WHERE joining_mod_id = $1 AND is_additional = FALSE\n " - }, - "29e171bd746ac5dc1fabae4c9f81c3d1df4e69c860b7d0f6a907377664199217": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n SELECT id FROM reports\n WHERE closed = FALSE\n ORDER BY created ASC\n LIMIT $1;\n " - }, - "29e657d26f0fb24a766f5b5eb6a94d01d1616884d8ca10e91536e974d5b585a6": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int4", - "Int8" - ] - } - }, - "query": "\n INSERT INTO loaders_versions (loader_id, version_id)\n VALUES ($1, $2)\n " - }, - "29fcff0f1d36bd1a9e0c8c4005209308f0c5f383e4e52ed8c6b989994ead32df": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8", - "Int8" - ] - } - }, - "query": "\n UPDATE team_members\n SET ordering = $1\n WHERE (team_id = $2 AND user_id = $3)\n " - }, - "2b8dafe9c3df9fd25235a13868e8e7607decfbe96a413cc576919a1fb510f269": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET discord_url = $1\n WHERE (id = $2)\n " - }, - "2bfde0471537cbdadd768006ff616e7513703971f9d60211106933d3eb759ad2": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM team_members\n WHERE user_id = $1\n " - }, - "2d460f25461e95c744c835af5d67f8a7dd2438a46e3033611dfc0edd74fb9180": { - "describe": { - "columns": [ - { - "name": "count", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "TextArray", - "TextArray" - ] - } - }, - "query": "\n SELECT COUNT(v.id)\n FROM versions v\n INNER JOIN mods m on v.mod_id = m.id AND m.status = ANY($1)\n WHERE v.status = ANY($2)\n " - }, - "2d68489b978c7a19bbea6a9736d23ca253f4038c0e3e060720d669825073b242": { - "describe": { - "columns": [ - { - "name": "code", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n SELECT code FROM user_backup_codes\n WHERE user_id = $1\n " - }, - "2df7a4dd792736be89c9da00c039ad7e271f79f4c756daac79ce5622ccb50db2": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Varchar" - ] - } - }, - "query": "\n UPDATE users\n SET google_id = $2\n WHERE (id = $1)\n " - }, - "2e14706127d9822d5a0d7ada02425d224805637d03eda1343e12111f7deba443": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM mods_categories\n WHERE joining_mod_id = $1\n " - }, - "2e5ddc7876d8041fec781893027f84b49b5794c85fa442296c35156d0a72464a": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Varchar", - "Varchar", - "Varchar", - "Varchar", - "Varchar", - "Timestamptz", - "Int8", - "Int8", - "Int8", - "Varchar", - "Int8", - "Varchar", - "Bool", - "Text" - ] - } - }, - "query": "\n INSERT INTO users (\n id, username, name, email,\n avatar_url, bio, created,\n github_id, discord_id, gitlab_id, google_id, steam_id, microsoft_id,\n email_verified, password\n )\n VALUES (\n $1, $2, $3, $4, $5,\n $6, $7,\n $8, $9, $10, $11, $12, $13,\n $14, $15\n )\n " - }, - "2f4a620f954c7488e8bdb94a3d6968cec6d1332942b9e9f60925d14a8c2040f7": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8", - "Text" - ] - } - }, - "query": "\n SELECT m.id FROM mods m\n INNER JOIN team_members tm ON tm.team_id = m.team_id\n WHERE tm.user_id = $1 AND tm.role = $2\n " - }, - "304aaf99f8909f8315b57fb42b4320de66e7abb2fe1e7bdd19d8c4fd7d5b06be": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "\n SELECT id FROM users\n WHERE email = $1\n " - }, - "320d73cd900a6e00f0e74b7a8c34a7658d16034b01a35558cb42fa9c16185eb5": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "author_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "thread_id", - "ordinal": 2, - "type_info": "Int8" - }, - { - "name": "body", - "ordinal": 3, - "type_info": "Jsonb" - }, - { - "name": "created", - "ordinal": 4, - "type_info": "Timestamptz" - } - ], - "nullable": [ - false, - true, - false, - false, - false - ], - "parameters": { - "Left": [ - "Int8Array" - ] - } - }, - "query": "\n SELECT tm.id, tm.author_id, tm.thread_id, tm.body, tm.created\n FROM threads_messages tm\n WHERE tm.id = ANY($1)\n " - }, - "332f1d23442b4a637d4bccf29363a7aa4da974a1b6c5752eb1b611da75030741": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM pats\n WHERE user_id = $1\n " - }, - "33a965c7dc615d3b701c05299889357db8dd36d378850625d2602ba471af4885": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int4", - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET downloads = downloads + $1\n WHERE (id = $2)\n " - }, - "33b9f52f7c67bf6272d0ba90a25185238d12494c9526ab112a854799627a69d7": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n UPDATE users\n SET email_verified = TRUE\n WHERE (id = $1)\n " - }, - "33fc96ac71cfa382991cfb153e89da1e9f43ebf5367c28b30c336b758222307b": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM loaders_versions\n WHERE loaders_versions.version_id = $1\n " - }, - "34354792d062d1d4e4d80d28c1bbc3c9b0abe0c6fb03e0387f102903d2b397b5": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "SELECT id FROM users WHERE google_id = $1" - }, - "352185977065c9903c2504081ef7c400075807785d4b62fdb48d0a45ca560f51": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT EXISTS(SELECT 1 FROM versions WHERE id = $1)" - }, - "371048e45dd74c855b84cdb8a6a565ccbef5ad166ec9511ab20621c336446da6": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET follows = follows - 1\n WHERE id = $1\n " - }, - "382753714620109f2ad1a4cacbb6f699732db321a2dcb1f9d83e57332e32357d": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n UPDATE users\n SET trolley_account_status = NULL, trolley_id = NULL\n WHERE id = $1\n " - }, - "3af747b5543a5a9b10dcce0a1eb9c2a1926dd5a507fe0d8b7f52d8ccc7fcd0af": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int4", - "Bool" - ] - } - }, - "query": "\n UPDATE mods_gallery\n SET featured = $2\n WHERE id = $1\n " - }, - "3baabc9f08401801fa290866888c540746fc50c1d79911f08f3322b605ce5c30": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Text", - "Int8" - ] - } - }, - "query": "\n SELECT id FROM mods\n WHERE status = $1\n ORDER BY queued ASC\n LIMIT $2;\n " - }, - "3bdcbfa5abe43cc9b4f996f147277a7f6921cca00f82cad0ef5d85032c761a36": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "\n DELETE FROM mod_follows\n WHERE follower_id = $1 AND mod_id = $2\n " - }, - "3c061c1888cb14655288cdbb2dad22f6cb51d6be3736e8d8206f918a9a64aec7": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int4", - "Varchar" - ] - } - }, - "query": "\n UPDATE mods_gallery\n SET title = $2\n WHERE id = $1\n " - }, - "3d384766d179f804c17e03d1917da65cc6043f88971ddc3fd23ba3be00717dfc": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int4" - }, - { - "name": "version_", - "ordinal": 1, - "type_info": "Varchar" - }, - { - "name": "type_", - "ordinal": 2, - "type_info": "Varchar" - }, - { - "name": "created", - "ordinal": 3, - "type_info": "Timestamptz" - }, - { - "name": "major", - "ordinal": 4, - "type_info": "Bool" - } - ], - "nullable": [ - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [] - } - }, - "query": "\n SELECT gv.id id, gv.version version_, gv.type type_, gv.created created, gv.major FROM game_versions gv\n ORDER BY created DESC\n " - }, - "3d700aaeb0d5129ac8c297ee0542757435a50a35ec94582d9d6ce67aa5302291": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET title = $1\n WHERE (id = $2)\n " - }, - "3f2f05653552ce8c1be95ce0a922ab41f52f40f8ff6c91c6621481102c8f35e3": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int4", - "Int8" - ] - } - }, - "query": "\n INSERT INTO game_versions_versions (game_version_id, joining_version_id)\n VALUES ($1, $2)\n " - }, - "3f525e05e94ccaea4abc059d54f48011517bd8997df0c7d42cc4caae62194ae6": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text", - "Text", - "Int8" - ] - } - }, - "query": "\n UPDATE users\n SET trolley_id = $1, trolley_account_status = $2\n WHERE id = $3\n " - }, - "3fcfed18cbfb37866e0fa57a4e95efb326864f8219941d1b696add39ed333ad1": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM mods_categories\n WHERE joining_mod_id = $1 AND is_additional = TRUE\n " - }, - "40f7c5bec98fe3503d6bd6db2eae5a4edb8d5d6efda9b9dc124f344ae5c60e08": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM mods_categories\n WHERE joining_mod_id = $1 AND is_additional = TRUE\n " - }, - "4242d5d0a6d1d4f22172cdfb06ef47189b69b52e01d00ec2effe580b42eda717": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text", - "Int8" - ] - } - }, - "query": "\n UPDATE users\n SET password = $1\n WHERE (id = $2)\n " - }, - "4514723bdc1eb8a781215075bec51af1cc6fabe88a469338d5a59533eabf80c5": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "project_type", - "ordinal": 1, - "type_info": "Int4" - }, - { - "name": "title", - "ordinal": 2, - "type_info": "Varchar" - }, - { - "name": "description", - "ordinal": 3, - "type_info": "Varchar" - }, - { - "name": "downloads", - "ordinal": 4, - "type_info": "Int4" - }, - { - "name": "follows", - "ordinal": 5, - "type_info": "Int4" - }, - { - "name": "icon_url", - "ordinal": 6, - "type_info": "Varchar" - }, - { - "name": "published", - "ordinal": 7, - "type_info": "Timestamptz" - }, - { - "name": "approved", - "ordinal": 8, - "type_info": "Timestamptz" - }, - { - "name": "updated", - "ordinal": 9, - "type_info": "Timestamptz" - }, - { - "name": "team_id", - "ordinal": 10, - "type_info": "Int8" - }, - { - "name": "license", - "ordinal": 11, - "type_info": "Varchar" - }, - { - "name": "slug", - "ordinal": 12, - "type_info": "Varchar" - }, - { - "name": "status_name", - "ordinal": 13, - "type_info": "Varchar" - }, - { - "name": "color", - "ordinal": 14, - "type_info": "Int4" - }, - { - "name": "client_side_type", - "ordinal": 15, - "type_info": "Varchar" - }, - { - "name": "server_side_type", - "ordinal": 16, - "type_info": "Varchar" - }, - { - "name": "project_type_name", - "ordinal": 17, - "type_info": "Varchar" - }, - { - "name": "username", - "ordinal": 18, - "type_info": "Varchar" - }, - { - "name": "categories", - "ordinal": 19, - "type_info": "VarcharArray" - }, - { - "name": "additional_categories", - "ordinal": 20, - "type_info": "VarcharArray" - }, - { - "name": "loaders", - "ordinal": 21, - "type_info": "VarcharArray" - }, - { - "name": "versions", - "ordinal": 22, - "type_info": "VarcharArray" - }, - { - "name": "gallery", - "ordinal": 23, - "type_info": "VarcharArray" - }, - { - "name": "featured_gallery", - "ordinal": 24, - "type_info": "VarcharArray" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - true, - false, - true, - false, - false, - false, - true, - false, - true, - false, - false, - false, - false, - null, - null, - null, - null, - null, - null - ], - "parameters": { - "Left": [ - "TextArray", - "TextArray", - "Text" - ] - } - }, - "query": "\n SELECT m.id id, m.project_type project_type, m.title title, m.description description, m.downloads downloads, m.follows follows,\n m.icon_url icon_url, m.published published, m.approved approved, m.updated updated,\n m.team_id team_id, m.license license, m.slug slug, m.status status_name, m.color color,\n cs.name client_side_type, ss.name server_side_type, pt.name project_type_name, u.username username,\n ARRAY_AGG(DISTINCT c.category) filter (where c.category is not null and mc.is_additional is false) categories,\n ARRAY_AGG(DISTINCT c.category) filter (where c.category is not null and mc.is_additional is true) additional_categories,\n ARRAY_AGG(DISTINCT lo.loader) filter (where lo.loader is not null) loaders,\n ARRAY_AGG(DISTINCT gv.version) filter (where gv.version is not null) versions,\n ARRAY_AGG(DISTINCT mg.image_url) filter (where mg.image_url is not null and mg.featured is false) gallery,\n ARRAY_AGG(DISTINCT mg.image_url) filter (where mg.image_url is not null and mg.featured is true) featured_gallery\n FROM mods m\n LEFT OUTER JOIN mods_categories mc ON joining_mod_id = m.id\n LEFT OUTER JOIN categories c ON mc.joining_category_id = c.id\n LEFT OUTER JOIN versions v ON v.mod_id = m.id AND v.status != ALL($1)\n LEFT OUTER JOIN game_versions_versions gvv ON gvv.joining_version_id = v.id\n LEFT OUTER JOIN game_versions gv ON gvv.game_version_id = gv.id\n LEFT OUTER JOIN loaders_versions lv ON lv.version_id = v.id\n LEFT OUTER JOIN loaders lo ON lo.id = lv.loader_id\n LEFT OUTER JOIN mods_gallery mg ON mg.mod_id = m.id\n INNER JOIN project_types pt ON pt.id = m.project_type\n INNER JOIN side_types cs ON m.client_side = cs.id\n INNER JOIN side_types ss ON m.server_side = ss.id\n INNER JOIN team_members tm ON tm.team_id = m.team_id AND tm.role = $3 AND tm.accepted = TRUE\n INNER JOIN users u ON tm.user_id = u.id\n WHERE m.status = ANY($2)\n GROUP BY m.id, cs.id, ss.id, pt.id, u.id;\n " - }, - "4567790f0dc98ff20b596a33161d1f6ac8af73da67fe8c54192724626c6bf670": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM mods_donations\n WHERE joining_mod_id = $1\n " - }, - "4838777a8ef4371f4f5bb4f4f038bb6d041455f0849a3972a5418d75165ae9c7": { - "describe": { - "columns": [ - { - "name": "dependency_id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "mod_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "mod_dependency_id", - "ordinal": 2, - "type_info": "Int8" - } - ], - "nullable": [ - true, - null, - true - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n SELECT d.dependency_id, COALESCE(vd.mod_id, 0) mod_id, d.mod_dependency_id\n FROM versions v\n INNER JOIN dependencies d ON d.dependent_id = v.id\n LEFT JOIN versions vd ON d.dependency_id = vd.id\n WHERE v.mod_id = $1\n " - }, - "48dc011567c5d50ee734fd0bdd1f5d07d9ef066c485a9b34495120c9947489f8": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Numeric", - "Varchar", - "Text", - "Text" - ] - } - }, - "query": "\n INSERT INTO historical_payouts (user_id, amount, status, batch_id, payment_id)\n VALUES ($1, $2, $3, $4, $5)\n " - }, - "49813a96f007216072d69468aae705d73d5b85dcdd64a22060009b12d947ed5a": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Bool", - "Int8" - ] - } - }, - "query": "\n UPDATE threads\n SET show_in_mod_inbox = $1\n WHERE id = $2\n " - }, - "49a5d21a1454afc6383b78e468fd0decc75b9163e7286f34ceab22d563a0d3f7": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "UPDATE mods\n SET downloads = downloads + 1\n WHERE (id = $1)" - }, - "4a54d350b4695c32a802675506e85b0506fc62a63ca0ee5f38890824301d6515": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int4", - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET server_side = $1\n WHERE (id = $2)\n " - }, - "4c20de487460718c8c523fce28716900f5195d12397eba09a3c437d194ff2b2e": { - "describe": { - "columns": [ - { - "name": "mod_id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n SELECT mod_id FROM versions WHERE id = $1\n " - }, - "4c58727309e5c79cc0505e57aeba0c977f308429f97b0ed296ab3bc0ebebb435": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM reports\n WHERE user_id = $1\n " - }, - "4c9e2190e2a68ffc093a69aaa1fc9384957138f57ac9cd85cbc6179613c13a08": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT EXISTS(SELECT 1 FROM mods WHERE id = $1)" - }, - "4d54032b02c860f4facec39eacb4548a0701d4505e7a80b4834650696df69c2b": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "UPDATE versions\n SET downloads = downloads + 1\n WHERE (id = $1)" - }, - "4d752ee3f43a1bf34d71c4391c9232537e0941294951f383ea8fa61e9d83fc96": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int4" - ] - } - }, - "query": "\n DELETE FROM mods_gallery\n WHERE id = $1\n " - }, - "4e9f9eafbfd705dfc94571018cb747245a98ea61bad3fae4b3ce284229d99955": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET description = $1\n WHERE (id = $2)\n " - }, - "4fb5bd341369b4beb6b4a88de296b608ea5441a96db9f7360fbdccceb4628202": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text", - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET slug = LOWER($1)\n WHERE (id = $2)\n " - }, - "507314fdcacaa3c7751738c9d0baee2b90aec719b6b203f922824eced5ea8369": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM game_versions_versions WHERE joining_version_id = $1\n " - }, - "50e65ff5df36ec59c5cf4470db908d7b04cf1ffb1640398ac518510178fd9a34": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Varchar", - "Int8", - "Int8" - ] - } - }, - "query": "\n INSERT INTO threads (\n id, thread_type, mod_id, report_id\n )\n VALUES (\n $1, $2, $3, $4\n )\n " - }, - "51e53fa0cc848654300067d4f598da49a16f5ce3aa046d1b08628566b80ce88f": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM user_backup_codes\n WHERE user_id = $1\n " - }, - "5295fba2053675c8414c0b37a59943535b9a438a642ea1c68045e987f05ade13": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int4" - }, - { - "name": "loader", - "ordinal": 1, - "type_info": "Varchar" - }, - { - "name": "icon", - "ordinal": 2, - "type_info": "Varchar" - }, - { - "name": "project_types", - "ordinal": 3, - "type_info": "VarcharArray" - } - ], - "nullable": [ - false, - false, - false, - null - ], - "parameters": { - "Left": [] - } - }, - "query": "\n SELECT l.id id, l.loader loader, l.icon icon,\n ARRAY_AGG(DISTINCT pt.name) filter (where pt.name is not null) project_types\n FROM loaders l\n LEFT OUTER JOIN loaders_project_types lpt ON joining_loader_id = l.id\n LEFT OUTER JOIN project_types pt ON lpt.joining_project_type_id = pt.id\n GROUP BY l.id;\n " - }, - "52d947ff389e17378ff6d978916a85c2d6e7ef3cd4f09f4d5f070a6c33619cd9": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM user_backup_codes\n WHERE user_id = $1\n " - }, - "53a8966ac345cc334ad65ea907be81af74e90b1217696c7eedcf8a8e3fca736e": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE versions\n SET version_number = $1\n WHERE (id = $2)\n " - }, - "5586d60c8f3d58a31e6635ffb3cb30bac389bf21b190dfd1e64a44e837f3879c": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "\n SELECT id FROM mods\n WHERE status = $1 AND queued < NOW() - INTERVAL '40 hours'\n ORDER BY updated ASC\n " - }, - "5944eb30a2bc0381c4d15eb1cf6ccf6e146a54381f2da8ab224960430e951976": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n SELECT id FROM threads\n WHERE report_id = $1\n " - }, - "599a7966e054d7892c6c48c6f303872bb51f2b5eb387a3967bf8aebb5d33f627": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n SELECT m.id\n FROM mods m\n WHERE m.team_id = $1\n " - }, - "599df07263a2705e57fc70a7c4f5dc606e1730c281e3b573d2f2a2030bed04e0": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8Array" - ] - } - }, - "query": "\n DELETE FROM notifications\n WHERE id = ANY($1)\n " - }, - "59e95e832615c375753bfc9a56b07c02d916399adfa52fb11a79b8f7b56ecf8b": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "title", - "ordinal": 1, - "type_info": "Varchar" - }, - { - "name": "description", - "ordinal": 2, - "type_info": "Varchar" - }, - { - "name": "color", - "ordinal": 3, - "type_info": "Int4" - }, - { - "name": "icon_url", - "ordinal": 4, - "type_info": "Varchar" - }, - { - "name": "slug", - "ordinal": 5, - "type_info": "Varchar" - }, - { - "name": "client_side_type", - "ordinal": 6, - "type_info": "Varchar" - }, - { - "name": "server_side_type", - "ordinal": 7, - "type_info": "Varchar" - }, - { - "name": "project_type", - "ordinal": 8, - "type_info": "Varchar" - }, - { - "name": "username", - "ordinal": 9, - "type_info": "Varchar" - }, - { - "name": "avatar_url", - "ordinal": 10, - "type_info": "Varchar" - }, - { - "name": "categories", - "ordinal": 11, - "type_info": "VarcharArray" - }, - { - "name": "loaders", - "ordinal": 12, - "type_info": "VarcharArray" - }, - { - "name": "versions", - "ordinal": 13, - "type_info": "Jsonb" - }, - { - "name": "gallery", - "ordinal": 14, - "type_info": "VarcharArray" - }, - { - "name": "featured_gallery", - "ordinal": 15, - "type_info": "VarcharArray" - } - ], - "nullable": [ - false, - false, - false, - true, - true, - true, - false, - false, - false, - false, - true, - null, - null, - null, - null, - null - ], - "parameters": { - "Left": [ - "Int8", - "TextArray", - "Text" - ] - } - }, - "query": "\n SELECT m.id id, m.title title, m.description description, m.color color,\n m.icon_url icon_url, m.slug slug, cs.name client_side_type, ss.name server_side_type,\n pt.name project_type, u.username username, u.avatar_url avatar_url,\n ARRAY_AGG(DISTINCT c.category) filter (where c.category is not null) categories,\n ARRAY_AGG(DISTINCT lo.loader) filter (where lo.loader is not null) loaders,\n JSONB_AGG(DISTINCT jsonb_build_object('id', gv.id, 'version', gv.version, 'type', gv.type, 'created', gv.created, 'major', gv.major)) filter (where gv.version is not null) versions,\n ARRAY_AGG(DISTINCT mg.image_url) filter (where mg.image_url is not null and mg.featured is false) gallery,\n ARRAY_AGG(DISTINCT mg.image_url) filter (where mg.image_url is not null and mg.featured is true) featured_gallery\n FROM mods m\n LEFT OUTER JOIN mods_categories mc ON joining_mod_id = m.id AND mc.is_additional = FALSE\n LEFT OUTER JOIN categories c ON mc.joining_category_id = c.id\n LEFT OUTER JOIN versions v ON v.mod_id = m.id AND v.status != ALL($2)\n LEFT OUTER JOIN game_versions_versions gvv ON gvv.joining_version_id = v.id\n LEFT OUTER JOIN game_versions gv ON gvv.game_version_id = gv.id\n LEFT OUTER JOIN loaders_versions lv ON lv.version_id = v.id\n LEFT OUTER JOIN loaders lo ON lo.id = lv.loader_id\n LEFT OUTER JOIN mods_gallery mg ON mg.mod_id = m.id\n INNER JOIN project_types pt ON pt.id = m.project_type\n INNER JOIN side_types cs ON m.client_side = cs.id\n INNER JOIN side_types ss ON m.server_side = ss.id\n INNER JOIN team_members tm ON tm.team_id = m.team_id AND tm.role = $3 AND tm.accepted = TRUE\n INNER JOIN users u ON tm.user_id = u.id\n WHERE m.id = $1\n GROUP BY m.id, cs.id, ss.id, pt.id, u.id;\n " - }, - "5a13a79ebb1ab975f88b58e6deaba9685fe16e242c0fa4a5eea54f12f9448e6b": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM reports\n WHERE version_id = $1\n " - }, - "5c3b340d278c356b6bc2cd7110e5093a7d1ad982ae0f468f8fff7c54e4e6603a": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int4" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "\n SELECT id FROM project_types\n WHERE name = $1\n " - }, - "5c4262689205aafdd97a74bee0003f39eef0a34c97f97a939c14fb8fe349f7eb": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n UPDATE files\n SET is_primary = TRUE\n WHERE (id = $1)\n " - }, - "5c5cac91f61b0cd98d2d986e2d22e5a6b220bdd39f98520385f4ea84b3ffeeed": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE versions\n SET status = $1\n WHERE (id = $2)\n " - }, - "5ca43f2fddda27ad857f230a3427087f1e58150949adc6273156718730c10f69": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE users\n SET role = $1\n WHERE (id = $2)\n " - }, - "5d0b9862547d0920a5fd5ccc3460c6bf28bc7c0b1b832274ada6ce5d48b705a9": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT id FROM users WHERE gitlab_id = $1" - }, - "5d7425cfa91e332bf7cc14aa5c300b997e941c49757606f6b906cb5e060d3179": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET updated = NOW()\n WHERE id = $1\n " - }, - "5dd9503c98266d44dfef73dda81f0051789280b78d1b0fb4de509ac6ccfcb86a": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT id FROM users WHERE steam_id = $1" - }, - "5eb2795d25d6d03e22564048c198d821cd5ff22eb4e39b9dd7f198c9113d4f87": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE users\n SET name = $1\n WHERE (id = $2)\n " - }, - "5ee2dc5cda9bfc0395da5a4ebf234093e9b8135db5e4a0258b00fa16fb825faa": { - "describe": { - "columns": [ - { - "name": "name", - "ordinal": 0, - "type_info": "Varchar" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [] - } - }, - "query": "\n SELECT name FROM project_types\n " - }, - "5f2d1161981df3d0fd1588580015525db13b06266314448b7fa400d298920c86": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int4", - "Int8" - ] - } - }, - "query": "\n UPDATE mods_gallery\n SET ordering = $2\n WHERE id = $1\n " - }, - "5f94e9e767ec4be7f9136b991b4a29373dbe48feb2f61281e3212721095ed675": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Varchar", - "Int8", - "Int8", - "Varchar" - ] - } - }, - "query": "\n INSERT INTO dependencies (dependent_id, dependency_type, dependency_id, mod_dependency_id, dependency_file_name)\n VALUES ($1, $2, $3, $4, $5)\n " - }, - "61a7f29e024bf2f1368370e3f6e8ef70317c7e8545b5b6d4235f21164948ba27": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Bool" - ] - } - }, - "query": "\n UPDATE mods_gallery\n SET featured = $2\n WHERE mod_id = $1\n " - }, - "64d5e7cfb8472fbedcd06143db0db2f4c9677c42f73c540e85ccb5aee1a7b6f9": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Timestamptz", - "Varchar", - "Varchar", - "Varchar", - "Varchar", - "Varchar", - "Varchar" - ] - } - }, - "query": "\n UPDATE sessions\n SET last_login = $2, city = $3, country = $4, ip = $5, os = $6, platform = $7, user_agent = $8\n WHERE (id = $1)\n " - }, - "665e294e9737fd0299fc4639127d56811485dc8a5a4e08a4e7292044d8a2fb7a": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE reports\n SET body = $1\n WHERE (id = $2)\n " - }, - "66b06ddcd0a4cf01e716331befa393a12631fe6752a7d078bda06b24d50daae2": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET requested_status = $1\n WHERE (id = $2)\n " - }, - "66d61a9077fd4fdf3c56e9cd6599095409ff3b46aad164210a1359a3154dbdb8": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT EXISTS(SELECT 1 FROM sessions WHERE id=$1)" - }, - "67d021f0776276081d3c50ca97afa6b78b98860bf929009e845e9c00a192e3b5": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int4" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "\n SELECT id FROM report_types\n WHERE name = $1\n " - }, - "680067ff64918882a3bff1438a6a70ca51a5dc52e48e47bbeb6e32d6739422d2": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM notifications\n WHERE user_id = $1\n " - }, - "69b093cad9109ccf4779bfd969897f6b9ebc9d0d4230c958de4fa07435776349": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM sessions\n WHERE user_id = $1\n " - }, - "6a7b7704c2a0c52a70f5d881a1e6d3e8e77ddaa83ecc5688cd86bf327775fb76": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Bytea", - "Text" - ] - } - }, - "query": "\n SELECT f.id id FROM hashes h\n INNER JOIN files f ON h.file_id = f.id\n WHERE h.algorithm = $2 AND h.hash = $1\n " - }, - "6b7958eac5f273af8f37c0c888594e106fe323cbb3b0c32868b02f869d30f33f": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "name", - "ordinal": 1, - "type_info": "Varchar" - }, - { - "name": "mod_id", - "ordinal": 2, - "type_info": "Int8" - }, - { - "name": "version_id", - "ordinal": 3, - "type_info": "Int8" - }, - { - "name": "user_id", - "ordinal": 4, - "type_info": "Int8" - }, - { - "name": "body", - "ordinal": 5, - "type_info": "Varchar" - }, - { - "name": "reporter", - "ordinal": 6, - "type_info": "Int8" - }, - { - "name": "created", - "ordinal": 7, - "type_info": "Timestamptz" - }, - { - "name": "thread_id", - "ordinal": 8, - "type_info": "Int8" - }, - { - "name": "closed", - "ordinal": 9, - "type_info": "Bool" - } - ], - "nullable": [ - false, - false, - true, - true, - true, - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Int8Array" - ] - } - }, - "query": "\n SELECT r.id, rt.name, r.mod_id, r.version_id, r.user_id, r.body, r.reporter, r.created, t.id thread_id, r.closed\n FROM reports r\n INNER JOIN report_types rt ON rt.id = r.report_type_id\n INNER JOIN threads t ON t.report_id = r.id\n WHERE r.id = ANY($1)\n ORDER BY r.created DESC\n " - }, - "6b89c2b2557e304c2a3a02d7824327685f9be696254bf2370d0c995aafc6a2d8": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "TextArray" - ] - } - }, - "query": "\n UPDATE mods\n SET loaders = (\n SELECT COALESCE(ARRAY_AGG(DISTINCT l.loader) filter (where l.loader is not null), array[]::varchar[])\n FROM versions v\n INNER JOIN loaders_versions lv ON lv.version_id = v.id\n INNER JOIN loaders l on lv.loader_id = l.id\n WHERE v.mod_id = mods.id AND v.status != ALL($2)\n )\n WHERE id = $1\n " - }, - "6c7aeb0db4a4fb3387c37b8d7aca6fdafaa637fd883a44416b56270aeebb7a01": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int4", - "Int8" - ] - } - }, - "query": "\n INSERT INTO loaders_versions (loader_id, version_id)\n VALUES ($1, $2)\n " - }, - "6c8b8a2f11c0b4e7a5973547fe1611a0fa4ef366d5c8a91d9fb9a1360ea04d46": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Bytea", - "Text", - "Int8" - ] - } - }, - "query": "\n SELECT EXISTS(SELECT 1 FROM hashes h\n INNER JOIN files f ON f.id = h.file_id\n INNER JOIN versions v ON v.id = f.version_id\n WHERE h.algorithm = $2 AND h.hash = $1 AND v.mod_id != $3)\n " - }, - "6d10ec782e422e868681827a6eb999edc6bf4fe8fa2b94d1f8970db2578c6db4": { - "describe": { - "columns": [ - { - "name": "created", - "ordinal": 0, - "type_info": "Timestamptz" - }, - { - "name": "amount", - "ordinal": 1, - "type_info": "Numeric" - }, - { - "name": "status", - "ordinal": 2, - "type_info": "Varchar" - } - ], - "nullable": [ - false, - false, - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n SELECT hp.created, hp.amount, hp.status\n FROM historical_payouts hp\n WHERE hp.user_id = $1\n ORDER BY hp.created DESC\n " - }, - "6d883ea05aead20f571a0f63bfd63f1d432717ec7a0fb9ab29e01fcb061b3afc": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n UPDATE files\n SET is_primary = FALSE\n WHERE (version_id = $1)\n " - }, - "6db607d629be3047d53ff92bb82c07700595e8f4fcb7b602918540af4ae50d8b": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM users\n WHERE id = $1\n " - }, - "6e07cc68675d0f583182eaa9f50853fa5996b9f83543fe8b6c2a073cf6a9cb5d": { - "describe": { - "columns": [ - { - "name": "count", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "TextArray" - ] - } - }, - "query": "\n SELECT COUNT(id)\n FROM mods\n WHERE status = ANY($1)\n " - }, - "6f594641f9633fbab31a57ebdbd33dd74f89e45252dfc2ae1cdbda549291b21b": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM mod_follows\n WHERE follower_id = $1\n " - }, - "6fd06767f42be894c7a35c6b61f43407c55de43dc77ed02b39062278f3de81e3": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8", - "Int8", - "Varchar", - "Int8", - "Bool" - ] - } - }, - "query": "\n INSERT INTO team_members (\n id, team_id, user_id, role, permissions, accepted\n )\n VALUES (\n $1, $2, $3, $4, $5, $6\n )\n " - }, - "70b510956a40583eef8c57dcced71c67f525eee455ae8b09e9b2403668068751": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "\n INSERT INTO threads_members (\n thread_id, user_id\n )\n VALUES (\n $1, $2\n )\n " - }, - "71abd207410d123f9a50345ddcddee335fea0d0cc6f28762713ee01a36aee8a0": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8Array", - "Int8" - ] - } - }, - "query": "\n SELECT m.id FROM mods m\n INNER JOIN team_members tm ON tm.team_id = m.team_id AND user_id = $2\n WHERE m.id = ANY($1)\n " - }, - "72c75313688dfd88a659c5250c71b9899abd6186ab32a067a7d4b8a0846ebd18": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int4" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Varchar", - "Text", - "Timestamp" - ] - } - }, - "query": "\n INSERT INTO game_versions (version, type, created)\n VALUES ($1, COALESCE($2, 'other'), COALESCE($3, timezone('utc', now())))\n ON CONFLICT (version) DO UPDATE\n SET type = COALESCE($2, game_versions.type),\n created = COALESCE($3, game_versions.created)\n RETURNING id\n " - }, - "72d6b5f2f11d88981db82c7247c9e7e5ebfd8d34985a1a8209d6628e66490f37": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int4" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "\n SELECT id FROM categories\n WHERE category = $1\n " - }, - "73bdd6c9e7cd8c1ed582261aebdee0f8fd2734e712ef288a2608564c918009cb": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM versions WHERE id = $1\n " - }, - "73d77f11f97a9073f601119c6eb450ea08ae1d2df1a27ba9af1efa972ed9a836": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int4", - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET icon_url = $1, color = $2\n WHERE (id = $3)\n " - }, - "742f20f422361971c21b72c629c57a6c3870d8d6c41577496907290db5994f12": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "\n UPDATE users\n SET badges = $1\n WHERE (id = $2)\n " - }, - "75a860ca8087536a9fcf932846341c8bd322d314231bb8acac124d1cea93270b": { - "describe": { - "columns": [ - { - "name": "mod_id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n SELECT mf.mod_id FROM mod_follows mf\n WHERE mf.follower_id = $1\n " - }, - "75dc7f592781a1414e5f489543b14cb94c5265ddb3abfb3dda965c8cf154b753": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Varchar" - ] - } - }, - "query": "\n UPDATE files\n SET file_type = $2\n WHERE (id = $1)\n " - }, - "76db1c204139e18002e5751c3dcefff79791a1dd852b62d34fcf008151e8945a": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int4" - }, - { - "name": "short", - "ordinal": 1, - "type_info": "Varchar" - }, - { - "name": "name", - "ordinal": 2, - "type_info": "Varchar" - } - ], - "nullable": [ - false, - false, - false - ], - "parameters": { - "Left": [] - } - }, - "query": "\n SELECT id, short, name FROM donation_platforms\n " - }, - "7711b7c651015510a101cc409fa6f5229ac93d7209df8bc158f4dd4442f611f2": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM user_backup_codes\n WHERE user_id = $1\n " - }, - "78699c6d2ca0f13f4609310df479903e8d5e0d2d4c2603df0333be7dc040a4ee": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM dependencies WHERE mod_dependency_id = $1\n " - }, - "7916fe4f04067324ae05598ec9dc6f97f18baf9eda30c64f32677158ada87478": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET monetization_status = $1\n WHERE (id = $2)\n " - }, - "796f057ea8eb5b01d3eedeee9840fb37464ea567f32871953fb07e14ed86af1c": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "SELECT EXISTS(SELECT 1 FROM team_members WHERE team_id = $1 AND user_id = $2)" - }, - "797cddf8f779025726a4a42c42985b8bc4c14094b76d9cd66dca20a7da3dec2a": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "SELECT EXISTS(SELECT 1 FROM mods m INNER JOIN team_members tm ON tm.team_id = m.team_id AND tm.user_id = $2 WHERE m.id = $1)" - }, - "79b896b1a8ddab285294638302976b75d0d915f36036383cc21bd2fc48d4502c": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM loaders_versions WHERE version_id = $1\n " - }, - "7ab21e7613dd88e97cf602e76bff62170c13ceef8104a4ce4cb2d101f8ce4f48": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Numeric", - "Int8" - ] - } - }, - "query": "\n UPDATE users\n SET balance = balance + $1\n WHERE id = $2\n " - }, - "7af44414304c8be404d32daa3cadf99fc4ecf97b74aeb5d39c890b0f35a51f96": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n SELECT n.id FROM notifications n\n WHERE n.user_id = $1\n " - }, - "7b1d14e79d07247bf3061accdccdd83a36abb186ebeb253f34daf6c7337c6f7c": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "project_type", - "ordinal": 1, - "type_info": "Int4" - }, - { - "name": "title", - "ordinal": 2, - "type_info": "Varchar" - }, - { - "name": "description", - "ordinal": 3, - "type_info": "Varchar" - }, - { - "name": "downloads", - "ordinal": 4, - "type_info": "Int4" - }, - { - "name": "follows", - "ordinal": 5, - "type_info": "Int4" - }, - { - "name": "icon_url", - "ordinal": 6, - "type_info": "Varchar" - }, - { - "name": "body", - "ordinal": 7, - "type_info": "Varchar" - }, - { - "name": "published", - "ordinal": 8, - "type_info": "Timestamptz" - }, - { - "name": "updated", - "ordinal": 9, - "type_info": "Timestamptz" - }, - { - "name": "approved", - "ordinal": 10, - "type_info": "Timestamptz" - }, - { - "name": "queued", - "ordinal": 11, - "type_info": "Timestamptz" - }, - { - "name": "status", - "ordinal": 12, - "type_info": "Varchar" - }, - { - "name": "requested_status", - "ordinal": 13, - "type_info": "Varchar" - }, - { - "name": "issues_url", - "ordinal": 14, - "type_info": "Varchar" - }, - { - "name": "source_url", - "ordinal": 15, - "type_info": "Varchar" - }, - { - "name": "wiki_url", - "ordinal": 16, - "type_info": "Varchar" - }, - { - "name": "discord_url", - "ordinal": 17, - "type_info": "Varchar" - }, - { - "name": "license_url", - "ordinal": 18, - "type_info": "Varchar" - }, - { - "name": "team_id", - "ordinal": 19, - "type_info": "Int8" - }, - { - "name": "client_side", - "ordinal": 20, - "type_info": "Int4" - }, - { - "name": "server_side", - "ordinal": 21, - "type_info": "Int4" - }, - { - "name": "license", - "ordinal": 22, - "type_info": "Varchar" - }, - { - "name": "slug", - "ordinal": 23, - "type_info": "Varchar" - }, - { - "name": "moderation_message", - "ordinal": 24, - "type_info": "Varchar" - }, - { - "name": "moderation_message_body", - "ordinal": 25, - "type_info": "Varchar" - }, - { - "name": "client_side_type", - "ordinal": 26, - "type_info": "Varchar" - }, - { - "name": "server_side_type", - "ordinal": 27, - "type_info": "Varchar" - }, - { - "name": "project_type_name", - "ordinal": 28, - "type_info": "Varchar" - }, - { - "name": "webhook_sent", - "ordinal": 29, - "type_info": "Bool" - }, - { - "name": "color", - "ordinal": 30, - "type_info": "Int4" - }, - { - "name": "thread_id", - "ordinal": 31, - "type_info": "Int8" - }, - { - "name": "monetization_status", - "ordinal": 32, - "type_info": "Varchar" - }, - { - "name": "loaders", - "ordinal": 33, - "type_info": "VarcharArray" - }, - { - "name": "game_versions", - "ordinal": 34, - "type_info": "VarcharArray" - }, - { - "name": "categories", - "ordinal": 35, - "type_info": "VarcharArray" - }, - { - "name": "additional_categories", - "ordinal": 36, - "type_info": "VarcharArray" - }, - { - "name": "versions", - "ordinal": 37, - "type_info": "Jsonb" - }, - { - "name": "gallery", - "ordinal": 38, - "type_info": "Jsonb" - }, - { - "name": "donations", - "ordinal": 39, - "type_info": "Jsonb" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - true, - false, - false, - false, - true, - true, - false, - true, - true, - true, - true, - true, - true, - false, - false, - false, - false, - true, - true, - true, - false, - false, - false, - false, - true, - false, - false, - false, - false, - null, - null, - null, - null, - null - ], - "parameters": { - "Left": [ - "Int8Array", - "TextArray", - "TextArray" - ] - } - }, - "query": "\n SELECT m.id id, m.project_type project_type, m.title title, m.description description, m.downloads downloads, m.follows follows,\n m.icon_url icon_url, m.body body, m.published published,\n m.updated updated, m.approved approved, m.queued, m.status status, m.requested_status requested_status,\n m.issues_url issues_url, m.source_url source_url, m.wiki_url wiki_url, m.discord_url discord_url, m.license_url license_url,\n m.team_id team_id, m.client_side client_side, m.server_side server_side, m.license license, m.slug slug, m.moderation_message moderation_message, m.moderation_message_body moderation_message_body,\n cs.name client_side_type, ss.name server_side_type, pt.name project_type_name, m.webhook_sent, m.color,\n t.id thread_id, m.monetization_status monetization_status, m.loaders loaders, m.game_versions game_versions,\n ARRAY_AGG(DISTINCT c.category) filter (where c.category is not null and mc.is_additional is false) categories,\n ARRAY_AGG(DISTINCT c.category) filter (where c.category is not null and mc.is_additional is true) additional_categories,\n JSONB_AGG(DISTINCT jsonb_build_object('id', v.id, 'date_published', v.date_published)) filter (where v.id is not null) versions,\n JSONB_AGG(DISTINCT jsonb_build_object('image_url', mg.image_url, 'featured', mg.featured, 'title', mg.title, 'description', mg.description, 'created', mg.created, 'ordering', mg.ordering)) filter (where mg.image_url is not null) gallery,\n JSONB_AGG(DISTINCT jsonb_build_object('platform_id', md.joining_platform_id, 'platform_short', dp.short, 'platform_name', dp.name,'url', md.url)) filter (where md.joining_platform_id is not null) donations\n FROM mods m\n INNER JOIN project_types pt ON pt.id = m.project_type\n INNER JOIN side_types cs ON m.client_side = cs.id\n INNER JOIN side_types ss ON m.server_side = ss.id\n INNER JOIN threads t ON t.mod_id = m.id\n LEFT JOIN mods_gallery mg ON mg.mod_id = m.id\n LEFT JOIN mods_donations md ON md.joining_mod_id = m.id\n LEFT JOIN donation_platforms dp ON md.joining_platform_id = dp.id\n LEFT JOIN mods_categories mc ON mc.joining_mod_id = m.id\n LEFT JOIN categories c ON mc.joining_category_id = c.id\n LEFT JOIN versions v ON v.mod_id = m.id AND v.status = ANY($3)\n WHERE m.id = ANY($1) OR m.slug = ANY($2)\n GROUP BY pt.id, cs.id, ss.id, t.id, m.id;\n " - }, - "7c0cdacf0898155c94008a96a0b918550df4475b9e3362a926d4d00e001880c1": { - "describe": { - "columns": [ - { - "name": "amount", - "ordinal": 0, - "type_info": "Numeric" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n SELECT SUM(pv.amount) amount\n FROM payouts_values pv\n WHERE pv.user_id = $1 AND created > NOW() - '1 month'::interval\n " - }, - "7c61fee015231f0a97c25d24f2c6be24821e39e330ab82344ad3b985d0d2aaea": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int4" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "\n SELECT id FROM mods_gallery\n WHERE image_url = $1\n " - }, - "7cb691738c28e0d1f28c84ba2dbcfa21a6dbd859bcf0f565f90cd7ce2ea5aa1c": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int4" - ] - } - }, - "query": "\n INSERT INTO mods_categories (joining_mod_id, joining_category_id, is_additional)\n VALUES ($1, $2, FALSE)\n " - }, - "7e030d43f3412e7df63c970f873d0a73dd2deb9857aa6f201ec5eec628eb336c": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "\n UPDATE users\n SET github_id = $2\n WHERE (id = $1)\n " - }, - "81e2e17bfbaadbb3d25072cf6cb8e8d7b3842252b3c72fcbd24aadd2ad933472": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Varchar" - ] - } - }, - "query": "\n UPDATE users\n SET microsoft_id = $2\n WHERE (id = $1)\n " - }, - "83d428e1c07d16e356ef26bdf1d707940b1683b5f631ded1f6674a081453d67b": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET source_url = $1\n WHERE (id = $2)\n " - }, - "8422dcab178b4121d438a8fe4e365f527467c09d40a470a6c2cbdab71b04be4e": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM historical_payouts\n WHERE user_id = $1\n " - }, - "85463fa221147ee8d409fc92ed681fa27df683e7c80b8dd8616ae94dc1205c24": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "\n UPDATE versions\n SET author_id = $1\n WHERE (author_id = $2)\n " - }, - "85b40877c48fc4f23039c1b556007f92056a015f160fe1059b0d3b13615af0fb": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Varchar", - "Bool", - "Varchar", - "Varchar", - "Int8" - ] - } - }, - "query": "\n INSERT INTO mods_gallery (\n mod_id, image_url, featured, title, description, ordering\n )\n VALUES (\n $1, $2, $3, $4, $5, $6\n )\n " - }, - "85c6de008681d9fc9dc51b17330bed09204010813111e66a7ca84bc0e603f537": { - "describe": { - "columns": [ - { - "name": "name", - "ordinal": 0, - "type_info": "Varchar" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [] - } - }, - "query": "\n SELECT name FROM side_types\n " - }, - "868c29019bd7e9ad71fb3515ca3489304ade3f6ebe3f77c018a8a521a96fb41f": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "team_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "user_id", - "ordinal": 2, - "type_info": "Int8" - }, - { - "name": "role", - "ordinal": 3, - "type_info": "Varchar" - }, - { - "name": "permissions", - "ordinal": 4, - "type_info": "Int8" - }, - { - "name": "accepted", - "ordinal": 5, - "type_info": "Bool" - }, - { - "name": "payouts_split", - "ordinal": 6, - "type_info": "Numeric" - }, - { - "name": "ordering", - "ordinal": 7, - "type_info": "Int8" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "\n SELECT tm.id, tm.team_id, tm.user_id, tm.role, tm.permissions, tm.accepted, tm.payouts_split, tm.ordering FROM versions v\n INNER JOIN mods m ON m.id = v.mod_id\n INNER JOIN team_members tm ON tm.team_id = m.team_id AND tm.user_id = $2 AND tm.accepted = TRUE\n WHERE v.id = $1\n " - }, - "868ee76d507cc9e94cd3c2e44770faff127e2b3c5f49b8100a9a37ac4d7b1f1d": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE users\n SET username = $1\n WHERE (id = $2)\n " - }, - "86b5f8c13cf232d55a6f5053db2727036fd3ccc7bd31b32aa443993d4815ab8f": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Timestamptz", - "Int8" - ] - } - }, - "query": "\n UPDATE pats\n SET expires = $1\n WHERE id = $2\n " - }, - "8abb317c85f48c7dd9ccf4a7b8fbc0b58ac73f7ae87ff2dfe67009a51089f784": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET wiki_url = $1\n WHERE (id = $2)\n " - }, - "8b99c759446f40e4ec9539cd368526ad9bcb1ddb266124c5f890e3b051c74c59": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM mods_gallery\n WHERE mod_id = $1\n " - }, - "8ba2b2c38958f1c542e514fc62ab4682f58b0b442ac1842d20625420698e34ec": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8", - "Text" - ] - } - }, - "query": "\n DELETE FROM team_members\n WHERE (team_id = $1 AND user_id = $2 AND NOT role = $3)\n " - }, - "8f45a48700b8836f4ba8626b25b7be7f838d35d260430a46817729d9787e2013": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Bool", - "Text", - "Int8" - ] - } - }, - "query": "\n UPDATE users\n SET email = $1, email_verified = $2, trolley_account_status = $3\n WHERE id = $4\n " - }, - "8f5e2a570cf35b2d158182bac37fd40bcec277bbdeddaece5efaa88600048a70": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n UPDATE threads\n SET show_in_mod_inbox = FALSE\n WHERE id = $1\n " - }, - "912250d37f13a98a21165c72bfc1eaa8a85b9952dd6750c117dca7fbb1bb8962": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM threads_members\n WHERE user_id = $1\n " - }, - "92c00ebff25cfb0464947ea48faac417fabdb3cb3edd5ed45720598c7c12c689": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM payouts_values\n WHERE user_id = $1\n " - }, - "93c0fdb2bdc9c57602671d50108957654ede51e944944d4af59fe1ba1f6a336e": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "thread_type", - "ordinal": 1, - "type_info": "Varchar" - }, - { - "name": "mod_id", - "ordinal": 2, - "type_info": "Int8" - }, - { - "name": "report_id", - "ordinal": 3, - "type_info": "Int8" - }, - { - "name": "show_in_mod_inbox", - "ordinal": 4, - "type_info": "Bool" - }, - { - "name": "members", - "ordinal": 5, - "type_info": "Int8Array" - }, - { - "name": "messages", - "ordinal": 6, - "type_info": "Jsonb" - } - ], - "nullable": [ - false, - false, - true, - true, - false, - null, - null - ], - "parameters": { - "Left": [ - "Int8Array" - ] - } - }, - "query": "\n SELECT t.id, t.thread_type, t.mod_id, t.report_id, t.show_in_mod_inbox,\n ARRAY_AGG(DISTINCT tm.user_id) filter (where tm.user_id is not null) members,\n JSONB_AGG(DISTINCT jsonb_build_object('id', tmsg.id, 'author_id', tmsg.author_id, 'thread_id', tmsg.thread_id, 'body', tmsg.body, 'created', tmsg.created)) filter (where tmsg.id is not null) messages\n FROM threads t\n LEFT OUTER JOIN threads_messages tmsg ON tmsg.thread_id = t.id\n LEFT OUTER JOIN threads_members tm ON tm.thread_id = t.id\n WHERE t.id = ANY($1)\n GROUP BY t.id\n " - }, - "95cb791af4ea4d5b959de9e451bb8875336db33238024812086b5237b4dac350": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM pats WHERE id = $1\n " - }, - "97690dda7edea8c985891cae5ad405f628ed81e333bc88df5493c928a4324d43": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT EXISTS(SELECT 1 FROM reports WHERE id=$1)" - }, - "9774f59e5d5ce6ba00ca7e3a4a81f80f78b908bdf664a4cdfad592a1b14c0d44": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Text" - ] - } - }, - "query": "\n UPDATE historical_payouts\n SET status = $1\n WHERE payment_id = $2\n " - }, - "980e2ebd1b77baecff5b302b063d8f359ddbdb68452c4c8f2a53dc8d6a2127a4": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "team_id", - "ordinal": 1, - "type_info": "Int8" - } - ], - "nullable": [ - false, - false - ], - "parameters": { - "Left": [ - "Int8Array", - "Int8" - ] - } - }, - "query": "\n SELECT m.id id, m.team_id team_id FROM team_members tm\n INNER JOIN mods m ON m.team_id = tm.team_id\n WHERE tm.team_id = ANY($1) AND tm.user_id = $2\n " - }, - "99a1eac69d7f5a5139703df431e6a5c3012a90143a8c635f93632f04d0bc41d4": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET wiki_url = $1\n WHERE (id = $2)\n " - }, - "99e7779380ebae726051ba8e2810f37bee36f3fb36729c07ef11d0ac1b611d7e": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n UPDATE users\n SET totp_secret = NULL\n WHERE (id = $1)\n " - }, - "9aab2350d576fd934b0541d1f71f320ac939b44a179fee3d1638113cdb3ddfe7": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int4", - "Varchar" - ] - } - }, - "query": "\n INSERT INTO mods_donations (joining_mod_id, joining_platform_id, url)\n VALUES ($1, $2, $3)\n " - }, - "9bf8862af8f636c4ef77e8c9f1f5d31d4f2d3f5b73fb6e6ca8a09ad5224250c3": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE users\n SET totp_secret = $1\n WHERE (id = $2)\n " - }, - "9c8f3f9503b5bb52e05bbc8a8eee7f640ab7d6b04a59ec111ce8b23e886911de": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM dependencies WHERE dependent_id = $1\n " - }, - "9cf0b1e3a91ce821865dbfbfb292193311be63bc0e79ab762efe84c19de510c6": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8", - "Int8", - "Varchar", - "Int8", - "Bool", - "Numeric", - "Int8" - ] - } - }, - "query": "\n INSERT INTO team_members (id, team_id, user_id, role, permissions, accepted, payouts_split, ordering)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8)\n " - }, - "a0148ff25855202e7bb220b6a2bc9220a95e309fb0dae41d9a05afa86e6b33af": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM mods_categories\n WHERE joining_mod_id = $1 AND is_additional = FALSE\n " - }, - "a0c91184d5a02b986decac3c34e78b61451ff90e103bcf1ec46f8da3bbcc1ff2": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8Array" - ] - } - }, - "query": "\n DELETE FROM notifications_actions\n WHERE notification_id = ANY($1)\n " - }, - "a11d613479d09dff5fcdc45ab7a0341fb1b4738f0ede71572d939ef0984bd65f": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET approved = NOW()\n WHERE id = $1 AND approved IS NULL\n " - }, - "a1a8aa7cc5d7967fbc64b979489222d9f5c154e21227f0edcbce1d96dddad3c6": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8", - "Text" - ] - } - }, - "query": "\n UPDATE team_members\n SET user_id = $1\n WHERE (user_id = $2 AND role = $3)\n " - }, - "a1ba3b5cc50b1eb24f5529e06be1439f4a313c4ea8845c2733db752e53f5ae1c": { - "describe": { - "columns": [ - { - "name": "count", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "TextArray", - "TextArray" - ] - } - }, - "query": "\n SELECT COUNT(f.id) FROM files f\n INNER JOIN versions v on f.version_id = v.id AND v.status = ANY($2)\n INNER JOIN mods m on v.mod_id = m.id AND m.status = ANY($1)\n " - }, - "a31bce5cec7583d71c140ff84a2c93a6127efee7b5607ca6e609570396f44f27": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "team_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "user_id", - "ordinal": 2, - "type_info": "Int8" - }, - { - "name": "role", - "ordinal": 3, - "type_info": "Varchar" - }, - { - "name": "permissions", - "ordinal": 4, - "type_info": "Int8" - }, - { - "name": "accepted", - "ordinal": 5, - "type_info": "Bool" - }, - { - "name": "payouts_split", - "ordinal": 6, - "type_info": "Numeric" - }, - { - "name": "ordering", - "ordinal": 7, - "type_info": "Int8" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "\n SELECT tm.id, tm.team_id, tm.user_id, tm.role, tm.permissions, tm.accepted, tm.payouts_split, tm.ordering FROM mods m\n INNER JOIN team_members tm ON tm.team_id = m.team_id AND user_id = $2 AND accepted = TRUE\n WHERE m.id = $1\n " - }, - "a440cb2567825c3cc540c9b0831ee840f6e2a6394e89a851b83fc78220594cf2": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Timestamptz", - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET status = $1, approved = $2\n WHERE (id = $3)\n " - }, - "a48b717b74531dc457069ee811ec1adc1da195f00a42fff7f08667b139cd8fea": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "\n INSERT INTO user_backup_codes (\n user_id, code\n )\n VALUES (\n $1, $2\n )\n " - }, - "a62767e812783e8836a11b22878a4248123f3fe212a876e192f549acd6edcb39": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "mod_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "author_id", - "ordinal": 2, - "type_info": "Int8" - }, - { - "name": "version_name", - "ordinal": 3, - "type_info": "Varchar" - }, - { - "name": "version_number", - "ordinal": 4, - "type_info": "Varchar" - }, - { - "name": "changelog", - "ordinal": 5, - "type_info": "Varchar" - }, - { - "name": "date_published", - "ordinal": 6, - "type_info": "Timestamptz" - }, - { - "name": "downloads", - "ordinal": 7, - "type_info": "Int4" - }, - { - "name": "version_type", - "ordinal": 8, - "type_info": "Varchar" - }, - { - "name": "featured", - "ordinal": 9, - "type_info": "Bool" - }, - { - "name": "status", - "ordinal": 10, - "type_info": "Varchar" - }, - { - "name": "requested_status", - "ordinal": 11, - "type_info": "Varchar" - }, - { - "name": "game_versions", - "ordinal": 12, - "type_info": "Jsonb" - }, - { - "name": "loaders", - "ordinal": 13, - "type_info": "VarcharArray" - }, - { - "name": "files", - "ordinal": 14, - "type_info": "Jsonb" - }, - { - "name": "hashes", - "ordinal": 15, - "type_info": "Jsonb" - }, - { - "name": "dependencies", - "ordinal": 16, - "type_info": "Jsonb" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - true, - null, - null, - null, - null, - null - ], - "parameters": { - "Left": [ - "Int8Array" - ] - } - }, - "query": "\n SELECT v.id id, v.mod_id mod_id, v.author_id author_id, v.name version_name, v.version_number version_number,\n v.changelog changelog, v.date_published date_published, v.downloads downloads,\n v.version_type version_type, v.featured featured, v.status status, v.requested_status requested_status,\n JSONB_AGG(DISTINCT jsonb_build_object('version', gv.version, 'created', gv.created)) filter (where gv.version is not null) game_versions,\n ARRAY_AGG(DISTINCT l.loader) filter (where l.loader is not null) loaders,\n JSONB_AGG(DISTINCT jsonb_build_object('id', f.id, 'url', f.url, 'filename', f.filename, 'primary', f.is_primary, 'size', f.size, 'file_type', f.file_type)) filter (where f.id is not null) files,\n JSONB_AGG(DISTINCT jsonb_build_object('algorithm', h.algorithm, 'hash', encode(h.hash, 'escape'), 'file_id', h.file_id)) filter (where h.hash is not null) hashes,\n JSONB_AGG(DISTINCT jsonb_build_object('project_id', d.mod_dependency_id, 'version_id', d.dependency_id, 'dependency_type', d.dependency_type,'file_name', dependency_file_name)) filter (where d.dependency_type is not null) dependencies\n FROM versions v\n LEFT OUTER JOIN game_versions_versions gvv on v.id = gvv.joining_version_id\n LEFT OUTER JOIN game_versions gv on gvv.game_version_id = gv.id\n LEFT OUTER JOIN loaders_versions lv on v.id = lv.version_id\n LEFT OUTER JOIN loaders l on lv.loader_id = l.id\n LEFT OUTER JOIN files f on v.id = f.version_id\n LEFT OUTER JOIN hashes h on f.id = h.file_id\n LEFT OUTER JOIN dependencies d on v.id = d.dependent_id\n WHERE v.id = ANY($1)\n GROUP BY v.id\n ORDER BY v.date_published ASC;\n " - }, - "aaec611bae08eac41c163367dc508208178170de91165095405f1b41e47f5e7f": { - "describe": { - "columns": [ - { - "name": "count", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "TextArray" - ] - } - }, - "query": "\n SELECT COUNT(DISTINCT u.id)\n FROM users u\n INNER JOIN team_members tm on u.id = tm.user_id AND tm.accepted = TRUE\n INNER JOIN mods m on tm.team_id = m.team_id AND m.status = ANY($1)\n " - }, - "aaec67a66b58dec36339c14000b319aed1b0ebb1324fc85e34d14c6430c26657": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int4" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Text", - "Int4" - ] - } - }, - "query": "\n SELECT id FROM categories\n WHERE category = $1 AND project_type = $2\n " - }, - "abf790170e3a807ffe8b3a188da620c89e6398f38ff066220fdadffe8e7481c1": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "\n SELECT EXISTS(SELECT 1 FROM mods WHERE slug = LOWER($1))\n " - }, - "acbafe265c4b7a1c95b0494a0a03c8bd2cd778ae561ef5a662fa931ca26cf603": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM mods_donations\n WHERE joining_mod_id = $1\n " - }, - "ad27195af9964c34803343c22abcb9aa6b52f2d1a370550ed4fb68bce2297e71": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT EXISTS(SELECT 1 FROM pats WHERE id=$1)" - }, - "ae1686b8b566dd7ecc57c653c9313a4b324a2ec3a63aa6a44ed1d8ea7999b115": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [] - } - }, - "query": "\n DELETE FROM dependencies WHERE mod_dependency_id = NULL AND dependency_id = NULL AND dependency_file_name = NULL\n " - }, - "ae99bfaea7f127d24b714302c9b1d6894d06485b3c62a8921e6e82086a425ad4": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM mod_follows\n WHERE mod_id = $1\n " - }, - "b0c29c51bd3ae5b93d487471a98ee9bbb43a4df468ba781852b137dd315b9608": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8", - "Jsonb", - "Int8" - ] - } - }, - "query": "\n INSERT INTO threads_messages (\n id, author_id, body, thread_id\n )\n VALUES (\n $1, $2, $3, $4\n )\n " - }, - "b1e77dbaf4b190ab361f4fa203c442e5905cef6c1a135011a59ebd6e2dc0a92a": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Numeric", - "Int8" - ] - } - }, - "query": "\n UPDATE users\n SET balance = balance - $1\n WHERE id = $2\n " - }, - "b297c97cd18785279cee369a1a269326ade765652ccf87405e6ee7dd3cbdaabf": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE pats\n SET name = $1\n WHERE id = $2\n " - }, - "b3345991457853c3f4c49dd68239bb23c3502d5c46008eb1b50233546a6ffa5d": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n UPDATE payouts_values\n SET mod_id = NULL\n WHERE (mod_id = $1)\n " - }, - "b36877d60945eaae76680770a5d28d2cbb26cfbb0ec94ecc8f0741f48178ec1c": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8", - "Varchar", - "Varchar", - "Varchar", - "Timestamptz", - "Int4", - "Varchar", - "Varchar", - "Varchar", - "Varchar", - "Varchar", - "Varchar", - "Varchar", - "Int4", - "Int4", - "Varchar", - "Varchar", - "Text", - "Int4", - "Int4", - "Varchar" - ] - } - }, - "query": "\n INSERT INTO mods (\n id, team_id, title, description, body,\n published, downloads, icon_url, issues_url,\n source_url, wiki_url, status, requested_status, discord_url,\n client_side, server_side, license_url, license,\n slug, project_type, color, monetization_status\n )\n VALUES (\n $1, $2, $3, $4, $5,\n $6, $7, $8, $9,\n $10, $11, $12, $13, $14,\n $15, $16, $17, $18,\n LOWER($19), $20, $21, $22\n )\n " - }, - "b768d9db6c785d6a701324ea746794d33e94121403163a774b6ef775640fd3d3": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "user_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "payouts_split", - "ordinal": 2, - "type_info": "Numeric" - } - ], - "nullable": [ - false, - false, - false - ], - "parameters": { - "Left": [ - "Int8Array", - "Text" - ] - } - }, - "query": "\n SELECT m.id id, tm.user_id user_id, tm.payouts_split payouts_split\n FROM mods m\n INNER JOIN team_members tm on m.team_id = tm.team_id AND tm.accepted = TRUE\n WHERE m.id = ANY($1) AND m.monetization_status = $2\n " - }, - "b903ac4e686ef85ba28d698c668da07860e7f276b261d8f2cebb74e73b094970": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM hashes\n WHERE EXISTS(\n SELECT 1 FROM files WHERE\n (files.version_id = $1) AND\n (hashes.file_id = files.id)\n )\n " - }, - "b9399840dbbf807a03d69b7fcb3bd479ef20920ab1e3c91706a1c2c7089f48e7": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n INSERT INTO teams (id)\n VALUES ($1)\n " - }, - "b96ab39ab9624bfcdc8675107544307af9892504c4cbc40e4e7c40a1e4e83e14": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int4", - "Int8" - ] - } - }, - "query": "\n INSERT INTO game_versions_versions (game_version_id, joining_version_id)\n VALUES ($1, $2)\n " - }, - "b971cecafab7046c5952447fd78a6e45856841256d812ce9ae3c07f903c5cc62": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "\n UPDATE mods\n SET status = requested_status\n WHERE status = $1 AND approved < CURRENT_DATE AND requested_status IS NOT NULL\n " - }, - "b99e906aa6ca18b9f3f111eae7bf0d360f42385ca99228a844387bf9456a6a31": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM reports WHERE id = $1\n " - }, - "ba2e730788fb7441a7f01f414eb79b6e73046af4123ac1756442eeb1a4f0f869": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8Array" - ] - } - }, - "query": "\n DELETE FROM notifications_actions\n WHERE notification_id = ANY($1)\n " - }, - "bad7cae347771e801976c26f2afaf33bda371051923b8f74a2f32a0ef5c65e57": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET discord_url = $1\n WHERE (id = $2)\n " - }, - "bc91841f9672608a28bd45a862919f2bd34fac0b3479e3b4b67a9f6bea2a562a": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET issues_url = $1\n WHERE (id = $2)\n " - }, - "bd0d1da185dc7d21ccbbfde86fc093ce9eda7dd7e07f7a53882d427010fd58ca": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM dependencies WHERE dependent_id = $1\n " - }, - "bee1abe8313d17a56d93b06a31240e338c3973bc7a7374799ced3df5e38d3134": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM game_versions_versions gvv\n WHERE gvv.joining_version_id = $1\n " - }, - "bf7f721664f5e0ed41adc41b5483037256635f28ff6c4e5d3cbcec4387f9c8ef": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT EXISTS(SELECT 1 FROM users WHERE id=$1)" - }, - "c100a3be0e1b7bf449576c4052d87494979cb89d194805a5ce9e928eef796ae9": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET license_url = $1\n WHERE (id = $2)\n " - }, - "c1a3f6dcef6110d6ea884670fb82bac14b98e922bb5673c048ccce7b7300539b": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n SELECT EXISTS(SELECT 1 FROM reports WHERE id = $1)\n " - }, - "c1fddbf97350871b79cb0c235b1f7488c6616b7c1dfbde76a712fd57e91ba158": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int4" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "\n SELECT id FROM game_versions\n WHERE version = $1\n " - }, - "c2564faa5f5a7d8aa485f4becde16ebf54d16f2dc41a70471e3b4fc896f11fd1": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE versions\n SET version_type = $1\n WHERE (id = $2)\n " - }, - "c3391aed338110205a170ba3032e54be0f2b753b5550d87d7b5ba3e17a57a202": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM reports\n WHERE mod_id = $1\n " - }, - "c3397fe8a9435d8c64283c8ae780a58b9f98e8c97c30e57d9c703619a6180917": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM teams\n WHERE id = $1\n " - }, - "c3f594d8d0ffcf5df1b36759cf3088bfaec496c5dfdbf496d3b05f0b122a5d0c": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int4", - "Int8", - "Int8", - "Int8", - "Varchar", - "Int8" - ] - } - }, - "query": "\n INSERT INTO reports (\n id, report_type_id, mod_id, version_id, user_id,\n body, reporter\n )\n VALUES (\n $1, $2, $3, $4, $5,\n $6, $7\n )\n " - }, - "c44e260a1f7712b14ac521fd301fea1b3f92238da62aeaf819997aecc365be43": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8", - "Text", - "Int8" - ] - } - }, - "query": "SELECT id FROM versions WHERE mod_id = $1 AND (version_number = $2 OR id = $3) ORDER BY date_published ASC" - }, - "c49cda8215982b699d7aee14614763c9b5b997489581293fc2ae3604697867fe": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "user_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "title", - "ordinal": 2, - "type_info": "Varchar" - }, - { - "name": "text", - "ordinal": 3, - "type_info": "Varchar" - }, - { - "name": "link", - "ordinal": 4, - "type_info": "Varchar" - }, - { - "name": "created", - "ordinal": 5, - "type_info": "Timestamptz" - }, - { - "name": "read", - "ordinal": 6, - "type_info": "Bool" - }, - { - "name": "notification_type", - "ordinal": 7, - "type_info": "Varchar" - }, - { - "name": "body", - "ordinal": 8, - "type_info": "Jsonb" - }, - { - "name": "actions", - "ordinal": 9, - "type_info": "Jsonb" - } - ], - "nullable": [ - false, - false, - true, - true, - true, - false, - false, - true, - true, - null - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n SELECT n.id, n.user_id, n.title, n.text, n.link, n.created, n.read, n.type notification_type, n.body,\n JSONB_AGG(DISTINCT jsonb_build_object('id', na.id, 'notification_id', na.notification_id, 'title', na.title, 'action_route_method', na.action_route_method, 'action_route', na.action_route)) filter (where na.id is not null) actions\n FROM notifications n\n LEFT OUTER JOIN notifications_actions na on n.id = na.notification_id\n WHERE n.user_id = $1\n GROUP BY n.id, n.user_id;\n " - }, - "c545a74e902c5c63bca1057b76e94b9547ee21fadbc61964f45837915d5f4608": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int4", - "Varchar" - ] - } - }, - "query": "\n INSERT INTO mods_donations (\n joining_mod_id, joining_platform_id, url\n )\n VALUES (\n $1, $2, $3\n )\n " - }, - "c55d2132e3e6e92dd50457affab758623dca175dc27a2d3cd4aace9cfdecf789": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "\n INSERT INTO mod_follows (follower_id, mod_id)\n VALUES ($1, $2)\n " - }, - "c56dd77e35bf5372cd35ca981d248738b55f39d74428ed7d0c5ca2957a656eb6": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "SELECT id FROM users WHERE microsoft_id = $1" - }, - "c5d44333c62223bd3e68185d1fb3f95152fafec593da8d06c9b2b665218a02be": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int4", - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET client_side = $1\n WHERE (id = $2)\n " - }, - "c8a27a122160a0896914c786deef9e8193eb240501d30d5ffb4129e2103efd3d": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "\n UPDATE versions\n SET status = requested_status\n WHERE status = $1 AND date_published < CURRENT_DATE AND requested_status IS NOT NULL\n " - }, - "c8fde56e5d03eda085519b4407768de7ddf48cae18ce7138a97e8e8fba967e15": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8Array", - "Int8" - ] - } - }, - "query": "\n SELECT id FROM reports\n WHERE id = ANY($1) AND reporter = $2\n " - }, - "c94faba99d486b11509fff59465b7cc71983551b035e936ce4d9776510afb514": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "user_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "session", - "ordinal": 2, - "type_info": "Varchar" - }, - { - "name": "created", - "ordinal": 3, - "type_info": "Timestamptz" - }, - { - "name": "last_login", - "ordinal": 4, - "type_info": "Timestamptz" - }, - { - "name": "expires", - "ordinal": 5, - "type_info": "Timestamptz" - }, - { - "name": "refresh_expires", - "ordinal": 6, - "type_info": "Timestamptz" - }, - { - "name": "os", - "ordinal": 7, - "type_info": "Varchar" - }, - { - "name": "platform", - "ordinal": 8, - "type_info": "Varchar" - }, - { - "name": "city", - "ordinal": 9, - "type_info": "Varchar" - }, - { - "name": "country", - "ordinal": 10, - "type_info": "Varchar" - }, - { - "name": "ip", - "ordinal": 11, - "type_info": "Varchar" - }, - { - "name": "user_agent", - "ordinal": 12, - "type_info": "Varchar" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - true, - true, - true, - true, - false, - false - ], - "parameters": { - "Left": [ - "Int8Array", - "TextArray" - ] - } - }, - "query": "\n SELECT id, user_id, session, created, last_login, expires, refresh_expires, os, platform,\n city, country, ip, user_agent\n FROM sessions\n WHERE id = ANY($1) OR session = ANY($2)\n ORDER BY created DESC\n " - }, - "cb57ae673f1a7e50cc319efddb9bdc82e2251596bcf85aea52e8def343e423b8": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Varchar", - "Bytea" - ] - } - }, - "query": "\n INSERT INTO hashes (file_id, algorithm, hash)\n VALUES ($1, $2, $3)\n " - }, - "ccd913bb2f3006ffe881ce2fc4ef1e721d18fe2eed6ac62627046c955129610c": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT EXISTS(SELECT 1 FROM files WHERE id=$1)" - }, - "cdd7f8f95c308d9474e214d584c03be0466214da1e157f6bc577b76dbef7df86": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM hashes\n WHERE file_id = $1\n " - }, - "cdf20036b29b61da40bf990c9ab04c509297a4d65bc9b136c9fb20f1e97e1149": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int4" - ] - } - }, - "query": "\n INSERT INTO mods_categories (joining_mod_id, joining_category_id, is_additional)\n VALUES ($1, $2, FALSE)\n " - }, - "cef01012769dcd499a0d16ce65ffc1e94bce362a7246b6a0a38d133afb90d3b6": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8", - "Int8" - ] - } - }, - "query": "\n UPDATE team_members\n SET role = $1\n WHERE (team_id = $2 AND user_id = $3)\n " - }, - "cfcc6970c0b469c4afd37bedfd386def7980f6b7006030d4783723861d0e3a38": { - "describe": { - "columns": [ - { - "name": "version_id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "project_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "hash", - "ordinal": 2, - "type_info": "Bytea" - } - ], - "nullable": [ - false, - false, - false - ], - "parameters": { - "Left": [ - "ByteaArray" - ] - } - }, - "query": "\n SELECT v.id version_id, v.mod_id project_id, h.hash hash FROM hashes h\n INNER JOIN files f on h.file_id = f.id\n INNER JOIN versions v on f.version_id = v.id\n WHERE h.algorithm = 'sha1' AND h.hash = ANY($1)\n " - }, - "cfd80c4417c0534d24d65c782753927ba446e6ba542095c211ae5ee9b06b2753": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "\n UPDATE users\n SET gitlab_id = $2\n WHERE (id = $1)\n " - }, - "d1566672369ea22cb1f638f073f8e3fb467b354351ae71c67941323749ec9bcd": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Bytea", - "Text" - ] - } - }, - "query": "\n SELECT f.id id FROM hashes h\n INNER JOIN files f ON h.file_id = f.id\n WHERE h.algorithm = $2 AND h.hash = $1\n " - }, - "d203b99bd23d16224348e4fae44296aa0e1ea6d6a3fac26908303069b36a8dd0": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM threads_messages\n WHERE thread_id = $1\n " - }, - "d2c046d4bedeb7181ece4e94d7de90c97bd3dd1b0c16070704028923a0c2834a": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8", - "Jsonb" - ] - } - }, - "query": "\n INSERT INTO notifications (\n id, user_id, body\n )\n VALUES (\n $1, $2, $3\n )\n " - }, - "d331ca8f22da418cf654985c822ce4466824beaa00dea64cde90dc651a03024b": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET moderation_message = $1\n WHERE (id = $2)\n " - }, - "d3991923355b2e0ed7bbe6c85d9158754d7e7d28f5ac75ee5b4e782dbc5c38a9": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "\n UPDATE team_members\n SET accepted = TRUE\n WHERE (team_id = $1 AND user_id = $2)\n " - }, - "d3d1467a5dcfc3eb34d7e821b0de54a419d9a5391c13254478944f2f2cc78fe6": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Varchar", - "Varchar", - "Int8", - "Int8", - "Timestamptz" - ] - } - }, - "query": "\n INSERT INTO pats (\n id, name, access_token, scopes, user_id,\n expires\n )\n VALUES (\n $1, $2, $3, $4, $5,\n $6\n )\n " - }, - "d3f317f7d767f5188bace4064d548d3049df0d06420e3a23ebd8f326703a448e": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "\n UPDATE users\n SET discord_id = $2\n WHERE (id = $1)\n " - }, - "d59a0ca4725d40232eae8bf5735787e1b76282c390d2a8d07fb34e237a0b2132": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int4" - ] - } - }, - "query": "\n INSERT INTO mods_categories (joining_mod_id, joining_category_id, is_additional)\n VALUES ($1, $2, TRUE)\n " - }, - "d6453e50041b5521fa9e919a9162e533bb9426f8c584d98474c6ad414db715c8": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT EXISTS(SELECT 1 FROM mods WHERE id=$1)" - }, - "d75b73151ba84715c06bbada22b66c819de8eac87c088b0a501212ad3fe4d618": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Bool", - "Int8" - ] - } - }, - "query": "\n UPDATE reports\n SET closed = $1\n WHERE (id = $2)\n " - }, - "d7c65c30898110d801a5bdf092564e5726e35c1033c69dba69008989a087357c": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Numeric", - "Int8", - "Int8" - ] - } - }, - "query": "\n UPDATE team_members\n SET payouts_split = $1\n WHERE (team_id = $2 AND user_id = $3)\n " - }, - "d8020ed838c032c2c287dc0f08989b3ab7156f2571bc75505e6f57b0caeef9c7": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int4" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "\n SELECT id FROM donation_platforms\n WHERE short = $1\n " - }, - "d8b4e7e382c77a05395124d5a6a27cccb687d0e2c31b76d49b03aa364d099d42": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM files\n WHERE files.version_id = $1\n " - }, - "d93a8727fa8c7af79529670bdeab27100a2cdeeb605c85d0f30fd4962e731157": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM team_members\n WHERE team_id = $1\n " - }, - "d93ce03a186c03668d5eebab2bb4cbc4fc9dd002529e37575d94509b67908c8d": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "session", - "ordinal": 1, - "type_info": "Varchar" - }, - { - "name": "user_id", - "ordinal": 2, - "type_info": "Int8" - } - ], - "nullable": [ - false, - false, - false - ], - "parameters": { - "Left": [] - } - }, - "query": "\n SELECT id, session, user_id\n FROM sessions\n WHERE refresh_expires <= NOW()\n " - }, - "dc6aa2e7bfd5d5004620ddd4cd6a47ecc56159e1489054e0652d56df802fb5e5": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET body = $1\n WHERE (id = $2)\n " - }, - "dc83c501515b12bf1cb02a195d8bbd49a0a488626b280606b51b90bd7cecf46b": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "user_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "role", - "ordinal": 2, - "type_info": "Varchar" - }, - { - "name": "permissions", - "ordinal": 3, - "type_info": "Int8" - }, - { - "name": "accepted", - "ordinal": 4, - "type_info": "Bool" - }, - { - "name": "payouts_split", - "ordinal": 5, - "type_info": "Numeric" - }, - { - "name": "ordering", - "ordinal": 6, - "type_info": "Int8" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "\n SELECT id, user_id, role, permissions, accepted, payouts_split, ordering\n FROM team_members\n WHERE (team_id = $1 AND user_id = $2)\n " - }, - "dcc32d760692674180471e7b19a9a1f73e77bb170e92cc7d60da37596ef840b0": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM threads\n WHERE id = $1\n " - }, - "dccd2b918e3bc37aa10ff0dd475d804110d267f959a7b4f854b302e9ceba2e70": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "\n UPDATE dependencies\n SET dependency_id = NULL, mod_dependency_id = $2\n WHERE dependency_id = $1\n " - }, - "dd57a6dd89fefedbde796ef02b308ce7dba17ca0c65ffd5f9e35e296a72d4c1c": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "mod_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "file_type", - "ordinal": 2, - "type_info": "Varchar" - } - ], - "nullable": [ - false, - false, - true - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "\n SELECT v.id id, v.mod_id mod_id, file_type FROM files f\n INNER JOIN versions v ON v.id = f.version_id\n WHERE f.url = $1\n " - }, - "de1bf7e33a99a10154cefdbe3b8322e4c6a19448b6ee3c6087b1b8163bc52cb1": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "\n DELETE FROM user_backup_codes\n WHERE user_id = $1 AND code = $2\n " - }, - "debb47a2718f79684c8776da7f289b8d178c302bb5a69562b963b8d008973b8d": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "\n UPDATE threads_messages\n SET body = '{\"type\": \"deleted\"}', author_id = $2\n WHERE author_id = $1\n " - }, - "df871bd959ba97f105ac575f34d8d2a39cbc44a07e0339750a0e477e6fd582ed": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8", - "Int8", - "Varchar", - "Varchar", - "Varchar", - "Timestamptz", - "Int4", - "Varchar", - "Bool", - "Varchar" - ] - } - }, - "query": "\n INSERT INTO versions (\n id, mod_id, author_id, name, version_number,\n changelog, date_published, downloads,\n version_type, featured, status\n )\n VALUES (\n $1, $2, $3, $4, $5,\n $6, $7, $8,\n $9, $10, $11\n )\n " - }, - "e3235e872f98eb85d3eb4a2518fb9dc88049ce62362bfd02623e9b49ac2e9fed": { - "describe": { - "columns": [ - { - "name": "name", - "ordinal": 0, - "type_info": "Varchar" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [] - } - }, - "query": "\n SELECT name FROM report_types\n " - }, - "e37ecb6dc1509d390bb6f68ba25899d19f693554d8969bbf8f8ee14a78adf0f9": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Bool", - "Int8" - ] - } - }, - "query": "\n UPDATE threads\n SET show_in_mod_inbox = $1\n WHERE id = $2\n " - }, - "e3cc1fd070b97c4cc36bdb2f33080d4e0d7f3c3d81312d9d28a8c3c8213ad54b": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM files\n WHERE files.id = $1\n " - }, - "e3fb74a94a6a78b1007dd99ad11bdcfaa0957ed7d1683997aef7301e0f15baba": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET issues_url = $1\n WHERE (id = $2)\n " - }, - "e48c85a2b2e11691afae3799aa126bdd8b7338a973308bbab2760c18bb9cb0b7": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Bool", - "Int8" - ] - } - }, - "query": "\n UPDATE versions\n SET featured = $1\n WHERE (id = $2)\n " - }, - "e5adaf219c52ec828b72bd89c6b86a475f73181abf180a024dfe05f918e58edb": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "amount", - "ordinal": 1, - "type_info": "Numeric" - }, - { - "name": "user_id", - "ordinal": 2, - "type_info": "Int8" - }, - { - "name": "status", - "ordinal": 3, - "type_info": "Varchar" - } - ], - "nullable": [ - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "SELECT id, amount, user_id, status FROM historical_payouts WHERE payment_id = $1" - }, - "e6f5a150cbd3bd6b9bde9e5cdad224a45c96d678b69ec12508e81246710e3f6d": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "name", - "ordinal": 1, - "type_info": "Varchar" - }, - { - "name": "access_token", - "ordinal": 2, - "type_info": "Varchar" - }, - { - "name": "scopes", - "ordinal": 3, - "type_info": "Int8" - }, - { - "name": "user_id", - "ordinal": 4, - "type_info": "Int8" - }, - { - "name": "created", - "ordinal": 5, - "type_info": "Timestamptz" - }, - { - "name": "expires", - "ordinal": 6, - "type_info": "Timestamptz" - }, - { - "name": "last_used", - "ordinal": 7, - "type_info": "Timestamptz" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - true - ], - "parameters": { - "Left": [ - "Int8Array", - "TextArray" - ] - } - }, - "query": "\n SELECT id, name, access_token, scopes, user_id, created, expires, last_used\n FROM pats\n WHERE id = ANY($1) OR access_token = ANY($2)\n ORDER BY created DESC\n " - }, - "e7d0a64a08df6783c942f2fcadd94dd45f8d96ad3d3736e52ce90f68d396cdab": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT EXISTS(SELECT 1 FROM team_members WHERE id=$1)" - }, - "e8d4589132b094df1e7a3ca0440344fc8013c0d20b3c71a1142ccbee91fb3c70": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT EXISTS(SELECT 1 FROM teams WHERE id=$1)" - }, - "e925b15ec46f0263c7775ba1ba00ed11cfd6749fa792d4eabed73b619f230585": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET status = $1\n WHERE (id = $2)\n " - }, - "e9d863c1793939d5ae7137d810f23d06460c28a9058b251448e3786c436f80cd": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [] - } - }, - "query": "\n SELECT id\n FROM threads\n WHERE show_in_mod_inbox = TRUE\n " - }, - "ea1525cbe7460d0d9e9da8f448c661f7209bc1a7a04e2ea0026fa69c3f550a14": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n SELECT tm.user_id id\n FROM team_members tm\n WHERE tm.team_id = $1 AND tm.accepted\n " - }, - "ed1d5d9433bc7f4a360431ecfdd9430c5e58cd6d1c623c187d8661200400b1a4": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET moderation_message_body = $1\n WHERE (id = $2)\n " - }, - "ed3e866634135d4f4c8a513eae2856ad71212f6eec09bb4ccef1506912a3a44c": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n UPDATE mods\n SET follows = follows + 1\n WHERE id = $1\n " - }, - "ed47f363296ef7f8b3a8bedfd8108ca692811be1b9dce4a89ad151a6932e44c5": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n SELECT id\n FROM sessions\n WHERE user_id = $1\n ORDER BY created DESC\n " - }, - "ee2bca5618c3974147a4541bac1b2d8ca2c4a930769c11e10f6a97e3cac6ee2e": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT id FROM users WHERE discord_id = $1" - }, - "eec6d4028d790e57a4d97fc5a200a9ae2b3d2cb60ee83c51fb05180b821558f5": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "\n UPDATE pats\n SET scopes = $1\n WHERE id = $2\n " - }, - "ef59f99fc0ab66ff5779d0e71c4a2134e2f26eed002ff9ea5626ea3e23518594": { - "describe": { - "columns": [ - { - "name": "name", - "ordinal": 0, - "type_info": "Varchar" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n SELECT name FROM project_types pt\n INNER JOIN mods ON mods.project_type = pt.id\n WHERE mods.id = $1\n " - }, - "f141cc6711123b4fe5a5d9a7337a0b009b80e5d8fbda664b8d62b1a3f38eb936": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Numeric", - "Int8" - ] - } - }, - "query": "\n UPDATE users\n SET balance = balance + $1\n WHERE id = $2\n " - }, - "f1525930830e17b5ee8feb796d9950dd3741131965f050840fa75423b5a54f01": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Varchar", - "Int8", - "Varchar", - "Varchar", - "Varchar", - "Varchar", - "Varchar", - "Varchar" - ] - } - }, - "query": "\n INSERT INTO sessions (\n id, session, user_id, os, platform,\n city, country, ip, user_agent\n )\n VALUES (\n $1, $2, $3, $4, $5,\n $6, $7, $8, $9\n )\n " - }, - "f17a109913015a7a5ab847bb2e73794d6261a08d450de24b450222755e520881": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "\n SELECT id FROM reports\n WHERE closed = FALSE AND reporter = $1\n ORDER BY created ASC\n LIMIT $2;\n " - }, - "f34bbe639ad21801258dc8beaab9877229a451761be07f85a1dd04d027832329": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n SELECT EXISTS(SELECT 1 FROM mods WHERE id=$1)\n " - }, - "f3d7eb1b62f0b978787dba1132308d070d28911d6ddc380cedfa16e7baa3243a": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "version_number", - "ordinal": 1, - "type_info": "Varchar" - }, - { - "name": "version_type", - "ordinal": 2, - "type_info": "Varchar" - } - ], - "nullable": [ - false, - false, - false - ], - "parameters": { - "Left": [ - "Int8", - "TextArray" - ] - } - }, - "query": "\n SELECT id, version_number, version_type\n FROM versions\n WHERE mod_id = $1 AND status = ANY($2)\n ORDER BY date_published ASC\n " - }, - "f453b43772c4d2d9d09dc389eb95482cc75e7f0eaf9dc7ff48cf40f22f1497cc": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Int8" - ] - } - }, - "query": "\n UPDATE users\n SET bio = $1\n WHERE (id = $2)\n " - }, - "f793e96499ff35f8dc2e420484c2a0cdb54f25ffa27caa081691779ab896a709": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n DELETE FROM mods\n WHERE id = $1\n " - }, - "f85fc13148aafc03a4df68eaa389945e9dc6472a759525a48cfb23d31181535c": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT EXISTS(SELECT 1 FROM threads_messages WHERE id=$1)" - }, - "f8be3053274b00ee9743e798886696062009c5f681baaf29dfc24cfbbda93742": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Text" - ] - } - }, - "query": "\n SELECT EXISTS(SELECT 1 FROM mods WHERE slug = LOWER($1))\n " - }, - "f9bc19beaa70db45b058e80ba86599d393fad4c7d4af98426a8a9d9ca9b24035": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "\n UPDATE users\n SET steam_id = $2\n WHERE (id = $1)\n " - }, - "fa1b92b15cc108fa046998f789c8b259e0226e7dac16c635927ca74abc78cea9": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "SELECT EXISTS(SELECT 1 FROM mods m INNER JOIN team_members tm ON tm.team_id = m.team_id AND user_id = $2 WHERE m.id = $1)" - }, - "fa45b0e9d3e281d15e6283fe0e154254112df02e26778d7a01d09da2cd26e4bd": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "team_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "user_id", - "ordinal": 2, - "type_info": "Int8" - }, - { - "name": "role", - "ordinal": 3, - "type_info": "Varchar" - }, - { - "name": "permissions", - "ordinal": 4, - "type_info": "Int8" - }, - { - "name": "accepted", - "ordinal": 5, - "type_info": "Bool" - }, - { - "name": "payouts_split", - "ordinal": 6, - "type_info": "Numeric" - }, - { - "name": "ordering", - "ordinal": 7, - "type_info": "Int8" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Int8Array", - "Int8" - ] - } - }, - "query": "\n SELECT id, team_id, user_id, role, permissions, accepted, payouts_split, ordering\n FROM team_members\n WHERE (team_id = ANY($1) AND user_id = $2 AND accepted = TRUE)\n ORDER BY ordering\n " - }, - "faec0a606ccaeb3f21c81e60a1749640b929e97db40252118fb72610df64a457": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "name", - "ordinal": 1, - "type_info": "Varchar" - }, - { - "name": "email", - "ordinal": 2, - "type_info": "Varchar" - }, - { - "name": "avatar_url", - "ordinal": 3, - "type_info": "Varchar" - }, - { - "name": "username", - "ordinal": 4, - "type_info": "Varchar" - }, - { - "name": "bio", - "ordinal": 5, - "type_info": "Varchar" - }, - { - "name": "created", - "ordinal": 6, - "type_info": "Timestamptz" - }, - { - "name": "role", - "ordinal": 7, - "type_info": "Varchar" - }, - { - "name": "badges", - "ordinal": 8, - "type_info": "Int8" - }, - { - "name": "balance", - "ordinal": 9, - "type_info": "Numeric" - }, - { - "name": "github_id", - "ordinal": 10, - "type_info": "Int8" - }, - { - "name": "discord_id", - "ordinal": 11, - "type_info": "Int8" - }, - { - "name": "gitlab_id", - "ordinal": 12, - "type_info": "Int8" - }, - { - "name": "google_id", - "ordinal": 13, - "type_info": "Varchar" - }, - { - "name": "steam_id", - "ordinal": 14, - "type_info": "Int8" - }, - { - "name": "microsoft_id", - "ordinal": 15, - "type_info": "Varchar" - }, - { - "name": "email_verified", - "ordinal": 16, - "type_info": "Bool" - }, - { - "name": "password", - "ordinal": 17, - "type_info": "Text" - }, - { - "name": "totp_secret", - "ordinal": 18, - "type_info": "Varchar" - }, - { - "name": "trolley_id", - "ordinal": 19, - "type_info": "Text" - }, - { - "name": "trolley_account_status", - "ordinal": 20, - "type_info": "Text" - } - ], - "nullable": [ - false, - true, - true, - true, - false, - true, - false, - false, - false, - false, - true, - true, - true, - true, - true, - true, - false, - true, - true, - true, - true - ], - "parameters": { - "Left": [ - "Int8Array", - "TextArray" - ] - } - }, - "query": "\n SELECT id, name, email,\n avatar_url, username, bio,\n created, role, badges,\n balance,\n github_id, discord_id, gitlab_id, google_id, steam_id, microsoft_id,\n email_verified, password, totp_secret, trolley_id, trolley_account_status\n FROM users\n WHERE id = ANY($1) OR LOWER(username) = ANY($2)\n " - }, - "fb955ca41b95120f66c98c0b528b1db10c4be4a55e9641bb104d772e390c9bb7": { - "describe": { - "columns": [ - { - "name": "exists", - "ordinal": 0, - "type_info": "Bool" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT EXISTS(SELECT 1 FROM notifications WHERE id=$1)" - }, - "fcd15905507769ab7f9839d64d1be3ee3f61cd555aee57dace76f8e53e91d344": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int4" - ] - } - }, - "query": "\n INSERT INTO mods_categories (joining_mod_id, joining_category_id, is_additional)\n VALUES ($1, $2, TRUE)\n " - }, - "fce67ce3d0c27c64af85fb7d36661513bc5ea2e96fcf12f3a51c97999b01b83c": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "user_id", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "title", - "ordinal": 2, - "type_info": "Varchar" - }, - { - "name": "text", - "ordinal": 3, - "type_info": "Varchar" - }, - { - "name": "link", - "ordinal": 4, - "type_info": "Varchar" - }, - { - "name": "created", - "ordinal": 5, - "type_info": "Timestamptz" - }, - { - "name": "read", - "ordinal": 6, - "type_info": "Bool" - }, - { - "name": "notification_type", - "ordinal": 7, - "type_info": "Varchar" - }, - { - "name": "body", - "ordinal": 8, - "type_info": "Jsonb" - }, - { - "name": "actions", - "ordinal": 9, - "type_info": "Jsonb" - } - ], - "nullable": [ - false, - false, - true, - true, - true, - false, - false, - true, - true, - null - ], - "parameters": { - "Left": [ - "Int8Array" - ] - } - }, - "query": "\n SELECT n.id, n.user_id, n.title, n.text, n.link, n.created, n.read, n.type notification_type, n.body,\n JSONB_AGG(DISTINCT jsonb_build_object('id', na.id, 'notification_id', na.notification_id, 'title', na.title, 'action_route_method', na.action_route_method, 'action_route', na.action_route)) filter (where na.id is not null) actions\n FROM notifications n\n LEFT OUTER JOIN notifications_actions na on n.id = na.notification_id\n WHERE n.id = ANY($1)\n GROUP BY n.id, n.user_id\n ORDER BY n.created DESC;\n " - }, - "fdfe36dcb85347a3a8228b5d5fc2d017b9baa307b5ae0ae9deaafab9dcdcb74a": { - "describe": { - "columns": [ - { - "name": "follower_id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n SELECT follower_id FROM mod_follows\n WHERE mod_id = $1\n " - } -} \ No newline at end of file diff --git a/src/auth/checks.rs b/src/auth/checks.rs index 98a67541..b358494c 100644 --- a/src/auth/checks.rs +++ b/src/auth/checks.rs @@ -1,6 +1,7 @@ use crate::database; use crate::database::models::project_item::QueryProject; use crate::database::models::version_item::QueryVersion; +use crate::database::models::Collection; use crate::database::{models, Project, Version}; use crate::models::users::User; use crate::routes::ApiError; @@ -30,7 +31,26 @@ pub async fn is_authorized( .await? .exists; - authorized = project_exists.unwrap_or(false); + let organization_exists = + if let Some(organization_id) = project_data.organization_id { + sqlx::query!( + "SELECT EXISTS( + SELECT 1 + FROM organizations o JOIN team_members tm ON tm.team_id = o.team_id + WHERE o.id = $1 AND tm.user_id = $2 + )", + organization_id as database::models::ids::OrganizationId, + user_id as database::models::ids::UserId, + ) + .fetch_one(&***pool) + .await? + .exists + } else { + None + }; + + authorized = + project_exists.unwrap_or(false) || organization_exists.unwrap_or(false); } } } @@ -69,12 +89,17 @@ pub async fn filter_authorized_projects( " SELECT m.id id, m.team_id team_id FROM team_members tm INNER JOIN mods m ON m.team_id = tm.team_id - WHERE tm.team_id = ANY($1) AND tm.user_id = $2 + LEFT JOIN organizations o ON o.team_id = tm.team_id + WHERE (tm.team_id = ANY($1) or o.id = ANY($2)) AND tm.user_id = $3 ", &check_projects .iter() .map(|x| x.inner.team_id.0) .collect::>(), + &check_projects + .iter() + .filter_map(|x| x.inner.organization_id.map(|x| x.0)) + .collect::>(), user_id as database::models::ids::UserId, ) .fetch_many(&***pool) @@ -192,3 +217,76 @@ pub async fn filter_authorized_versions( Ok(return_versions) } + +pub async fn is_authorized_collection( + collection_data: &Collection, + user_option: &Option, +) -> Result { + let mut authorized = !collection_data.status.is_hidden(); + + if let Some(user) = &user_option { + if !authorized && (user.role.is_mod() || user.id == collection_data.user_id.into()) { + authorized = true; + } + } + + Ok(authorized) +} + +pub async fn filter_authorized_collections( + collections: Vec, + user_option: &Option, + pool: &web::Data, +) -> Result, ApiError> { + let mut return_collections = Vec::new(); + let mut check_collections = Vec::new(); + + for collection in collections { + if !collection.status.is_hidden() + || user_option + .as_ref() + .map(|x| x.role.is_mod()) + .unwrap_or(false) + { + return_collections.push(collection.into()); + } else if user_option.is_some() { + check_collections.push(collection); + } + } + + if !check_collections.is_empty() { + if let Some(user) = user_option { + let user_id: models::ids::UserId = user.id.into(); + + use futures::TryStreamExt; + + sqlx::query!( + " + SELECT c.id id, c.user_id user_id FROM collections c + WHERE c.user_id = $2 AND c.id = ANY($1) + ", + &check_collections.iter().map(|x| x.id.0).collect::>(), + user_id as database::models::ids::UserId, + ) + .fetch_many(&***pool) + .try_for_each(|e| { + if let Some(row) = e.right() { + check_collections.retain(|x| { + let bool = x.id.0 == row.id && x.user_id.0 == row.user_id; + + if bool { + return_collections.push(x.clone().into()); + } + + !bool + }); + } + + futures::future::ready(Ok(())) + }) + .await?; + } + } + + Ok(return_collections) +} diff --git a/src/auth/email/auth_notif.html b/src/auth/email/auth_notif.html index 9519dcd4..e367b2c8 100644 --- a/src/auth/email/auth_notif.html +++ b/src/auth/email/auth_notif.html @@ -113,14 +113,14 @@
-
Discord +
Discord
-
Twitter +
Twitter