mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-01-23 01:24:09 +00:00
AuthTokenDto: Make properties consistently optional
validUntil and lastUsed already have a IsOptional decorator, this makes the properties themselves also optional Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
cfaa07806b
commit
72b545fec5
3 changed files with 4 additions and 6 deletions
|
@ -15,8 +15,8 @@ export class AuthTokenDto {
|
|||
createdAt: Date;
|
||||
@IsDate()
|
||||
@IsOptional()
|
||||
validUntil: Date;
|
||||
validUntil: Date | null;
|
||||
@IsDate()
|
||||
@IsOptional()
|
||||
lastUsed: Date;
|
||||
lastUsed: Date | null;
|
||||
}
|
||||
|
|
|
@ -251,7 +251,7 @@ describe('AuthService', () => {
|
|||
});
|
||||
jest.spyOn(authTokenRepo, 'save').mockImplementationOnce(
|
||||
async (authTokenSaved: AuthToken, _): Promise<AuthToken> => {
|
||||
expect(authTokenSaved.lastUsed).toBeUndefined();
|
||||
expect(authTokenSaved.lastUsed).toBeNull();
|
||||
return authTokenSaved;
|
||||
},
|
||||
);
|
||||
|
@ -275,7 +275,7 @@ describe('AuthService', () => {
|
|||
});
|
||||
jest.spyOn(authTokenRepo, 'save').mockImplementationOnce(
|
||||
async (authTokenSaved: AuthToken, _): Promise<AuthToken> => {
|
||||
expect(authTokenSaved.lastUsed).toBeUndefined();
|
||||
expect(authTokenSaved.lastUsed).toBeNull();
|
||||
return authTokenSaved;
|
||||
},
|
||||
);
|
||||
|
|
|
@ -181,8 +181,6 @@ export class AuthService {
|
|||
|
||||
toAuthTokenDto(authToken: AuthToken): AuthTokenDto {
|
||||
const tokenDto: AuthTokenDto = {
|
||||
lastUsed: null,
|
||||
validUntil: null,
|
||||
label: authToken.label,
|
||||
keyId: authToken.keyId,
|
||||
createdAt: authToken.createdAt,
|
||||
|
|
Loading…
Reference in a new issue