Skip to content

Commit

Permalink
readonly constructors and dependency updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Alfagun74 committed Sep 27, 2024
1 parent c898584 commit 4cfa538
Show file tree
Hide file tree
Showing 27 changed files with 1,107 additions and 632 deletions.
50 changes: 25 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,46 +26,46 @@
},
"dependencies": {
"@nestjs/axios": "^3.0.3",
"@nestjs/common": "^10.4.1",
"@nestjs/core": "^10.4.1",
"@nestjs/common": "^10.4.4",
"@nestjs/core": "^10.4.4",
"@nestjs/event-emitter": "^2.0.4",
"@nestjs/passport": "^10.0.3",
"@nestjs/platform-express": "^10.4.1",
"@nestjs/platform-socket.io": "^10.4.1",
"@nestjs/schedule": "^4.1.0",
"@nestjs/swagger": "^7.4.0",
"@nestjs/platform-express": "^10.4.4",
"@nestjs/platform-socket.io": "^10.4.4",
"@nestjs/schedule": "^4.1.1",
"@nestjs/swagger": "^7.4.2",
"@nestjs/typeorm": "^10.0.2",
"@nestjs/websockets": "^10.4.1",
"@nestjs/websockets": "^10.4.4",
"@types/stream-throttle": "^0.1.4",
"axios": "^1.7.5",
"axios": "^1.7.7",
"bcrypt": "^5.1.1",
"better-sqlite3": "^9.0.0",
"builder-pattern": "^2.2.0",
"chokidar": "^3.6.0",
"chokidar": "^4.0.1",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
"compression": "^1.7.4",
"cookie-parser": "^1.4.6",
"dotenv": "^16.4.5",
"express": "^4.19.2",
"fastify": "^4.28.1",
"file-type-checker": "^1.1.1",
"express": "^4.21.0",
"fastify": "^4.0.0",
"file-type-checker": "^1.1.2",
"helmet": "^7.1.0",
"lodash": "^4.17.21",
"mime": "^3.0.0",
"morgan": "^1.10.0",
"nest-winston": "^1.10.0",
"nestjs-asyncapi": "^1.3.0",
"nestjs-paginate": "^9.0.2",
"nestjs-paginate": "^9.1.2",
"node-7z": "^3.0.0",
"passport": "^0.7.0",
"passport-http": "^0.3.0",
"pg": "^8.12.0",
"pg": "^8.13.0",
"reflect-metadata": "^0.2.2",
"rimraf": "^6.0.1",
"rxjs": "^7.8.1",
"sanitize-filename": "^1.6.3",
"socket.io": "^4.7.5",
"socket.io": "^4.8.0",
"stream-throttle": "^0.1.3",
"string-similarity-js": "^2.1.4",
"ts-igdb-client": "^0.4.2",
Expand All @@ -79,36 +79,36 @@
"devDependencies": {
"@nestjs/cli": "^10.4.5",
"@nestjs/schematics": "^10.1.4",
"@nestjs/testing": "^10.4.1",
"@nestjs/testing": "^10.4.4",
"@types/bcrypt": "^5.0.2",
"@types/compression": "^1.7.5",
"@types/cookie-parser": "^1.4.7",
"@types/express": "^4.17.21",
"@types/jest": "^29.5.12",
"@types/lodash": "^4.17.7",
"@types/express": "^5.0.0",
"@types/jest": "^29.5.13",
"@types/lodash": "^4.17.9",
"@types/mime": "^3.0.4",
"@types/morgan": "^1.9.9",
"@types/multer": "^1.4.12",
"@types/node": "^22.5.1",
"@types/node-7z": "^2.1.9",
"@types/node": "^22.7.4",
"@types/node-7z": "^2.1.10",
"@types/passport-http": "^0.3.11",
"@types/pg": "^8.11.8",
"@types/pg": "^8.11.10",
"@types/string-similarity": "^4.0.2",
"@types/unidecode": "^0.1.3",
"@typescript-eslint/eslint-plugin": "^7.17.0",
"@typescript-eslint/parser": "^7.17.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-prettier": "^5.2.1",
"jest": "^29.7.0",
"prettier": "^3.3.3",
"prettier-plugin-jsdoc": "^1.3.0",
"prettier-plugin-organize-imports": "^4.0.0",
"prettier-plugin-organize-imports": "^4.1.0",
"simple-git-hooks": "^2.11.1",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"typescript": "^5.5.4"
"typescript": "^5.6.2"
},
"jest": {
"moduleFileExtensions": [
Expand Down
1,587 changes: 1,032 additions & 555 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/modules/admin/admin.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import { Role } from "../users/models/role.enum";
@ApiTags("admin")
export class AdminController {
constructor(
private healthService: HealthService,
private databaseService: DatabaseService,
private readonly healthService: HealthService,
private readonly databaseService: DatabaseService,
) {}

@Get("health")
Expand Down
2 changes: 0 additions & 2 deletions src/modules/config/config.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import { Role } from "../users/models/role.enum";
@Controller("config")
@ApiTags("config")
export class ConfigController {
constructor() {}

@Get("news")
@ApiOkResponse({ type: () => Health })
@ApiOperation({
Expand Down
6 changes: 3 additions & 3 deletions src/modules/games/games.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ export class GamesController {
private readonly logger = new Logger(this.constructor.name);

constructor(
private gamesService: GamesService,
private filesService: FilesService,
private readonly gamesService: GamesService,
private readonly filesService: FilesService,
@InjectRepository(GamevaultGame)
private readonly gamesRepository: Repository<GamevaultGame>,
private usersService: UsersService,
private readonly usersService: UsersService,
) {}

@Put("reindex")
Expand Down
6 changes: 3 additions & 3 deletions src/modules/games/games.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ export class GamesService {

constructor(
@InjectRepository(GamevaultGame)
private gamesRepository: Repository<GamevaultGame>,
private readonly gamesRepository: Repository<GamevaultGame>,
@Inject(forwardRef(() => MetadataService))
private metadataService: MetadataService,
private readonly metadataService: MetadataService,
@Inject(forwardRef(() => GameMetadataService))
private gameMetadataService: GameMetadataService,
private readonly gameMetadataService: GameMetadataService,
) {}

public async findOneByGameIdOrFail(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ export class MediaGarbageCollectionService {

constructor(
@InjectRepository(Media)
private mediaRepository: Repository<Media>,
private readonly mediaRepository: Repository<Media>,
@InjectRepository(GameMetadata)
private gameMetadataRepository: Repository<GameMetadata>,
private readonly gameMetadataRepository: Repository<GameMetadata>,
@InjectRepository(GamevaultUser)
private userRepository: Repository<GamevaultUser>,
private mediaService: MediaService,
private readonly userRepository: Repository<GamevaultUser>,
private readonly mediaService: MediaService,
) {
this.garbageCollectUnusedMedia();
}
Expand Down
2 changes: 1 addition & 1 deletion src/modules/guards/basic-auth.strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { UsersService } from "../users/users.service";
@Injectable()
export class DefaultStrategy extends PassportStrategy(BasicStrategy) {
private readonly logger = new Logger(this.constructor.name);
constructor(private usersService: UsersService) {
constructor(private readonly usersService: UsersService) {
super({
passReqToCallback: true,
});
Expand Down
2 changes: 1 addition & 1 deletion src/modules/guards/socket-secret.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { SocketSecretService } from "../users/socket-secret.service";
export class SocketSecretGuard implements CanActivate {
private readonly logger = new Logger(this.constructor.name);

constructor(private socketSecretService: SocketSecretService) {}
constructor(private readonly socketSecretService: SocketSecretService) {}

async canActivate(context: ExecutionContext): Promise<boolean> {
const client = context.switchToWs().getClient<Socket>();
Expand Down
2 changes: 1 addition & 1 deletion src/modules/health/health.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Health } from "./models/health.model";
@Controller("health")
@ApiTags("health")
export class HealthController {
constructor(private healthService: HealthService) {}
constructor(private readonly healthService: HealthService) {}

@Get()
@ApiOkResponse({ type: () => Health })
Expand Down
2 changes: 1 addition & 1 deletion src/modules/health/health.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Health, HealthProtocolEntry } from "./models/health.model";

@Injectable()
export class HealthService {
private epoch: Date = new Date();
private readonly epoch: Date = new Date();
private currentHealth: Health = new Health();

constructor() {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/media/media.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { MediaService } from "./media.service";
export class MediaController {
private readonly logger = new Logger(this.constructor.name);

constructor(private mediaService: MediaService) {}
constructor(private readonly mediaService: MediaService) {}

/** Retrieve media by its ID and send it as the response. */
@Get(":id")
Expand Down
4 changes: 2 additions & 2 deletions src/modules/media/media.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ export class MediaService {
constructor(
private readonly httpService: HttpService,
@InjectRepository(Media)
private mediaRepository: Repository<Media>,
private readonly mediaRepository: Repository<Media>,
@Inject(forwardRef(() => UsersService))
private usersService: UsersService,
private readonly usersService: UsersService,
) {}

public async isAvailable(id: number): Promise<boolean> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class DeveloperMetadataService {
private readonly logger = new Logger(this.constructor.name);
constructor(
@InjectRepository(DeveloperMetadata)
private developerRepository: Repository<DeveloperMetadata>,
private readonly developerRepository: Repository<DeveloperMetadata>,
) {}

async findByProviderSlug(
Expand Down
10 changes: 5 additions & 5 deletions src/modules/metadata/games/game.metadata.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ import { GameMetadata } from "./game.metadata.entity";
export class GameMetadataService {
constructor(
@InjectRepository(GameMetadata)
private gameMetadataRepository: Repository<GameMetadata>,
private developerMetadataService: DeveloperMetadataService,
private publisherMetadataService: PublisherMetadataService,
private tagMetadataService: TagMetadataService,
private genreMetadataService: GenreMetadataService,
private readonly gameMetadataRepository: Repository<GameMetadata>,
private readonly developerMetadataService: DeveloperMetadataService,
private readonly publisherMetadataService: PublisherMetadataService,
private readonly tagMetadataService: TagMetadataService,
private readonly genreMetadataService: GenreMetadataService,
) {}

async findByProviderSlug(
Expand Down
2 changes: 1 addition & 1 deletion src/modules/metadata/genres/genre.metadata.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class GenreMetadataService {
private readonly logger = new Logger(this.constructor.name);
constructor(
@InjectRepository(GenreMetadata)
private genreRepository: Repository<GenreMetadata>,
private readonly genreRepository: Repository<GenreMetadata>,
) {}

async findByProviderSlug(
Expand Down
2 changes: 1 addition & 1 deletion src/modules/metadata/metadata.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { ProviderSlugDto } from "./providers/models/provider-slug.dto";
@ApiTags("metadata")
@ApiBasicAuth()
export class MetadataController {
constructor(private metadataService: MetadataService) {}
constructor(private readonly metadataService: MetadataService) {}

@Get("/providers")
@ApiOperation({
Expand Down
4 changes: 2 additions & 2 deletions src/modules/metadata/metadata.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export class MetadataService {

constructor(
@Inject(forwardRef(() => GamesService))
private gamesService: GamesService,
private gameMetadataService: GameMetadataService,
private readonly gamesService: GamesService,
private readonly gameMetadataService: GameMetadataService,
) {}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ import { TagMetadataService } from "../tags/tag.metadata.service";
export abstract class MetadataProvider implements OnModuleInit {
protected readonly logger = new Logger(this.constructor.name);
constructor(
private metadataService: MetadataService,
private gameMetadataService: GameMetadataService,
private developerMetadataService: DeveloperMetadataService,
private publisherMetadataService: PublisherMetadataService,
private tagMetadataService: TagMetadataService,
private genreMetadataService: GenreMetadataService,
protected mediaService: MediaService,
private readonly metadataService: MetadataService,
private readonly gameMetadataService: GameMetadataService,
private readonly developerMetadataService: DeveloperMetadataService,
private readonly publisherMetadataService: PublisherMetadataService,
private readonly tagMetadataService: TagMetadataService,
private readonly genreMetadataService: GenreMetadataService,
protected readonly mediaService: MediaService,
) {}

async onModuleInit() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class PublisherMetadataService {
private readonly logger = new Logger(this.constructor.name);
constructor(
@InjectRepository(PublisherMetadata)
private publisherRepository: Repository<PublisherMetadata>,
private readonly publisherRepository: Repository<PublisherMetadata>,
) {}

async findByProviderSlug(
Expand Down
2 changes: 1 addition & 1 deletion src/modules/metadata/tags/tag.metadata.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class TagMetadataService {

constructor(
@InjectRepository(TagMetadata)
private tagRepository: Repository<TagMetadata>,
private readonly tagRepository: Repository<TagMetadata>,
) {}

async findByProviderSlug(
Expand Down
4 changes: 2 additions & 2 deletions src/modules/progresses/progress.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export class ProgressController {
private readonly logger = new Logger(this.constructor.name);

constructor(
private progressService: ProgressService,
private usersService: UsersService,
private readonly progressService: ProgressService,
private readonly usersService: UsersService,
@InjectRepository(Progress)
private readonly progressRepository: Repository<Progress>,
) {}
Expand Down
6 changes: 3 additions & 3 deletions src/modules/progresses/progress.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ export class ProgressService {

constructor(
@InjectRepository(Progress)
private progressRepository: Repository<Progress>,
private usersService: UsersService,
private gamesService: GamesService,
private readonly progressRepository: Repository<Progress>,
private readonly usersService: UsersService,
private readonly gamesService: GamesService,
) {
this.readIgnoreFile();
}
Expand Down
2 changes: 1 addition & 1 deletion src/modules/users/activity.gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class ActivityGateway
@WebSocketServer()
server: Server;

constructor(private usersService: UsersService) {}
constructor(private readonly usersService: UsersService) {}

@AsyncApiSub({
channel: "set-activity",
Expand Down
2 changes: 1 addition & 1 deletion src/modules/users/socket-secret.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { GamevaultUser } from "./gamevault-user.entity";
export class SocketSecretService {
constructor(
@InjectRepository(GamevaultUser)
private userRepository: Repository<GamevaultUser>,
private readonly userRepository: Repository<GamevaultUser>,
) {}

async findUserBySocketSecretOrFail(socketSecret: string) {
Expand Down
4 changes: 2 additions & 2 deletions src/modules/users/users.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ import { UsersService } from "./users.service";
@Controller("users")
export class UsersController {
constructor(
private usersService: UsersService,
private socketSecretService: SocketSecretService,
private readonly usersService: UsersService,
private readonly socketSecretService: SocketSecretService,
) {}

@Get()
Expand Down
6 changes: 3 additions & 3 deletions src/modules/users/users.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ export class UsersService implements OnApplicationBootstrap {

constructor(
@InjectRepository(GamevaultUser)
private userRepository: Repository<GamevaultUser>,
private readonly userRepository: Repository<GamevaultUser>,
@Inject(forwardRef(() => MediaService))
private mediaService: MediaService,
private readonly mediaService: MediaService,
@Inject(forwardRef(() => GamesService))
private gamesService: GamesService,
private readonly gamesService: GamesService,
) {}

async onApplicationBootstrap() {
Expand Down

0 comments on commit 4cfa538

Please sign in to comment.