mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-19 01:35:18 -04: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
ef8b8d985e
commit
5ee9b2a7e8
3 changed files with 4 additions and 6 deletions
|
@ -15,8 +15,8 @@ export class AuthTokenDto {
|
||||||
createdAt: Date;
|
createdAt: Date;
|
||||||
@IsDate()
|
@IsDate()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
validUntil: Date;
|
validUntil: Date | null;
|
||||||
@IsDate()
|
@IsDate()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
lastUsed: Date;
|
lastUsed: Date | null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -251,7 +251,7 @@ describe('AuthService', () => {
|
||||||
});
|
});
|
||||||
jest.spyOn(authTokenRepo, 'save').mockImplementationOnce(
|
jest.spyOn(authTokenRepo, 'save').mockImplementationOnce(
|
||||||
async (authTokenSaved: AuthToken, _): Promise<AuthToken> => {
|
async (authTokenSaved: AuthToken, _): Promise<AuthToken> => {
|
||||||
expect(authTokenSaved.lastUsed).toBeUndefined();
|
expect(authTokenSaved.lastUsed).toBeNull();
|
||||||
return authTokenSaved;
|
return authTokenSaved;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -275,7 +275,7 @@ describe('AuthService', () => {
|
||||||
});
|
});
|
||||||
jest.spyOn(authTokenRepo, 'save').mockImplementationOnce(
|
jest.spyOn(authTokenRepo, 'save').mockImplementationOnce(
|
||||||
async (authTokenSaved: AuthToken, _): Promise<AuthToken> => {
|
async (authTokenSaved: AuthToken, _): Promise<AuthToken> => {
|
||||||
expect(authTokenSaved.lastUsed).toBeUndefined();
|
expect(authTokenSaved.lastUsed).toBeNull();
|
||||||
return authTokenSaved;
|
return authTokenSaved;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
|
@ -181,8 +181,6 @@ export class AuthService {
|
||||||
|
|
||||||
toAuthTokenDto(authToken: AuthToken): AuthTokenDto {
|
toAuthTokenDto(authToken: AuthToken): AuthTokenDto {
|
||||||
const tokenDto: AuthTokenDto = {
|
const tokenDto: AuthTokenDto = {
|
||||||
lastUsed: null,
|
|
||||||
validUntil: null,
|
|
||||||
label: authToken.label,
|
label: authToken.label,
|
||||||
keyId: authToken.keyId,
|
keyId: authToken.keyId,
|
||||||
createdAt: authToken.createdAt,
|
createdAt: authToken.createdAt,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue