Skip to content

Commit

Permalink
fix indentation and eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
3vorp committed Jan 17, 2024
1 parent de25cda commit 0b5403b
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 29 deletions.
31 changes: 11 additions & 20 deletions src/v2/controller/pack.controller.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
import { Body, Controller, Delete, Get, Path, Post, Put, Query, Route, Security, Tags } from "tsoa";
import { PackService } from "../service/pack.service";
import {
AnyPack,
CreationPackAll,
FaithfulPack,
Pack,
PackAll,
PackTag,
PackType,
Packs,
} from "../interfaces";
import { AnyPack, CreationPackAll, Pack, PackAll, PackTag, PackType, Packs } from "../interfaces";

@Route("packs")
@Tags("Packs")
Expand Down Expand Up @@ -59,27 +50,27 @@ export class PackController extends Controller {

/**
* Change a pack ID and all its contributions if possible
* @param old_pack pack ID to replace
* @param new_pack pack ID to replace with
* @param old_pack Pack ID to replace
* @param new_pack Pack ID to replace with
*/
@Put("rename/{old_pack}/{new_pack}")
@Security("bot")
@Security("discord", ["administrator"])
@Security("bot")
@Security("discord", ["administrator"])
public async renamePack(@Path() old_pack: AnyPack, @Path() new_pack: string): Promise<void> {
return this.service.renamePack(old_pack, new_pack);
}

/**
* Get a pack and its associated submission information by ID
* @param pack_id Pack with submission support
* @param pack_id Pack ID
*/
@Get("{pack_id}/all")
public async getWithSubmission(@Path() pack_id: FaithfulPack): Promise<PackAll> {
public async getWithSubmission(@Path() pack_id: AnyPack): Promise<PackAll> {
return this.service.getWithSubmission(pack_id);
}

/**
* Create a pack or pack and submission at the same time
* Create a pack, or a pack and submission at the same time
* @param body Pack (or pack and submission) to add
*/
@Post("")
Expand All @@ -91,7 +82,7 @@ export class PackController extends Controller {

/**
* Edit an existing pack
* @param id pack ID
* @param id Pack ID
* @param body Pack information
*/
@Put("{id}")
Expand All @@ -102,8 +93,8 @@ export class PackController extends Controller {
}

/**
* Deletes the entire pack
* @param id pack ID
* Deletes the entire pack, including associated submission information
* @param id Pack ID
*/
@Delete("{id}")
@Security("bot")
Expand Down
6 changes: 3 additions & 3 deletions src/v2/controller/submission.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class SubmissionController extends Controller {

/**
* Edit an existing submission pack
* @param id pack ID
* @param id Pack ID to edit
* @param body Pack information
*/
@Put("{id}")
Expand All @@ -52,8 +52,8 @@ export class SubmissionController extends Controller {
}

/**
* Deletes the entire pack
* @param id pack ID
* Deletes the submission pack entry (effectively converts a submission pack to a regular pack)
* @param id Pack ID
*/
@Delete("{id}")
@Security("bot")
Expand Down
2 changes: 1 addition & 1 deletion src/v2/interfaces/packs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export interface FirestormPack extends Pack {
export interface PackRepository {
getRaw(): Promise<Record<string, Pack>>;
getById(id: AnyPack): Promise<Pack>;
getWithSubmission(id: FaithfulPack): Promise<PackAll>;
getWithSubmission(id: AnyPack): Promise<PackAll>;
getAllTags(): Promise<PackTag[]>;
search(params: PackSearch): Promise<Packs>;
renamePack(oldPack: AnyPack, newPack: string): Promise<void>;
Expand Down
4 changes: 2 additions & 2 deletions src/v2/repository/firestorm/packs.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ export default class PackFirestormRepository implements PackRepository {
return packs.get(id);
}

async getWithSubmission(id: FaithfulPack): Promise<PackAll> {
async getWithSubmission(id: AnyPack): Promise<PackAll> {
const pack = await packs.get(id);
const submission = await this.submissionRepo.getById(id).catch(() => null);
const submission = await this.submissionRepo.getById(id as FaithfulPack).catch(() => null);

// faithful pack with no submission information found
if (!submission) return { ...pack, submission: {} };
Expand Down
2 changes: 1 addition & 1 deletion src/v2/repository/firestorm/submissions.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default class SubmissionFirestormRepository implements SubmissionReposito
}

async getEveryPack(): Promise<Record<AnyPack, PackAll>> {
const submissionPacks = await submissions.readRaw().then((packs) => Object.values(packs));
const submissionPacks = await submissions.readRaw().then(Object.values);
const fullPackPromises = submissionPacks.map(async (p) => ({
...(await packs.get(p.id)),
submission: p,
Expand Down
3 changes: 1 addition & 2 deletions src/v2/service/pack.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
Packs,
AnyPack,
PackSearch,
FaithfulPack,
CreationPackAll,
Contributions,
PackAll,
Expand All @@ -27,7 +26,7 @@ export class PackService {
return this.repository.search(params);
}

public getWithSubmission(id: FaithfulPack): Promise<PackAll> {
public getWithSubmission(id: AnyPack): Promise<PackAll> {
return this.repository.getWithSubmission(id);
}

Expand Down

0 comments on commit 0b5403b

Please sign in to comment.