-
Notifications
You must be signed in to change notification settings - Fork 17
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
- check email in provisioning - log warning
- Loading branch information
1 parent
7047c01
commit 2cba8e4
Showing
7 changed files
with
354 additions
and
67 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
apps/server/src/modules/provisioning/loggable/email-already-exists.loggable.spec.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,32 @@ | ||
import { EmailAlreadyExistsLoggable } from '@modules/provisioning/loggable/email-already-exists.loggable'; | ||
|
||
describe('EmailAlreadyExistsLoggableException', () => { | ||
describe('getLogMessage', () => { | ||
const setup = () => { | ||
const email = 'mock-email'; | ||
const externalId = '789'; | ||
|
||
const loggable = new EmailAlreadyExistsLoggable(email, externalId); | ||
|
||
return { | ||
loggable, | ||
email, | ||
externalId, | ||
}; | ||
}; | ||
|
||
it('should return the correct log message', () => { | ||
const { loggable, email, externalId } = setup(); | ||
|
||
const message = loggable.getLogMessage(); | ||
|
||
expect(message).toEqual({ | ||
message: 'The Email to be provisioned already exists.', | ||
data: { | ||
email, | ||
externalId, | ||
}, | ||
}); | ||
}); | ||
}); | ||
}); |
15 changes: 15 additions & 0 deletions
15
apps/server/src/modules/provisioning/loggable/email-already-exists.loggable.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,15 @@ | ||
import { ErrorLogMessage, Loggable, LogMessage, ValidationErrorLogMessage } from '@src/core/logger'; | ||
|
||
export class EmailAlreadyExistsLoggable implements Loggable { | ||
constructor(private readonly email: string, private readonly externalId?: string) {} | ||
|
||
getLogMessage(): LogMessage | ErrorLogMessage | ValidationErrorLogMessage { | ||
return { | ||
message: 'The Email to be provisioned already exists.', | ||
data: { | ||
email: this.email, | ||
externalId: this.externalId, | ||
}, | ||
}; | ||
} | ||
} |
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,3 +1,4 @@ | ||
export * from './user-for-group-not-found.loggable'; | ||
export * from './school-for-group-not-found.loggable'; | ||
export * from './group-role-unknown.loggable'; | ||
export { EmailAlreadyExistsLoggable } from './email-already-exists.loggable'; |
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.