Skip to content

Commit

Permalink
style: run new eslint config on EVERYTHING ELSE
Browse files Browse the repository at this point in the history
  • Loading branch information
binaryoverload committed Jan 8, 2025
1 parent 45d2be8 commit 9bebbe6
Show file tree
Hide file tree
Showing 31 changed files with 160 additions and 150 deletions.
6 changes: 3 additions & 3 deletions src/config-manager.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import crypto from 'node:crypto';
import path from 'node:path';
import fs from 'fs-extra';
import mongoose from 'mongoose';
import dotenv from 'dotenv';
import { LOG_INFO, LOG_WARN, LOG_ERROR } from '@/logger';
import { DisabledFeatures, Config } from '@/types/common/config';
import type mongoose from 'mongoose';
import type { DisabledFeatures, Config } from '@/types/common/config';

dotenv.config();

Expand Down Expand Up @@ -78,7 +78,7 @@ export const config: Config = {
secret: process.env.PN_BOSS_CONFIG_S3_ACCESS_SECRET?.trim() || ''
},
disk_path: process.env.PN_BOSS_CONFIG_CDN_DISK_PATH?.trim() || ''
},
}
};

LOG_INFO('Config loaded, checking integrity');
Expand Down
10 changes: 5 additions & 5 deletions src/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { CECSlot } from '@/models/cec-slot';
import { Task } from '@/models/task';
import { File } from '@/models/file';
import { config } from '@/config-manager';
import { HydratedCECDataDocument } from '@/types/mongoose/cec-data';
import { HydratedCECSlotDocument, ICECSlot } from '@/types/mongoose/cec-slot';
import { HydratedTaskDocument, ITask } from '@/types/mongoose/task';
import { HydratedFileDocument, IFile } from '@/types/mongoose/file';
import type { HydratedCECDataDocument } from '@/types/mongoose/cec-data';
import type { HydratedCECSlotDocument, ICECSlot } from '@/types/mongoose/cec-slot';
import type { HydratedTaskDocument, ITask } from '@/types/mongoose/task';
import type { HydratedFileDocument, IFile } from '@/types/mongoose/file';

const connection_string: string = config.mongoose.connection_string;
const options: mongoose.ConnectOptions = config.mongoose.options;
Expand Down Expand Up @@ -168,7 +168,7 @@ export async function getRandomCECData(pids: number[], gameID: number): Promise<
// * We search through the CECSlot so that everyone has the same chance of getting their data picked up
const filter: mongoose.FilterQuery<ICECSlot> = {
creator_pid: {
$in: pids,
$in: pids
},
game_id: gameID
};
Expand Down
5 changes: 3 additions & 2 deletions src/middleware/parse-user-agent.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import express from 'express';
import { CTRSystemModel } from '@/types/common/user-agent-info';
import type { UserAgentInfo } from '@/types/common/user-agent-info';
import type express from 'express';
// import RequestException from '@/request-exception';
import { CTRSystemModel, UserAgentInfo } from '@/types/common/user-agent-info';

const FIRMWARE_PATCH_REGION_WIIU_REGEX = /(\d)([JEU])/;

Expand Down
2 changes: 1 addition & 1 deletion src/models/cec-data.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import mongoose from 'mongoose';
import { ICECData, ICECDataMethods, CECDataModel } from '@/types/mongoose/cec-data';
import type { ICECData, ICECDataMethods, CECDataModel } from '@/types/mongoose/cec-data';

