Skip to content

Commit

Permalink
use dedicated array types where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
3vorp committed Jan 6, 2024
1 parent f9ca396 commit dc5ab45
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/v2/controller/contributions.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export class ContributionsController extends Controller {
@Security("bot")
public async addContribution(
@Body() body: ContributionCreationParams | ContributionCreationParams[],
): Promise<Contribution | Contribution[]> {
): Promise<Contribution | Contributions> {
return Array.isArray(body)
? this.service.addContributions(body)
: this.service.addContribution(body);
Expand Down
2 changes: 1 addition & 1 deletion src/v2/repository/firestorm/path.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default class PathFirestormRepository implements PathRepository {
return paths.add(structuredClone(path)).then((id) => ({ ...structuredClone(path), id }));
}

createPathBulk(pathArray: InputPath[]): Promise<Path[]> {
createPathBulk(pathArray: InputPath[]): Promise<Paths> {
return paths.addBulk(pathArray).then((ids) => paths.searchKeys(ids));
}

Expand Down
8 changes: 4 additions & 4 deletions src/v2/repository/firestorm/user.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { users } from "../../firestorm";
import {
Addons,
Contributions,
Media,
UserNames,
User,
Users,
UserCreationParams,
UserRepository,
UserName,
UserProfile,
Medias,
} from "../../interfaces";

// eslint-disable-next-line no-underscore-dangle
Expand Down Expand Up @@ -115,7 +115,7 @@ export default class UserFirestormRepository implements UserRepository {
ignoreCase: true,
},
])
.then((arr: Array<User>) => arr.map((el) => __transformUser(el)));
.then((arr: Users) => arr.map((el) => __transformUser(el)));
}

getUsersFromRole(role: string, username?: string): Promise<Users> {
Expand All @@ -138,7 +138,7 @@ export default class UserFirestormRepository implements UserRepository {
ignoreCase: true,
});

return users.search(options).then((arr: Array<User>) => arr.map((el) => __transformUser(el)));
return users.search(options).then((arr: Users) => arr.map((el) => __transformUser(el)));
}

getRoles(): Promise<Array<string>> {
Expand Down Expand Up @@ -183,7 +183,7 @@ export default class UserFirestormRepository implements UserRepository {
username: string;
uuid: string;
anonymous: boolean;
media: Media[];
media: Medias;
}>,
) =>
_users.map((el) => ({
Expand Down
2 changes: 1 addition & 1 deletion src/v2/service/contributions.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export default class ContributionService {
return this.contributionRepo.addContribution(params);
}

addContributions(params: ContributionCreationParams[]): Promise<Contribution[]> {
addContributions(params: ContributionCreationParams[]): Promise<Contributions> {
return this.contributionRepo.addContributions(params);
}

Expand Down
4 changes: 2 additions & 2 deletions src/v2/service/texture.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Contributions, InputPath, Paths, Texture, Textures, Use, Uses } from "../interfaces";
import { Contributions, InputPath, Paths, Texture, Textures, Uses } from "../interfaces";
import {
Edition,
EntireTextureToCreate,
Expand Down Expand Up @@ -97,7 +97,7 @@ export default class TextureService {
const textureID = createdTexture.id;

// create uses
const [useIDs, fullUsesToCreate]: [string[], Use[]] = input.uses.reduce(
const [useIDs, fullUsesToCreate]: [string[], Uses] = input.uses.reduce(
(acc, u, ui) => {
const useID = String(textureID) + String.fromCharCode("a".charCodeAt(0) + ui);
const use = {
Expand Down

0 comments on commit dc5ab45

Please sign in to comment.