-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add an audit table for applications submitted via S3 and Power …
…Automate (#3397)
- Loading branch information
1 parent
17f966d
commit be4bb9d
Showing
6 changed files
with
195 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
hasura.planx.uk/migrations/1720597665798_create_table_s3_applications/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DROP TABLE "public.s3_applications" CASCADE; |
11 changes: 11 additions & 0 deletions
11
hasura.planx.uk/migrations/1720597665798_create_table_s3_applications/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
CREATE TABLE "public"."s3_applications" ( | ||
"id" serial NOT NULL, | ||
"session_id" text NOT NULL, | ||
"team_slug" text NOT NULL, | ||
"webhook_request" JSONB NOT NULL, | ||
"webhook_response" JSONB NOT NULL, | ||
"created_at" timestamptz NOT NULL DEFAULT now(), | ||
PRIMARY KEY ("id") | ||
); | ||
|
||
COMMENT ON TABLE "public"."s3_applications" IS 'Stores a receipt of applications submitted using the Upload to AWS S3 method with notifications via Power Automate webhook'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
const { introspectAs } = require("./utils"); | ||
|
||
describe("s3_applications", () => { | ||
describe("public", () => { | ||
let i; | ||
beforeAll(async () => { | ||
i = await introspectAs("public"); | ||
}); | ||
|
||
test("cannot query s3 applications", () => { | ||
expect(i.queries).not.toContain("s3_applications"); | ||
}); | ||
|
||
test("cannot create, update, or delete s3 applications", () => { | ||
expect(i).toHaveNoMutationsFor("s3_applications"); | ||
}); | ||
}); | ||
|
||
describe("admin", () => { | ||
let i; | ||
beforeAll(async () => { | ||
i = await introspectAs("admin"); | ||
}); | ||
|
||
test("has full access to query and mutate s3 applications", () => { | ||
expect(i.queries).toContain("s3_applications"); | ||
expect(i.mutations).toContain("insert_s3_applications"); | ||
expect(i.mutations).toContain("update_s3_applications_by_pk"); | ||
expect(i.mutations).toContain("delete_s3_applications"); | ||
}); | ||
}); | ||
|
||
describe("platformAdmin", () => { | ||
let i; | ||
beforeAll(async () => { | ||
i = await introspectAs("platformAdmin"); | ||
}); | ||
|
||
test("cannot query s3_applications", () => { | ||
expect(i.queries).not.toContain("s3_applications"); | ||
}); | ||
|
||
test("cannot create, update, or delete s3_applications", () => { | ||
expect(i).toHaveNoMutationsFor("s3_applications"); | ||
}); | ||
}); | ||
|
||
describe("teamEditor", () => { | ||
let i; | ||
beforeAll(async () => { | ||
i = await introspectAs("teamEditor"); | ||
}); | ||
|
||
test("cannot query s3_applications", () => { | ||
expect(i.queries).not.toContain("s3_applications"); | ||
}); | ||
|
||
test("cannot create, update, or delete s3_applications", () => { | ||
expect(i).toHaveNoMutationsFor("s3_applications"); | ||
}); | ||
}); | ||
|
||
describe("api", () => { | ||
let i; | ||
beforeAll(async () => { | ||
i = await introspectAs("api"); | ||
}); | ||
|
||
test("can query and mutate s3 applications", () => { | ||
expect(i.queries).toContain("s3_applications"); | ||
expect(i.mutations).toContain("insert_s3_applications"); | ||
expect(i.mutations).toContain("update_s3_applications_by_pk"); | ||
}); | ||
|
||
test("cannot delete s3 applications", () => { | ||
expect(i.mutations).not.toContain("delete_s3_applications"); | ||
}); | ||
}); | ||
}); |