const CECDataSchema = new mongoose.Schema<ICECData, CECDataModel, ICECDataMethods>({
creator_pid: Number,
Expand Down
2 changes: 1 addition & 1 deletion src/models/cec-slot.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import mongoose from 'mongoose';
import { ICECSlot, ICECSlotMethods, CECSlotModel } from '@/types/mongoose/cec-slot';
import type { ICECSlot, ICECSlotMethods, CECSlotModel } from '@/types/mongoose/cec-slot';

const CECSlotSchema = new mongoose.Schema<ICECSlot, CECSlotModel, ICECSlotMethods>({
creator_pid: Number,
Expand Down
4 changes: 2 additions & 2 deletions src/models/file.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import mongoose from 'mongoose';
import { AutoIncrementID } from '@typegoose/auto-increment';
import { IFile, IFileMethods, FileModel } from '@/types/mongoose/file';
import { AutoIncrementID } from '@typegoose/auto-increment';
import type { IFile, IFileMethods, FileModel } from '@/types/mongoose/file';

const FileSchema = new mongoose.Schema<IFile, FileModel, IFileMethods>({
deleted: {
Expand Down
4 changes: 2 additions & 2 deletions src/models/task.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import mongoose from 'mongoose';
import { ITask, ITaskMethods, TaskModel } from '@/types/mongoose/task';
import type { ITask, ITaskMethods, TaskModel } from '@/types/mongoose/task';

const TaskSchema = new mongoose.Schema<ITask, TaskModel, ITaskMethods>({
deleted: {
Expand All @@ -12,7 +12,7 @@ const TaskSchema = new mongoose.Schema<ITask, TaskModel, ITaskMethods>({
creator_pid: Number,
status: {
type: String,
enum : ['open'] // TODO - What else is there?
enum: ['open'] // TODO - What else is there?
},
title_id: String,
description: Number,
Expand Down
2 changes: 1 addition & 1 deletion src/request-exception.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export default class RequestException extends Error {

this.status = status;
}
}
}
11 changes: 6 additions & 5 deletions src/services/grpc/boss/delete-file.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { CallContext, Status, ServerError } from 'nice-grpc';
import { DeleteFileRequest } from '@pretendonetwork/grpc/boss/delete_file';
import { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc';
import { Status, ServerError } from 'nice-grpc';
import { getTaskFileByDataID } from '@/database';
import { AuthenticationCallContextExt } from '@/services/grpc/boss/middleware/authentication-middleware';
import { Empty } from '@pretendonetwork/grpc/boss/google/protobuf/empty';
import type { CallContext } from 'nice-grpc';
import type { DeleteFileRequest } from '@pretendonetwork/grpc/boss/delete_file';
import type { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc';
import type { Empty } from '@pretendonetwork/grpc/boss/google/protobuf/empty';
import type { AuthenticationCallContextExt } from '@/services/grpc/boss/middleware/authentication-middleware';

export async function deleteFile(request: DeleteFileRequest, context: CallContext & AuthenticationCallContextExt): Promise<Empty> {
// * This is asserted in authentication middleware, we know this is never null
Expand Down
11 changes: 6 additions & 5 deletions src/services/grpc/boss/delete-task.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { CallContext, Status, ServerError } from 'nice-grpc';
import { DeleteTaskRequest } from '@pretendonetwork/grpc/boss/delete_task';
import { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc';
import { Status, ServerError } from 'nice-grpc';
import { getTask } from '@/database';
import { AuthenticationCallContextExt } from '@/services/grpc/boss/middleware/authentication-middleware';
import { Empty } from '@pretendonetwork/grpc/boss/google/protobuf/empty';
import type { CallContext } from 'nice-grpc';
import type { DeleteTaskRequest } from '@pretendonetwork/grpc/boss/delete_task';
import type { GetUserDataResponse } from '@pretendonetwork/grpc/account/get_user_data_rpc';
import type { AuthenticationCallContextExt } from '@/services/grpc/boss/middleware/authentication-middleware';
import type { Empty } from '@pretendonetwork/grpc/boss/google/protobuf/empty';

export async function deleteTask(request: DeleteTaskRequest, context: CallContext & AuthenticationCallContextExt): Promise<Empty> {
// * This is asserted in authentication middleware, we know this is never null
Expand Down
2 changes: 1 addition & 1 deletion src/services/grpc/boss/implementation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { BOSSServiceImplementation } from '@pretendonetwork/grpc/boss/boss_service';
import { listKnownBOSSApps } from '@/services/grpc/boss/list-known-boss-apps';
import { listTasks } from '@/services/grpc/boss/list-tasks';
import { registerTask } from '@/services/grpc/boss/register-task';
Expand All @@ -8,6 +7,7 @@ import { listFiles } from '@/services/grpc/boss/list-files';
import { uploadFile } from '@/services/grpc/boss/upload-file';
import { updateFileMetadata } from '@/services/grpc/boss/update-file-metadata';
import { deleteFile } from '@/services/grpc/boss/delete-file';
import type { BOSSServiceImplementation } from '@pretendonetwork/grpc/boss/boss_service';

export const implementation: BOSSServiceImplementation = {
listKnownBOSSApps,
Expand Down
2 changes: 1 addition & 1 deletion src/services/grpc/boss/list-files.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Status, ServerError } from 'nice-grpc';
import { ListFilesRequest, ListFilesResponse } from '@pretendonetwork/grpc/boss/list_files';
import { isValidCountryCode, isValidLanguage } from '@/util';
import { getTaskFiles } from '@/database';
import type { ListFilesRequest, ListFilesResponse } from '@pretendonetwork/grpc/boss/list_files';

const BOSS_APP_ID_FILTER_REGEX = /^[A-Za-z0-9]*$/;

Expand Down
Loading

0 comments on commit 9bebbe6

Please sign in to comment.