Fix various ESLint errors in services

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2021-02-24 22:35:06 +01:00
parent 4d94739a9f
commit 1cc86a728a
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
4 changed files with 11 additions and 6 deletions

View file

@ -117,7 +117,9 @@ export class AuthService {
new Date(validUntil),
);
}
const createdToken = await this.authTokenRepository.save(token);
const createdToken = (await this.authTokenRepository.save(
token,
)) as AuthToken;
return this.toAuthTokenWithSecretDto(createdToken, `${keyId}.${secret}`);
}
@ -150,7 +152,7 @@ export class AuthService {
) {
// tokens validUntil Date lies in the past
throw new TokenNotValidError(
`AuthToken '${token}' is not valid since ${accessToken.validUntil}.`,
`AuthToken '${token}' is not valid since ${accessToken.validUntil.toISOString()}.`,
);
}
return accessToken;
@ -173,7 +175,10 @@ export class AuthService {
toAuthTokenDto(authToken: AuthToken): AuthTokenDto | null {
if (!authToken) {
this.logger.warn(`Recieved ${authToken} argument!`, 'toAuthTokenDto');
this.logger.warn(
`Recieved ${String(authToken)} argument!`,
'toAuthTokenDto',
);
return null;
}
const tokenDto: AuthTokenDto = {

View file

@ -45,7 +45,7 @@ export class GroupsService {
*/
toGroupDto(group: Group | null | undefined): GroupInfoDto | null {
if (!group) {
this.logger.warn(`Recieved ${group} argument!`, 'toGroupDto');
this.logger.warn(`Recieved ${String(group)} argument!`, 'toGroupDto');
return null;
}
return {

View file

@ -299,7 +299,7 @@ export class NotesService {
* @param {Note} note - the note to use
* @return {NotePermissionsDto} the built NotePermissionDto
*/
toNotePermissionsDto(note: Note): Promise<NotePermissionsDto> {
toNotePermissionsDto(note: Note): NotePermissionsDto {
return {
owner: this.usersService.toUserDto(note.owner),
sharedToUsers: note.userPermissions.map((noteUserPermission) => ({

View file

@ -56,7 +56,7 @@ export class UsersService {
toUserDto(user: User | null | undefined): UserInfoDto | null {
if (!user) {
this.logger.warn(`Recieved ${user} argument!`, 'toUserDto');
this.logger.warn(`Recieved ${String(user)} argument!`, 'toUserDto');
return null;
}
return {