-
Notifications
You must be signed in to change notification settings - Fork 56
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] Ajouter un bouton pour renvoyer l'invitation à un centre de certification dans pix admin (PIX-10018) #11203
Merged
pix-service-auto-merge
merged 8 commits into
dev
from
pix-10018-add-a-button-to-send-a-new-certif-invitation
Jan 31, 2025
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1872bce
feat(api): Add a new migration
theotime2005 d8a2ad7
feat(api): Add locale to database builder
theotime2005 f09466e
feat(api): Add locale to service
theotime2005 b10c8c0
feat(api): Add locale to repositories
theotime2005 c193bc7
feat(api): Transforme locale to language in serializer
theotime2005 a11e125
feat(api): Pass the locale to usecases
theotime2005 ccac159
feat(admin): Add a button to send a new certification center invitation
theotime2005 964facc
fix(admin): Remove isLoading
theotime2005 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
2 changes: 2 additions & 0 deletions
2
admin/tests/integration/components/certification-centers/invitations-test.gjs
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 |
---|---|---|
|
@@ -85,5 +85,58 @@ module('Unit | Controller | authenticated/certification-centers/get/invitations' | |
sinon.assert.calledWith(notificationErrorStub, { message: 'Une erreur s’est produite, veuillez réessayer.' }); | ||
assert.ok(true); | ||
}); | ||
|
||
module('#sendNewInvitation', function () { | ||
test('It sends a new invitation', async function (assert) { | ||
// given | ||
const controller = this.owner.lookup('controller:authenticated/certification-centers/get/invitations'); | ||
|
||
const store = this.owner.lookup('service:store'); | ||
const queryRecordStub = sinon.stub(); | ||
store.queryRecord = queryRecordStub; | ||
const certificationCenterInvitation = { | ||
email: '[email protected]', | ||
language: 'en', | ||
role: 'member', | ||
certificationCenterId: 1, | ||
}; | ||
// when | ||
await controller.sendNewCertificationCenterInvitation(certificationCenterInvitation); | ||
|
||
// then | ||
assert.ok( | ||
queryRecordStub.calledWith('certification-center-invitation', { | ||
...certificationCenterInvitation, | ||
}), | ||
); | ||
}); | ||
|
||
test('When an error occurs, it should send a notification error', async function (assert) { | ||
// given | ||
const controller = this.owner.lookup('controller:authenticated/certification-centers/get/invitations'); | ||
const store = this.owner.lookup('service:store'); | ||
const anError = Symbol('an error'); | ||
store.queryRecord = sinon.stub().rejects(anError); | ||
const notifyStub = sinon.stub(); | ||
class ErrorResponseHandler extends Service { | ||
notify = notifyStub; | ||
} | ||
this.owner.register('service:error-response-handler', ErrorResponseHandler); | ||
const customErrors = Symbol('custom errors'); | ||
controller.CUSTOM_ERROR_MESSAGES = customErrors; | ||
const certificationCenterInvitation = { | ||
email: '[email protected]', | ||
language: 'en', | ||
role: 'member', | ||
certificationCenterId: 1, | ||
}; | ||
|
||
// when | ||
await controller.sendNewCertificationCenterInvitation(certificationCenterInvitation); | ||
|
||
// then | ||
assert.ok(notifyStub.calledWithExactly(anError, customErrors)); | ||
}); | ||
}); | ||
}); | ||
}); |
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 |
---|---|---|
|
@@ -8,6 +8,7 @@ const buildCertificationCenterInvitation = function ({ | |
email = '[email protected]', | ||
status = 'pending', | ||
role = 'MEMBER', | ||
locale = 'fr', | ||
code = 'ABCDEF123', | ||
createdAt = new Date(), | ||
updatedAt = new Date(), | ||
|
@@ -18,6 +19,7 @@ const buildCertificationCenterInvitation = function ({ | |
email, | ||
status, | ||
role, | ||
locale, | ||
code, | ||
createdAt, | ||
updatedAt, | ||
|
16 changes: 16 additions & 0 deletions
16
.../migrations/20250128112736_add-locale-column-to-certification-center-invitations-table.js
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,16 @@ | ||
const TABLE_NAME = 'certification-center-invitations'; | ||
const COLUMN_NAME = 'locale'; | ||
|
||
const up = async function (knex) { | ||
await knex.schema.table(TABLE_NAME, function (table) { | ||
table.string(COLUMN_NAME).defaultTo('fr'); | ||
}); | ||
}; | ||
|
||
const down = async function (knex) { | ||
await knex.schema.table(TABLE_NAME, function (table) { | ||
table.dropColumn(COLUMN_NAME); | ||
}); | ||
}; | ||
|
||
export { down, up }; |
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
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
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 |
---|---|---|
|
@@ -58,6 +58,7 @@ describe('Acceptance | Team | Application | Route | Admin | Certification Center | |
attributes: { | ||
email: '[email protected]', | ||
role: 'MEMBER', | ||
language: 'fr', | ||
'updated-at': now, | ||
}, | ||
}, | ||
|
@@ -67,6 +68,7 @@ describe('Acceptance | Team | Application | Route | Admin | Certification Center | |
attributes: { | ||
email: '[email protected]', | ||
role: 'ADMIN', | ||
language: 'fr', | ||
'updated-at': now, | ||
}, | ||
}, | ||
|
@@ -119,6 +121,7 @@ describe('Acceptance | Team | Application | Route | Admin | Certification Center | |
'updated-at': now, | ||
email: '[email protected]', | ||
role: 'ADMIN', | ||
language: 'fr', | ||
}); | ||
}); | ||
}); | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oui, mais pour la partie des centres de certification, c'est language qui est utilisé, donc on s'adapte:)