-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
14 changed files
with
187 additions
and
33 deletions.
There are no files selected for viewing
28 changes: 27 additions & 1 deletion
28
examples/simple/src/ent/contact/actions/edit_contact_action.ts
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 |
---|---|---|
@@ -1,9 +1,35 @@ | ||
import { ContactEmail } from "src/ent"; | ||
import { | ||
EditContactActionBase, | ||
ContactEditInput, | ||
EditContactActionTriggers, | ||
} from "../../generated/contact/actions/edit_contact_action_base"; | ||
import EditContactEmailAction from "src/ent/contact_email/actions/edit_contact_email_action"; | ||
|
||
export { ContactEditInput }; | ||
|
||
// we're only writing this once except with --force and packageName provided | ||
export default class EditContactAction extends EditContactActionBase {} | ||
export default class EditContactAction extends EditContactActionBase { | ||
getTriggers(): EditContactActionTriggers { | ||
return [ | ||
{ | ||
async changeset(builder, input) { | ||
if (!input.emails) { | ||
return; | ||
} | ||
return Promise.all( | ||
input.emails.map(async (emailInput) => { | ||
const email = await ContactEmail.loadX( | ||
builder.viewer, | ||
emailInput.id, | ||
); | ||
return EditContactEmailAction.create(builder.viewer, email, { | ||
...emailInput, | ||
}).changeset(); | ||
}), | ||
); | ||
}, | ||
}, | ||
]; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
examples/simple/src/ent/generated/contact/actions/edit_contact_action_base.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
25 changes: 24 additions & 1 deletion
25
examples/simple/src/graphql/generated/mutations/contact/contact_edit_type.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.