-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Manually add contacts to target groups (#52)
* Add api functionality to add and remove contacts manually from target groups * Add form to manually add contacts in target group * Add changeset * Remove unnessecary onAfterSubmit in FinalForm * Save assignedContactsTargetGroupId directly to associated target group property * Do not remove manually assigned contacts from target group on attribute update * Rename callback function to onOpenDialog * Remove intl from toolbar properties and use intl directly * Remove toolbar props interface and define directly in function * Rephrase changeset description * Add seperate query to find all brevo contacts in a specific target group * Remove unnessecary function from service * Add empty line in changeset after title * Rename brevoContactsInTargetGroup to manuallyAssignedBrevoContacts and adapt args --------- Co-authored-by: Denise Buder <[email protected]>
- Loading branch information
1 parent
23371d5
commit e774ecb
Showing
17 changed files
with
631 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
"@comet/brevo-admin": minor | ||
"@comet/brevo-api": minor | ||
--- | ||
|
||
Allow manually assigning contacts to a target group | ||
|
||
This is in addition to the existing automatic assignment via filters. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Migration } from "@mikro-orm/migrations"; | ||
|
||
export class Migration20240619092554 extends Migration { | ||
async up(): Promise<void> { | ||
this.addSql('alter table "TargetGroup" add column "assignedContactsTargetGroupBrevoId" int null;'); | ||
} | ||
} |
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
48 changes: 48 additions & 0 deletions
48
packages/admin/src/targetGroups/addContacts/AddContactsGridSelect.gql.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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { gql } from "@apollo/client"; | ||
|
||
const targetGroupBrevoContactsFragment = gql` | ||
fragment TargetGroupBrevoContactsList on BrevoContact { | ||
id | ||
createdAt | ||
modifiedAt | ||
emailBlacklisted | ||
smsBlacklisted | ||
} | ||
`; | ||
|
||
export const manuallyAssignedBrevoContactsGridQuery = gql` | ||
query ManuallyAssignedBrevoContactsGrid($offset: Int, $limit: Int, $email: String, $targetGroupId: ID!) { | ||
manuallyAssignedBrevoContacts(offset: $offset, limit: $limit, email: $email, targetGroupId: $targetGroupId) { | ||
nodes { | ||
...TargetGroupBrevoContactsList | ||
} | ||
totalCount | ||
} | ||
} | ||
${targetGroupBrevoContactsFragment} | ||
`; | ||
|
||
export const allBrevoContactsQuery = gql` | ||
query AllBrevoContactsGrid($offset: Int, $limit: Int, $email: String, $scope: EmailCampaignContentScopeInput!) { | ||
brevoContacts(offset: $offset, limit: $limit, email: $email, scope: $scope) { | ||
nodes { | ||
...TargetGroupBrevoContactsList | ||
} | ||
totalCount | ||
} | ||
} | ||
${targetGroupBrevoContactsFragment} | ||
`; | ||
|
||
export const addBrevoContactsToTargetGroupMutation = gql` | ||
mutation AddBrevoContactsToTargetGroup($id: ID!, $input: AddBrevoContactsInput!) { | ||
addBrevoContactsToTargetGroup(id: $id, input: $input) | ||
} | ||
`; | ||
|
||
export const removeBrevoContactFromTargetGroupMutation = gql` | ||
mutation RemoveBrevoContactFromTargetGroup($id: ID!, $input: RemoveBrevoContactInput!) { | ||
removeBrevoContactFromTargetGroup(id: $id, input: $input) | ||
} | ||
`; |
Oops, something went wrong.