mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-27 12:08:02 -05:00
Fix various ESLint errors in services
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
4d94739a9f
commit
1cc86a728a
4 changed files with 11 additions and 6 deletions
|
@ -117,7 +117,9 @@ export class AuthService {
|
||||||
new Date(validUntil),
|
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}`);
|
return this.toAuthTokenWithSecretDto(createdToken, `${keyId}.${secret}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +152,7 @@ export class AuthService {
|
||||||
) {
|
) {
|
||||||
// tokens validUntil Date lies in the past
|
// tokens validUntil Date lies in the past
|
||||||
throw new TokenNotValidError(
|
throw new TokenNotValidError(
|
||||||
`AuthToken '${token}' is not valid since ${accessToken.validUntil}.`,
|
`AuthToken '${token}' is not valid since ${accessToken.validUntil.toISOString()}.`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return accessToken;
|
return accessToken;
|
||||||
|
@ -173,7 +175,10 @@ export class AuthService {
|
||||||
|
|
||||||
toAuthTokenDto(authToken: AuthToken): AuthTokenDto | null {
|
toAuthTokenDto(authToken: AuthToken): AuthTokenDto | null {
|
||||||
if (!authToken) {
|
if (!authToken) {
|
||||||
this.logger.warn(`Recieved ${authToken} argument!`, 'toAuthTokenDto');
|
this.logger.warn(
|
||||||
|
`Recieved ${String(authToken)} argument!`,
|
||||||
|
'toAuthTokenDto',
|
||||||
|
);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const tokenDto: AuthTokenDto = {
|
const tokenDto: AuthTokenDto = {
|
||||||
|
|
|
@ -45,7 +45,7 @@ export class GroupsService {
|
||||||
*/
|
*/
|
||||||
toGroupDto(group: Group | null | undefined): GroupInfoDto | null {
|
toGroupDto(group: Group | null | undefined): GroupInfoDto | null {
|
||||||
if (!group) {
|
if (!group) {
|
||||||
this.logger.warn(`Recieved ${group} argument!`, 'toGroupDto');
|
this.logger.warn(`Recieved ${String(group)} argument!`, 'toGroupDto');
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -299,7 +299,7 @@ export class NotesService {
|
||||||
* @param {Note} note - the note to use
|
* @param {Note} note - the note to use
|
||||||
* @return {NotePermissionsDto} the built NotePermissionDto
|
* @return {NotePermissionsDto} the built NotePermissionDto
|
||||||
*/
|
*/
|
||||||
toNotePermissionsDto(note: Note): Promise<NotePermissionsDto> {
|
toNotePermissionsDto(note: Note): NotePermissionsDto {
|
||||||
return {
|
return {
|
||||||
owner: this.usersService.toUserDto(note.owner),
|
owner: this.usersService.toUserDto(note.owner),
|
||||||
sharedToUsers: note.userPermissions.map((noteUserPermission) => ({
|
sharedToUsers: note.userPermissions.map((noteUserPermission) => ({
|
||||||
|
|
|
@ -56,7 +56,7 @@ export class UsersService {
|
||||||
|
|
||||||
toUserDto(user: User | null | undefined): UserInfoDto | null {
|
toUserDto(user: User | null | undefined): UserInfoDto | null {
|
||||||
if (!user) {
|
if (!user) {
|
||||||
this.logger.warn(`Recieved ${user} argument!`, 'toUserDto');
|
this.logger.warn(`Recieved ${String(user)} argument!`, 'toUserDto');
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in a new issue