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

[feature] Added tasks root level query #361

Merged
merged 3 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions implants/lib/tavern/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1070,6 +1070,7 @@ type Mutation {
extend type Query {
files(where: FileWhereInput): [File!]! @requireRole(role: USER)
quests(where: QuestWhereInput): [Quest!]! @requireRole(role: USER)
tasks(where: TaskWhereInput): [Task!]! @requireRole(role: USER)
beacons(where: BeaconWhereInput): [Beacon!]! @requireRole(role: USER)
hosts(where: HostWhereInput): [Host!]! @requireRole(role: USER)
tags(where: TagWhereInput): [Tag!]! @requireRole(role: USER)
Expand Down
139 changes: 139 additions & 0 deletions tavern/internal/graphql/generated/ent.generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions tavern/internal/graphql/generated/root_.generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions tavern/internal/graphql/query.resolvers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tavern/internal/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1070,6 +1070,7 @@ type Mutation {
extend type Query {
files(where: FileWhereInput): [File!]! @requireRole(role: USER)
quests(where: QuestWhereInput): [Quest!]! @requireRole(role: USER)
tasks(where: TaskWhereInput): [Task!]! @requireRole(role: USER)
beacons(where: BeaconWhereInput): [Beacon!]! @requireRole(role: USER)
hosts(where: HostWhereInput): [Host!]! @requireRole(role: USER)
tags(where: TagWhereInput): [Tag!]! @requireRole(role: USER)
Expand Down
1 change: 1 addition & 0 deletions tavern/internal/graphql/schema/query.graphql
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
extend type Query {
files(where: FileWhereInput): [File!]! @requireRole(role: USER)
quests(where: QuestWhereInput): [Quest!]! @requireRole(role: USER)
tasks(where: TaskWhereInput): [Task!]! @requireRole(role: USER)
beacons(where: BeaconWhereInput): [Beacon!]! @requireRole(role: USER)
hosts(where: HostWhereInput): [Host!]! @requireRole(role: USER)
tags(where: TagWhereInput): [Tag!]! @requireRole(role: USER)
Expand Down
28 changes: 28 additions & 0 deletions tavern/internal/graphql/testdata/queries/tasks/FilterByID.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
state: |
INSERT INTO `users` (id,oauth_id,photo_url,name,session_token,is_activated,is_admin)
VALUES (5,"test_oauth_id","https://photos.com","test","secretToken",true,true);
INSERT INTO `hosts` (id, name, identifier)
VALUES (1010,"db1","EXISTING-HOST");
INSERT INTO `beacons` (id, name, identifier, beacon_host)
VALUES (1337,"delightful-lich","ABCDEFG-123456",1010);
INSERT INTO `tomes` (id, name, description, eldritch, hash, created_at, last_modified_at)
VALUES (2000,"Test Tome","Used in a unit test :D", "print('Hello World!')", "abcdefg", "2023-03-04 14:51:13", "2023-03-04 14:51:13");
INSERT INTO `quests` (id, quest_tome, name, created_at, last_modified_at)
VALUES (7000,2000,"Test Quest","2023-03-04 14:51:13","2023-03-04 14:51:13");
INSERT INTO `quests` (id, quest_tome, name, created_at, last_modified_at)
VALUES (7001,2000,"Test Quest 2","2023-03-04 14:51:13","2023-03-04 14:51:13");
INSERT INTO `tasks` (id, task_beacon, quest_tasks, created_at, last_modified_at)
VALUES (8000,1337,7000,"2023-03-04 14:51:13","2023-03-04 14:51:13");
INSERT INTO `tasks` (id, task_beacon, quest_tasks, created_at, last_modified_at)
VALUES (8001,1337,7000,"2023-03-04 14:51:13","2023-03-04 14:51:13");
requestor:
session_token: secretToken
query: |
query Tasks {
tasks(where: {id: 8000}) {
id
}
}
expected:
tasks:
- id: "8000"
27 changes: 27 additions & 0 deletions tavern/internal/graphql/testdata/queries/tasks/Multiple.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
state: |
INSERT INTO `users` (id,oauth_id,photo_url,name,session_token,is_activated,is_admin)
VALUES (5,"test_oauth_id","https://photos.com","test","secretToken",true,true);
INSERT INTO `hosts` (id, name, identifier)
VALUES (1010,"db1","EXISTING-HOST");
INSERT INTO `beacons` (id, name, identifier, beacon_host)
VALUES (1337,"delightful-lich","ABCDEFG-123456",1010);
INSERT INTO `tomes` (id, name, description, eldritch, hash, created_at, last_modified_at)
VALUES (2000,"Test Tome","Used in a unit test :D", "print('Hello World!')", "abcdefg", "2023-03-04 14:51:13", "2023-03-04 14:51:13");
INSERT INTO `quests` (id, quest_tome, name, created_at, last_modified_at)
VALUES (7000,2000,"Test Quest","2023-03-04 14:51:13","2023-03-04 14:51:13");
INSERT INTO `tasks` (id, task_beacon, quest_tasks, created_at, last_modified_at)
VALUES (8000,1337,7000,"2023-03-04 14:51:13","2023-03-04 14:51:13");
INSERT INTO `tasks` (id, task_beacon, quest_tasks, created_at, last_modified_at)
VALUES (8001,1337,7000,"2023-03-04 14:51:13","2023-03-04 14:51:13");
requestor:
session_token: secretToken
query: |
query Tasks {
tasks {
id
}
}
expected:
tasks:
- id: "8000"
- id: "8001"
24 changes: 24 additions & 0 deletions tavern/internal/graphql/testdata/queries/tasks/Singular.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
state: |
INSERT INTO `users` (id,oauth_id,photo_url,name,session_token,is_activated,is_admin)
VALUES (5,"test_oauth_id","https://photos.com","test","secretToken",true,true);
INSERT INTO `hosts` (id, name, identifier)
VALUES (1010,"db1","EXISTING-HOST");
INSERT INTO `beacons` (id, name, identifier, beacon_host)
VALUES (1337,"delightful-lich","ABCDEFG-123456",1010);
INSERT INTO `tomes` (id, name, description, eldritch, hash, created_at, last_modified_at)
VALUES (2000,"Test Tome","Used in a unit test :D", "print('Hello World!')", "abcdefg", "2023-03-04 14:51:13", "2023-03-04 14:51:13");
INSERT INTO `quests` (id, quest_tome, name, created_at, last_modified_at)
VALUES (7000,2000,"Test Quest","2023-03-04 14:51:13","2023-03-04 14:51:13");
INSERT INTO `tasks` (id, task_beacon, quest_tasks, created_at, last_modified_at)
VALUES (8000,1337,7000,"2023-03-04 14:51:13","2023-03-04 14:51:13");
requestor:
session_token: secretToken
query: |
query Tasks {
tasks {
id
}
}
expected:
tasks:
- id: "8000"
1 change: 1 addition & 0 deletions tavern/internal/www/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1070,6 +1070,7 @@ type Mutation {
extend type Query {
files(where: FileWhereInput): [File!]! @requireRole(role: USER)
quests(where: QuestWhereInput): [Quest!]! @requireRole(role: USER)
tasks(where: TaskWhereInput): [Task!]! @requireRole(role: USER)
beacons(where: BeaconWhereInput): [Beacon!]! @requireRole(role: USER)
hosts(where: HostWhereInput): [Host!]! @requireRole(role: USER)
tags(where: TagWhereInput): [Tag!]! @requireRole(role: USER)
Expand Down
Loading