Skip to content

Commit

Permalink
example cleanup (#1589)
Browse files Browse the repository at this point in the history
use Transaction API and fixes from last PR
  • Loading branch information
lolopinto authored Aug 8, 2023
1 parent 706783e commit 68f2f5a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 15 deletions.

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

2 changes: 1 addition & 1 deletion examples/simple/src/graphql/generated/schema.gql

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

17 changes: 5 additions & 12 deletions examples/simple/src/graphql/mutations/import_contact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,12 @@ import {
import { GraphQLID } from "graphql";
import { FileUpload } from "graphql-upload";
import parse from "csv-parse";
import { BaseAction } from "@snowtop/ent/action/experimental_action";
import { User } from "../../ent";
import CreateContactAction from "../../ent/contact/actions/create_contact_action";
import {
UserBuilder,
UserInput,
} from "../../ent/generated/user/actions/user_builder";
import { ExampleViewer } from "../../viewer/viewer";
import { ContactLabel } from "../../ent/generated/types";
import { ContactLabel2 } from "./custom_enum";
import { Transaction } from "@snowtop/ent/action";

export class ImportContactResolver {
@gqlMutation({
Expand Down Expand Up @@ -45,6 +41,7 @@ export class ImportContactResolver {
tsType: "ContactLabel2",
tsImportPath: "src/graphql/mutations/custom_enum",
},
nullable: true,
},
],
async: true,
Expand Down Expand Up @@ -85,13 +82,9 @@ export class ImportContactResolver {
}),
);
}
const tx = new Transaction(user.viewer, actions);
await tx.run();

// not ideal we have to type this. should be able to get UserInput for free
const action = BaseAction.bulkAction<User, ExampleViewer, UserInput>(
user,
UserBuilder,
...actions,
);
return await action.saveX();
return user;
}
}
2 changes: 1 addition & 1 deletion ts/src/graphql/graphql.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ describe("property", () => {
GQLCapture.resolve([]);
});

test.only("enabled. custom enum as arg", () => {
test("enabled. custom enum as arg", () => {
class Request {
@gqlField({
class: "User",
Expand Down

0 comments on commit 68f2f5a

Please sign in to comment.