Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Drop adminClient (1/2) #2356

Merged
merged 10 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions api.planx.uk/saveAndReturn/validateSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type {
PublishedFlow,
Node,
} from "../types";
import { $api, getClient } from "../client";
import { $api } from "../client";

export interface ValidationResponse {
message: string;
Expand Down Expand Up @@ -208,10 +208,9 @@ async function diffLatestPublishedFlow({
flowId: string;
since: string;
}): Promise<PublishedFlow["data"] | null> {
const { client: $client } = getClient();
const response: {
diff_latest_published_flow: { data: PublishedFlow["data"] | null };
} = await $client.request(
} = await $api.client.request(
gql`
query GetFlowDiff($flowId: uuid!, $since: timestamptz!) {
diff_latest_published_flow(
Expand Down
10 changes: 10 additions & 0 deletions hasura.planx.uk/metadata/tables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,16 @@
- message
- session_id
- created_at
select_permissions:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was required to give the API role access to the insert_reconciliation_requests_one mutation.

insert_<object>_one will only be available if you have select permissions on the table, as it returns the inserted row

Docs: https://hasura.io/docs/latest/mutations/postgres/insert/#insert-a-single-object

- role: api
permission:
columns:
- id
- response
- message
- session_id
- created_at
filter: {}
delete_permissions:
- role: api
permission:
Expand Down
5 changes: 3 additions & 2 deletions hasura.planx.uk/tests/reconciliation_requests.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ describe("reconciliation_requests", () => {
i = await introspectAs("api");
});

test("cannot query reconciliation_requests", () => {
expect(i.queries).not.toContain("reconciliation_requests");
test("can query reconciliation_requests", () => {
expect(i.queries).toContain("reconciliation_requests");
});

test("cannot update reconciliation_requests", () => {
Expand All @@ -83,6 +83,7 @@ describe("reconciliation_requests", () => {

test("can insert reconciliation requests", () => {
expect(i.mutations).toContain("insert_reconciliation_requests");
expect(i.mutations).toContain("insert_reconciliation_requests_one");
});
});
});