Skip to content

Commit

Permalink
always use default export for service classes
Browse files Browse the repository at this point in the history
inconsistency has been bothering me for a long time
  • Loading branch information
3vorp committed Mar 15, 2024
1 parent e81f02b commit e27758c
Show file tree
Hide file tree
Showing 17 changed files with 22 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/v2/controller/addonChange.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
AddonUpdateParam,
} from "../interfaces/addons";
import { PermissionError, BadRequestError } from "../tools/ApiError";
import { UserService } from "../service/user.service";
import UserService from "../service/user.service";
import AddonService from "../service/addon.service";
import cache from "../tools/cache";

Expand Down
2 changes: 1 addition & 1 deletion src/v2/controller/file.controller.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Controller, Get, Route, Tags, Security } from "tsoa";
import { FileService } from "../service/file.service";
import FileService from "../service/file.service";
import { File } from "../interfaces";

@Route("files")
Expand Down
2 changes: 1 addition & 1 deletion src/v2/controller/gallery.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import GalleryService from "../service/gallery.service";
import TextureService from "../service/texture.service";
import cache from "../tools/cache";
import { PackService } from "../service/pack.service";
import PackService from "../service/pack.service";

@Route("gallery")
@Tags("Gallery")
Expand Down
2 changes: 1 addition & 1 deletion src/v2/controller/pack.controller.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Body, Controller, Delete, Get, Path, Post, Put, Query, Route, Security, Tags } from "tsoa";
import { WriteConfirmation } from "firestorm-db";
import { PackService } from "../service/pack.service";
import PackService from "../service/pack.service";
import { PackID, CreationPackAll, Pack, PackAll, PackType, Packs } from "../interfaces";

@Route("packs")
Expand Down
2 changes: 1 addition & 1 deletion src/v2/controller/settings.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from "tsoa";
import { WriteConfirmation } from "firestorm-db";
import { NotFoundError, PermissionError } from "../tools/ApiError";
import { SettingsService } from "../service/settings.service";
import SettingsService from "../service/settings.service";

@Route("settings")
@Tags("Settings")
Expand Down
2 changes: 1 addition & 1 deletion src/v2/controller/submission.controller.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Body, Controller, Delete, Get, Path, Post, Put, Route, Security, Tags } from "tsoa";
import { WriteConfirmation } from "firestorm-db";
import { SubmissionService } from "../service/submission.service";
import SubmissionService from "../service/submission.service";
import { PackID, CreationSubmission, PackAll, Submission } from "../interfaces";

@Route("submissions")
Expand Down
2 changes: 1 addition & 1 deletion src/v2/controller/user.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
UserProfile,
Username,
} from "../interfaces";
import { UserService } from "../service/user.service";
import UserService from "../service/user.service";
import cache from "../tools/cache";

@Route("users")
Expand Down
2 changes: 1 addition & 1 deletion src/v2/repository/files.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import FormData from "form-data";
import { files } from "../firestorm";
import { File, FileParent, FileRepository, Files, FileUse } from "../interfaces/files";

export class FilesFirestormRepository implements FileRepository {
export class FileFirestormRepository implements FileRepository {
getRaw(): Promise<Record<string, File>> {
return files.readRaw();
}
Expand Down
4 changes: 2 additions & 2 deletions src/v2/service/addon.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { WriteConfirmation } from "firestorm-db";
import { User, UserProfile } from "../interfaces/users";
import { Addons, Addon, AddonStatus, AddonAll, Files, File, FileParent } from "../interfaces";
import { BadRequestError, NotFoundError } from "../tools/ApiError";
import { UserService } from "./user.service";
import { FileService } from "./file.service";
import UserService from "./user.service";
import FileService from "./file.service";
import {
AddonCreationParam,
AddonDataParam,
Expand Down
6 changes: 3 additions & 3 deletions src/v2/service/file.service.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { WriteConfirmation } from "firestorm-db";
import { FilesFirestormRepository } from "../repository/files.repository";
import { FileFirestormRepository } from "../repository/files.repository";
import { FileParent, FileUse, File, Files } from "../interfaces/files";

export class FileService {
private readonly repo = new FilesFirestormRepository();
export default class FileService {
private readonly repo = new FileFirestormRepository();

public removeFileByPath(path: string): Promise<WriteConfirmation> {
return this.repo.removeFileByPath(path);
Expand Down
2 changes: 1 addition & 1 deletion src/v2/service/gallery.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { textures } from "../firestorm";
import { Edition, GalleryResult, PackID, Path, MCMETA, Textures, Use, Uses } from "../interfaces";
import { NotFoundError } from "../tools/ApiError";
import { PackService } from "./pack.service";
import PackService from "./pack.service";
import PathService from "./path.service";
import TextureService from "./texture.service";
import UseService from "./use.service";
Expand Down
2 changes: 1 addition & 1 deletion src/v2/service/pack.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from "../interfaces";
import PackFirestormRepository from "../repository/packs.repository";

export class PackService {
export default class PackService {
private readonly repo = new PackFirestormRepository();

public getRaw(): Promise<Record<string, Pack>> {
Expand Down
2 changes: 1 addition & 1 deletion src/v2/service/settings.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { WriteConfirmation } from "firestorm-db";
import SettingsFirestormRepository from "../repository/settings.repository";

export class SettingsService {
export default class SettingsService {
private readonly settingsRepository = new SettingsFirestormRepository();

raw(): Promise<Record<string, any>> {
Expand Down
4 changes: 2 additions & 2 deletions src/v2/service/submission.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { WriteConfirmation } from "firestorm-db";
import { Submission, CreationSubmission, PackID, PackAll } from "../interfaces";
import SubmissionFirestormRepository from "../repository/submissions.repository";
import { BadRequestError } from "../tools/ApiError";
import { PackService } from "./pack.service";
import PackService from "./pack.service";

export class SubmissionService {
export default class SubmissionService {
private readonly packService = new PackService();

private readonly repo = new SubmissionFirestormRepository();
Expand Down
2 changes: 1 addition & 1 deletion src/v2/service/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import UserFirestormRepository from "../repository/user.repository";
import { BadRequestError } from "../tools/ApiError";

export class UserService {
export default class UserService {
private readonly repo = new UserFirestormRepository();

public getRaw(): Promise<Record<string, User>> {
Expand Down
2 changes: 1 addition & 1 deletion src/v2/tools/authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Request as ExRequest } from "express";
import axios from "axios";
import { APIUser } from "discord-api-types/v10";
import { PermissionError, NotFoundError, ApiError, ForbiddenError } from "./ApiError";
import { UserService } from "../service/user.service";
import UserService from "../service/user.service";
import AddonService from "../service/addon.service";
import { Addon } from "../interfaces";
import { AddonNotApprovedValues, AddonStatusValues } from "../interfaces/addons";
Expand Down
8 changes: 2 additions & 6 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,8 @@
"resolveJsonModule": true,
"baseUrl": "src",
"paths": {
"@/*": [
"../*"
],
"~/*": [
"*"
]
"@/*": ["../*"],
"~/*": ["*"],
}
},
"exclude": [
Expand Down

0 comments on commit e27758c

Please sign in to comment.