Skip to content

Commit 1dc38f5

Browse files
authored
Merge pull request #39 from constructive-io/fix/use-where-not-condition
fix(send-email-link): use 'where' filter instead of 'condition'
2 parents 4acf8e3 + 5fd6f50 commit 1dc38f5

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

functions/send-email-link/handler.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,18 @@ import { send as sendPostmaster } from '@constructive-io/postmaster';
66
import { send as sendSmtp } from 'simple-smtp-server';
77
import { parseEnvBoolean } from '@pgpmjs/env';
88

9-
// Use plural connections with `condition` filter rather than singular-by-PK
10-
// (`user(id:)`, `database(id:)`). The constructive server's preset extends
11-
// NoUniqueLookupPreset, which deliberately disables singular root-field
12-
// lookups by unique constraint (including primary key) to keep the API
13-
// surface small. The plural+condition form is the supported way to fetch
14-
// a row by id.
9+
// Use plural connections with the `where` filter (graphile-connection-filter)
10+
// rather than `condition:` or singular-by-PK. The constructive server's
11+
// ConstructivePreset:
12+
// 1. Extends NoUniqueLookupPreset — disables singular root-field lookups
13+
// by unique constraint, including primary key (`database(id:)`,
14+
// `user(id:)`).
15+
// 2. Disables `PgConditionArgumentPlugin` — removes the built-in
16+
// `condition:` argument on connections.
17+
// The supported pattern is `where: { field: { equalTo: var } }`.
1518
const GetUser = gql`
1619
query GetUser($userId: UUID!) {
17-
users(condition: { id: $userId }, first: 1) {
20+
users(where: { id: { equalTo: $userId } }, first: 1) {
1821
nodes {
1922
username
2023
displayName
@@ -26,7 +29,7 @@ const GetUser = gql`
2629

2730
const GetDatabaseInfo = gql`
2831
query GetDatabaseInfo($databaseId: UUID!) {
29-
databases(condition: { id: $databaseId }, first: 1) {
32+
databases(where: { id: { equalTo: $databaseId } }, first: 1) {
3033
nodes {
3134
sites {
3235
nodes {
@@ -43,7 +46,7 @@ const GetDatabaseInfo = gql`
4346
theme
4447
}
4548
}
46-
siteModules(condition: { name: "legal_terms_module" }) {
49+
siteModules(where: { name: { equalTo: "legal_terms_module" } }) {
4750
nodes {
4851
data
4952
}

0 commit comments

Comments
 (0)