Make all services readonly

This commit is contained in:
rubikscraft
2022-06-27 17:37:37 +02:00
parent 34eeb11930
commit ba47d0bff4
73 changed files with 201 additions and 185 deletions

View File

@@ -8,7 +8,7 @@ import { AsyncFailable, Fail } from 'picsur-shared/dist/types';
export class AuthManagerService {
private readonly logger = new Logger('AuthService');
constructor(private jwtService: JwtService) {}
constructor(private readonly jwtService: JwtService) {}
async createToken(user: EUser): AsyncFailable<string> {
const jwtData = {

View File

@@ -21,7 +21,7 @@ export class GuestStrategy extends PassportStrategy(
GuestPassportStrategy,
'guest',
) {
constructor(private guestService: GuestService) {
constructor(private readonly guestService: GuestService) {
super();
}

View File

@@ -8,7 +8,7 @@ import { EUserBackend2EUser } from '../../../models/transformers/user.transforme
@Injectable()
export class LocalAuthStrategy extends PassportStrategy(Strategy, 'local') {
constructor(private usersService: UsersService) {
constructor(private readonly usersService: UsersService) {
super();
}

View File

@@ -3,7 +3,7 @@ import {
ForbiddenException,
Injectable,
InternalServerErrorException,
Logger,
Logger
} from '@nestjs/common';
import { Reflector } from '@nestjs/core';
import { AuthGuard } from '@nestjs/passport';
@@ -22,8 +22,8 @@ export class MainAuthGuard extends AuthGuard(['jwt', 'guest']) {
private readonly logger = new Logger('MainAuthGuard');
constructor(
private reflector: Reflector,
private usersService: UsersService,
private readonly reflector: Reflector,
private readonly usersService: UsersService,
) {
super();
}

View File

@@ -7,7 +7,7 @@ import { EUserBackend } from '../../models/entities/user.entity';
export class GuestService {
private fallBackUser: EUserBackend;
constructor(private usersService: UsersService) {
constructor(private readonly usersService: UsersService) {
this.fallBackUser = new EUserBackend();
this.fallBackUser.username = 'guest';
this.fallBackUser.roles = ['guest'];

View File

@@ -15,7 +15,7 @@ export class DemoManagerModule implements OnModuleInit, OnModuleDestroy {
constructor(
private readonly demoManagerService: DemoManagerService,
private hostConfigService: HostConfigService,
private readonly hostConfigService: HostConfigService,
) {}
async onModuleInit() {

View File

@@ -9,7 +9,7 @@ export class DemoManagerService {
constructor(
private readonly imagesService: ImageDBService,
private rolesService: RolesService,
private readonly rolesService: RolesService,
) {}
public async setupRoles() {

View File

@@ -24,8 +24,8 @@ export class ImageManagerModule implements OnModuleInit, OnModuleDestroy {
private interval: NodeJS.Timeout;
constructor(
private prefManager: SysPreferenceService,
private imageFileDB: ImageFileDBService,
private readonly prefManager: SysPreferenceService,
private readonly imageFileDB: ImageFileDBService,
) {}
async onModuleInit() {