From cf31944f4bde5574418b6028d2011afc9d173e5b Mon Sep 17 00:00:00 2001 From: Emmanuelle Bonnemay Date: Mon, 16 Dec 2024 20:22:48 +0100 Subject: [PATCH] feat(api): retrieve anonymisedById from user repository --- .../domain/models/UserDetailsForAdmin.js | 2 ++ .../infrastructure/repositories/user.repository.js | 1 + .../serializers/jsonapi/user-details-for-admin.serializer.js | 1 + .../acceptance/application/user/user.admin.route.test.js | 1 + 4 files changed, 5 insertions(+) diff --git a/api/src/identity-access-management/domain/models/UserDetailsForAdmin.js b/api/src/identity-access-management/domain/models/UserDetailsForAdmin.js index 7ddbdd45f50..acfced3f1df 100644 --- a/api/src/identity-access-management/domain/models/UserDetailsForAdmin.js +++ b/api/src/identity-access-management/domain/models/UserDetailsForAdmin.js @@ -24,6 +24,7 @@ class UserDetailsForAdmin { emailConfirmedAt, userLogin, hasBeenAnonymised, + hasBeenAnonymisedBy, anonymisedByFirstName, anonymisedByLastName, isPixAgent, @@ -54,6 +55,7 @@ class UserDetailsForAdmin { this.emailConfirmedAt = emailConfirmedAt; this.userLogin = userLogin; this.hasBeenAnonymised = hasBeenAnonymised; + this.hasBeenAnonymisedBy = hasBeenAnonymisedBy; this.updatedAt = updatedAt; this.anonymisedByFirstName = anonymisedByFirstName; this.anonymisedByLastName = anonymisedByLastName; diff --git a/api/src/identity-access-management/infrastructure/repositories/user.repository.js b/api/src/identity-access-management/infrastructure/repositories/user.repository.js index 8b841407631..df1fa999f4d 100644 --- a/api/src/identity-access-management/infrastructure/repositories/user.repository.js +++ b/api/src/identity-access-management/infrastructure/repositories/user.repository.js @@ -557,6 +557,7 @@ function _fromKnexDTOToUserDetailsForAdmin({ authenticationMethods, userLogin, hasBeenAnonymised: userDTO.hasBeenAnonymised, + hasBeenAnonymisedBy: userDTO.hasBeenAnonymisedBy, updatedAt: userDTO.updatedAt, createdAt: userDTO.createdAt, anonymisedByFirstName: userDTO.anonymisedByFirstName, diff --git a/api/src/identity-access-management/infrastructure/serializers/jsonapi/user-details-for-admin.serializer.js b/api/src/identity-access-management/infrastructure/serializers/jsonapi/user-details-for-admin.serializer.js index 93102a52787..27107dbb3a1 100644 --- a/api/src/identity-access-management/infrastructure/serializers/jsonapi/user-details-for-admin.serializer.js +++ b/api/src/identity-access-management/infrastructure/serializers/jsonapi/user-details-for-admin.serializer.js @@ -30,6 +30,7 @@ const serialize = function (usersDetailsForAdmin) { 'lastLoggedAt', 'emailConfirmedAt', 'hasBeenAnonymised', + 'hasBeenAnonymisedBy', 'anonymisedByFullName', 'organizationLearners', 'authenticationMethods', diff --git a/api/tests/identity-access-management/acceptance/application/user/user.admin.route.test.js b/api/tests/identity-access-management/acceptance/application/user/user.admin.route.test.js index 4e30c1fc9e5..cf8b91e3ca4 100644 --- a/api/tests/identity-access-management/acceptance/application/user/user.admin.route.test.js +++ b/api/tests/identity-access-management/acceptance/application/user/user.admin.route.test.js @@ -288,6 +288,7 @@ describe('Acceptance | Identity Access Management | Application | Route | Admin 'pix-orga-terms-of-service-accepted': false, username: user.username, 'has-been-anonymised': false, + 'has-been-anonymised-by': false, 'anonymised-by-full-name': null, 'is-pix-agent': false, });